• 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 Teleport scroll not working

XxDeathAvenger

New Member
Joined
May 5, 2011
Messages
95
Reaction score
2
If I have my teleport scroll actionid set to 45001, and the itemid is 2345, what should I change on this?
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not getCreatureCondition(cid, CONDITION_INFIGHT) then
        doTeleportThing(cid, getPlayerMasterPos(cid))
        doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
        doSetItemActionId(item.uid, item.actionid ~= 0 and item.actionid + 100 or 100)
    if item.actionid == 500 then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This item was used to many times and has been worn out.")
       doRemoveItem(item.uid, 1)
end
    else
        doPlayerSendCancel(cid, "Please go to a safe area before using this scroll.")
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    end
    return true
end
 
ActionID of the scroll should be 0.
in actions.xml you want to set the itemID in this case
The script adds 100 to the actionID, and once it's been used 5x then on 6th time it will remove the item.
I think it should be set to 400.. and teleport the player 1 last time.. and remove the item at the same time.. but that's just me.
also the script is semi broken as it currently is.
You need to change the second if statement to an elseif, or change how it checks the actionID in the first place.

edit.. nevermind the tabbing is terrible. The script is fine.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
     if not getCreatureCondition(cid, CONDITION_INFIGHT) then
         doTeleportThing(cid, getPlayerMasterPos(cid))
         doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
         doSetItemActionId(item.uid, item.actionid ~= 0 and item.actionid + 100 or 100)
         if item.actionid == 500 then
             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This item was used to many times and has been worn out.")
             doRemoveItem(item.uid, 1)
         end
     else
         doPlayerSendCancel(cid, "Please go to a safe area before using this scroll.")
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
     end
     return true
end
 
Last edited:
Back
Top