• 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!

Solved Duration on doSummonCreature

auda

Advanced OT User
Joined
Jun 29, 2014
Messages
273
Reaction score
233
Location
Sweden
Hey guys! I wrote the most simple script for my gameworld and want to implement a boss where you press on the item with actionid = 666 and he spawns, ofcourse. But I don't seem to find a way to add exhaust/duration on the script before you can summon him again. I'd say about 360 seconds (several minutes).

The script:

Code:
function onUse(cid, item, frompos, item2, topos)
    if(item.actionid == 666) then
        doSummonCreature("Count Vladimir", {x = 1086, y = 1053, z = 10})
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You\'ve awakened the vampire lord.")
        doSendMagicEffect(getThingPos(cid), CONST_ME_DRAWBLOOD)
    return TRUE
    end
end

Thanks!

PS: As a summary I want to make it impossible to pull over and over again to spawn multiple bosses!
 
To set the time
Code:
setGlobalStorageValue(storage, os.time() + 360)

To check if the exhaustion is still there.
Code:
if getGlobalStorageValue(storage) >= os.time() then
   -- still exhaustion
Or
Code:
if getGlobalStorageValue(storage) < os.time() then
   -- no exhaustion
 
To set the time
Code:
setGlobalStorageValue(storage, os.time() + 360)

To check if the exhaustion is still there.
Code:
if getGlobalStorageValue(storage) >= os.time() then
   -- still exhaustion
Or
Code:
if getGlobalStorageValue(storage) < os.time() then
   -- no exhaustion

Where exactly am I suppose to add these lines in the script? Also, when I tried I got an error in the console, something about "TIME" (can't say exactly what it stood since I'm currently at work! Thanks!
 
Code:
local storage = 38473

function onUse(cid, item, frompos, item2, topos)
     if getGlobalStorageValue(storage) >= os.time() then
         return doPlayerSendCancel(cid, "You need to wait 6 minutes before summoning one again.")
     end
     if item.actionid == 666 then
         doSummonCreature("Count Vladimir", {x = 1086, y = 1053, z = 10})
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You\'ve awakened the vampire lord.")
         doSendMagicEffect(getThingPos(cid), CONST_ME_DRAWBLOOD)
         setGlobalStorageValue(storage, os.time() + 360)
     end
     return TRUE
end

Btw, if it's added with actionid 666 in actions.xml then doing this isn't needed:
Code:
if item.actionid == 666 then
 
Code:
local storage = 38473

function onUse(cid, item, frompos, item2, topos)
     if getGlobalStorageValue(storage) >= os.time() then
         return doPlayerSendCancel(cid, "You need to wait 6 minutes before summoning one again.")
     end
     if item.actionid == 666 then
         doSummonCreature("Count Vladimir", {x = 1086, y = 1053, z = 10})
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You\'ve awakened the vampire lord.")
         doSendMagicEffect(getThingPos(cid), CONST_ME_DRAWBLOOD)
         setGlobalStorageValue(storage, os.time() + 360)
     end
     return TRUE
end

Btw, if it's added with actionid 666 in actions.xml then doing this isn't needed:
Code:
if item.actionid == 666 then

Worked wonders! Cheers! :) How do I rep you?
 
Back
Top