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

[Request] Lua Spell Scripts

ZyK

New Member
Joined
Feb 3, 2009
Messages
16
Reaction score
0
I'm currently running a DevLand SQL (Tibia 8.0 Version) engine, and I was wondering if anyone could help me out with two lua spell scripts I need.

It's actually kind of simple, but I can't get it right! some error always comes up.

They are both teleporting spells.
The first one would be ALMOST EXACTLY like the /goto command, though it would be a spell <for players> and something like teleport "PlayerName
@EDIT:
I THINK THIS SPELL COULD WORK WITH A GLOBAL FUNCTION, BUT I DON'T SEEM TO GET IT RIGHT MYSELF.

The second one would be a teleporting either spell or rune.
If it's a spell, it should teleport you to your target.
If it's a rune, it should teleport you to the square of your choice <Used with crosshairs ofc> this is what I did: <not working unfortunately>
Code:
function onCastSpell(cid, var)
local pos = variantToPosition(var)
        doTeleportThing(cid, pos, FALSE)
        doSendMagicEffect(pos, 10)
doRemoveCondition(cid, 11) 
end

I can't offer anything in exchange, but whoever is able to get them done for me will get REP+ for sure.


I am not new to LUA scripting, but I don't have much time to get this done, so please, help me, you will for sure make the ~60 daily players <and our staff:D> happy.

Thanks in Advance,
ZyK
 
Well i got an script for teleport scroll!
Code:
local Time1 = 0 
local Use1 = 0 
local timecount = 10 

local function exhaust(cid, storevalue, exhausttime)
-- Exhaustion function by Alreth, v1.1 2006-06-24 01:31
-- Returns 1 if not exhausted and 0 if exhausted
    
    newExhaust = os.time()
    oldExhaust = getPlayerStorageValue(cid, storevalue)
    if (oldExhaust == nil or oldExhaust < 0) then
        oldExhaust = 0
    end
    if (exhausttime == nil or exhausttime < 0) then
        exhausttime = 1
    end
    diffTime = os.difftime(newExhaust, oldExhaust)
    if (diffTime >= exhausttime or diffTime < 0) then
        setPlayerStorageValue(cid, storevalue, newExhaust) 
        return 1
    else
        return 0
    end
end

local function onTime1(z) 
 if isPlayer(z.cid) == 1 then 
 ppos = getPlayerPosition(z.cid) 
  if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 1  then 
   stopEvent(time1) 
   stopEvent(Use1) 
   doPlayerSendTextMessage(z.cid, 21, "Teleport Canceled Because of IN-FIGHT!") 
  else
   if timecount > 0 then
    Time1 = addEvent(onTime1, 1000, z)
   end
   timecount = timecount-1
   doPlayerSendTextMessage(z.cid, 21, "Teleporting in " .. timecount .. " second.")
   doSendMagicEffect(ppos, 53)
end
 else 
  stopEvent(time1) 
  stopEvent(Use1) 
 end 
end 
local function onUse1(z) 
 if isPlayer(z.cid) == 1 then 
  if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then 
   ppos = getPlayerPosition(z.cid)  
   stopEvent(time1) 
   if z.item.itemid == 7727 then 
    npos = {x=840,  y=701,  z=7} 
    doTeleportThing(z.cid, npos) 
    doPlayerSendTextMessage(z.cid, 21, "Teleported to RoXoR Teleport Room.") 
    doSendMagicEffect(npos,40) 
    doSendMagicEffect(npos,10) 
    doSendMagicEffect(ppos,10) 
    stopEvent(time1) 
   end  
  else 
   stopEvent(time1) 
   doPlayerSendTextMessage(z.cid, 21, "Teleport Canceled.") 
  end 
 end 
end 

function onUse(cid, item, ppos, frompos, item2, topos) 
 local z = {cid = cid, item = item, ppos = ppos, item2 = item2, topos = topos} 
 if isPremium(cid) then 
  if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then 
	if (exhaust(cid, 9143, 11) > 0) then
		Time1 = addEvent(onTime1, 1000, z) 
		Use1 = addEvent(onUse1, 11000, z) 
		timecount = 10
	else 
   doPlayerSendCancel(cid, "You cannot use a teleport scroll again until you have been teleported.") 
   doSendMagicEffect(frompos, 2) 
   end
   	else 
   doPlayerSendCancel(cid, "You cannot use a teleport scroll when you are in a fight.") 
   doSendMagicEffect(frompos, 2) 
  end 
 else 
  doPlayerSendCancel(cid, "Only players with a Premium account can use teleport scroll.") 
  doSendMagicEffect(frompos, 2) 
 end 
 return 1 
end
 
Bump.



@Ernstjan
Thanks, but that's not what I need, plus, thats just copied right out of the Roxor teleport scroll. I don't even think it would work on my DevLand version.
 
Back
Top