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

Scripting

donacool

Mapper Scripter Ot Owner
Joined
Jan 15, 2010
Messages
97
Reaction score
0
hello otlanders i just got an issue with a script the server is tfs compiled with warsystem 8.54. i have it added in xml and the code in lua.

heres the code of my script
Code:
local toPos = {x = 35000, y = 35000, z = 6}
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if isPlayer(cid) then
		if item.itemuid == 1002 then <!-- tile id -->
			doTeleportThing(cid, toPos)
			doSendMagicEffect(cid, CONST_ME_MAGIC_BLUE)
		end return true
	end
end
thats the sricpt and i saved it as tileteleporter.lua

and added this to movements.xml

Code:
<movement type="StepIn" itemuid="1002" event="script" value="tileteleporter.lua"/>
and in the map i gived it the uid and all but when i step in the tile it dont teleports me!

someone can tell me why?
i use notepad ++
 
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local p,v = {x = 35000, y = 35000, z = 6},getThingPos(cid)
	if isPlayer(cid) then
		doTeleportThing(cid,p)
		doSendMagicEffect(v,12)
	end
	return true
end

Code:
<movement type="StepIn" [B]itemid[/B]="1002" event="script" value="tileteleporter.lua"/>

no need to check for itemid in the script if is registered.
 
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local p,v = {x = 35000, y = 35000, z = 6},getThingPos(cid)
	if isPlayer(cid) then
		doTeleportThing(cid,p)
		doSendMagicEffect(v,12)
	end
	return true
end

Code:
<movement type="StepIn" [B]itemid[/B]="1002" event="script" value="tileteleporter.lua"/>

no need to check for itemid in the script if is registered.
but if is unique id?
 
register the itemid.

Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local p,v = {x = 35000, y = 35000, z = 6},getThingPos(cid)
	if(item.uniqueid == 1002 and isPlayer(cid))then
                doTeleportThing(cid,p)
		doSendMagicEffect(v,12)
	end
	return true
end
 
@up
lal

Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local p,v = {x = 35000, y = 35000, z = 6},getThingPos(cid)
	if(item.[COLOR="Red"]uid[/COLOR] == 1002 and isPlayer(cid))then
                doTeleportThing(cid,p)
		doSendMagicEffect(v,12)
	end
	return true
end
And actions.xml:
Code:
<movement type="StepIn" [COLOR="Red"]uniqueid[/COLOR]="1002" event="script" value="tileteleporter.lua"/>

Hope that helped you
 
@up
lal

Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local p,v = {x = 35000, y = 35000, z = 6},getThingPos(cid)
	if(item.[COLOR="Red"]uid[/COLOR] == 1002 and isPlayer(cid))then
                doTeleportThing(cid,p)
		doSendMagicEffect(v,12)
	end
	return true
end
And actions.xml:
Code:
<movement type="StepIn" [COLOR="Red"]uniqueid[/COLOR]="1002" event="script" value="tileteleporter.lua"/>

Hope that helped you

both ways are the same, mine only requires to register itemid instead of uniqueid <_<
 
lol i tried it and it doesnt function any of the scripts
it just function without uid but i need uid can someone help me?
 
Try this and don't forget to add the unique id to your teleport.

Code:
function onStepIn(cid, item, fromPos, itemEx, toPos)

local tppos = {x=35000, y=35000, z=6}  -- Teleport destination

  if isPlayer(cid) and item.uid == 1002 then
      doTeleportThing(cid, tppos)
      doSendMagicEffect(getPlayerPosition(cid), 10)   	
  end
  return TRUE
end

And the line for your movements script.
Code:
<movement type="StepIn" uniqueid="1002" event="script" value="tileteleporter.lua"/>



If the script isn't working because I am not sure if you use a regular teleport or another tile or w.e. than try this script.
Again you need to set the uniqueid (yyyy) of the teleport/tile and the itemid (xxxx) of the teleport/tile.
Code:
function onStepIn(cid, item, fromPos, itemEx, toPos)

local tppos = {x=35000, y=35000, z=6}  -- Teleport destination
local tileid = xxxx  -- Id of the tile
local uniqueid = yyyy -- uniqueid from teleport
 
    if isPlayer(cid) and item.uid == uniqueid and item.itemid == tileid then
      doTeleportThing(cid, tppos)
      doSendMagicEffect(getPlayerPosition(cid), 10)   	
    end
  return TRUE
end
Movements.xml
Don't forget to change the yyyy (the same as above).
Code:
<movement type="StepIn" uniqueid="yyyy" event="script" value="tileteleporter.lua"/>

Working on TFS 0.3.6, Tibia 8.54
Edit: changed in last script 3500 into 35000
 
Last edited:
Back
Top