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

Teleport spell

Tarielle

New Member
Joined
Nov 4, 2007
Messages
214
Reaction score
0
Location
Sweden
Is it possible to make a spell that sends you like 2 sqm's at the way your standing... And cant be teleported into or through walls :<?
 
Ya... just need a direction check (getPlayerDir(cid)) and if there is no wall where he will be TPed (getThinfromPos(pos)).
 
Something like:
Code:
walls = {wallid, wallid bla bla bla}
pos = 0
if getPlayerDir(cid) == NORTH then
    pos = getCreaturePosition(cid).y + 2
elseif getPlayerDir(cid) == SOUTH then
    pos = getCreaturePosition(cid).y - 2
elseif getPlayerDir(cid) == EAST then
    pos = getCreaturePosition(cid).x + 2
elseif getPlayerDir(cid) == WEST then
    pos = getCreaturePosition(cid).x - 2
end

if isInArray(walls, getThingfromPos(pos)) == FALSE then
    doTeleportThing(cid, pos, 0)
else
    doPlayerSendTextMessage(cid, 22, "You cant teleport there.")
end

Its just a layout.. :P

And Im not sure about getPlayerDir() maybe its getPlayerLookDir(), check luascript.cpp for that ^^
 
Back
Top