• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Death portal rune.

This is the Code from dprune.lua

function onUse(cid, item, frompos, item2, topos)
if (not getTileInfo(getThingPosition(cid)).protection) then -- Checks if player is in Protection Zone, if not, the rune does not work.
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't use this rune outside of PZ.") and false
end

local storage, rune = 89523, 2296 -- (Storage ID - 89524 and 89525 need to be available.), RUNE ID
local p = {
getPlayerStorageValue(cid, storage),
getPlayerStorageValue(cid, storage+1),
getPlayerStorageValue(cid, storage+2)
} -- This is an array, used to index more than one value to a single variable.

if (p[1] > -1 and p[2] > -1) then -- To call the first value in the variable 'p', you must specify the index number, p[INDEX_#]
if (getPlayerItemCount(cid, rune) > 0) then
doPlayerRemoveItem(cid, rune, 1)
doTeleportThing(cid, {x=p[1], y=p[2], z=p[3]})
doSendMagicEffect({x=p[1], y=p[2], z=p[3]}, CONST_ME_TELEPORT)
for i = storage, storage+2 do -- this is a loop, sets the storage value back to -1, once it is used.
setPlayerStorageValue(cid, i, -1)
end
end
else
doPlayerSendCancel(cid,"You must die first to use this rune.")
end
return true
end
 
That is the action script, add the death script
Code:
function onDeath(cid, corpse, killer)
     local storage = 89523
     local playerPos = getPlayerPosition(cid)
     setPlayerStorageValue(cid, storage, playerPos.x)
     setPlayerStorageValue(cid, storage+1, playerPos.y)
     setPlayerStorageValue(cid, storage+2, playerPos.z)
     return true
end
 
In creaturescripts, instead of the dprune.lua you have added there now.
 
Okay I did that... now I dont have any Error in my Console. But now it says ingame when I died and I want to use the rune "You must die first to use this rune"
 
Did you died after you added the script and restarted your server and is it registered in login.lua?
 
Last edited:
Back
Top