• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Windows Script issues

Mariuskens

Sword Art Online 2D-MMORPG
Joined
Nov 21, 2008
Messages
1,009
Reaction score
119
Location
Spain
GitHub
Olimpotibia
Hi all otlanders!!

Im making littlel script with this fuctions: But im newbie need help!

Click on Stone -> 50% Spawn Stone golem / 40% get 1 platinum coin / 10% get nothing
With cooldown 2 min to click again.

Its possible make it?

Thnx
 
Sure its possible.. too bad you never gave any information about server version..
You give no server version, we give you no script.. see how this works?
 
Code:
local c = {
    stone = 1356,
    creature = "Stone Golem",
    pcoin = 2152,
    exhaust = true,
    time_ = (60 * 1000) * 2 -- 2 minutes
}

function wait(c)
    c.exhaust = true
end

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    local chance = math.random(1, 100)
    if item.itemid == c.stone and c.exhaust == true then
        c.exhaust = false
        if chance >= 50 then
            Game.createMonster(c.creature, fromPosition)
        elseif chance >= 40 and chance < 50 then
            player:addItem(pcoin, 1)
        elseif chance <= 39 then -- edited for dhrsantan
            fromPosition:sendMagicEffect(CONST_ME_POFF)
        end
        addEvent(wait, time_, c)
    end
    fromPosition:sendMagicEffect(CONST_ME_POFF)
    return true
end
 
Last edited:
elseif chance >= 40 and chance < 50 then

should be

elseif chance > 10 and chance < 50 then

otherwise it would do nothing if your math random gives out any number form 11 to 39
 
Okay during 1 week i test this and works fine BUT XD
exhausted in stones dont work xD

and platinum coin dont apper too

but OMG u can spam alot of Stone golems XDDDDDD
 
Try this:

Code:
local c = {
    stone = 1356,
    creature = "Stone Golem",
    pcoin = 2152,
    exhaust = true,
    time_ = (60 * 1000) * 2 -- 2 minutes
}

function wait(c)
    c.exhaust = true
end

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    local chance = math.random(1, 100)
    if item.itemid == c.stone and c.exhaust == true then
        c.exhaust = false
        if chance >= 50 then
            Game.createMonster(c.creature, fromPosition)
        elseif chance > 10 and chance < 50 then
            player:addItem(pcoin, 1)
        elseif chance <= 10 then
            fromPosition:sendMagicEffect(CONST_ME_POFF)
        end
        addEvent(wait, time_, c)
    end
    fromPosition:sendMagicEffect(CONST_ME_POFF)
    return true
end
 
Code:
local c = {
    stone = 22513,
    creature = "Guzzlemaw",
    pcoin = 22390,
    exhaust = true,
    time_ = (60 * 1000) * 2 -- 2 minutes
}

function wait(c)
    c.exhaust = true
end

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    local chance = math.random(1, 100)
    if item.itemid == c.stone and c.exhaust == true then
        c.exhaust = true
        if chance >= 50 then
            Game.createMonster(c.creature, fromPosition)
            player:say("Current exploration with fail!", TALKTYPE_ORANGE_1)
        elseif chance > 10 and chance < 50 then
            player:addItem(pcoin, 1)
            player:say("You get one Piece of Stone!", TALKTYPE_ORANGE_1)
        elseif chance <= 10 then
            fromPosition:sendMagicEffect(CONST_ME_POFF)
            player:say("Nothing happens!", TALKTYPE_ORANGE_1)       
        end
        addEvent(wait, time_, c)
    end
    fromPosition:sendMagicEffect(CONST_ME_POFF)
    return true
end

Please try this if work for you !

Im testing now but dont work perfect
 
Hi all otlanders!!

Im making littlel script with this fuctions: But im newbie need help!

Click on Stone -> 50% Spawn Stone golem / 40% get 1 platinum coin / 10% get nothing
With cooldown 2 min to click again.

Its possible make it?

Thnx

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local questStorageTime = 546421
    if player:getStorageValue(questStorageTime) >= os.time() then
        player:sendCancelMessage("Not yet..")
        return true
    end
   
    player:setStorageValue(questStorageTime, os.time()+ 60*2) -- set storage value (current time + 60*2 seconds) Thus the player cannot use the chest for 2 minutes after clicking it.
    local rand = math.random(100)
    if item.itemid == STONEID then -- change STONEID
        if rand <= 40 then
            Game.createMonster("Stone Golem", Position(456, 324, 7)) -- change the pos
        elseif rand > 40 and rand <= 90 then
            player:addItem(2152, 1) -- platinum coin id, amount
        else
            player:sendCancelMessage("You get nothing..") 
        end
    end
    return true
end
 
Back
Top