• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Action script doubt tfs 1.1

Xarly

Member
Joined
Mar 9, 2015
Messages
360
Reaction score
20
Hello guys well i want to make a script for when i use example silver prison key in one Iditem the player get teleported sto a position so use silver prison key on the item with id 22607 and player get teleported to a x position and the item break how i can make it? im using tfs 1.1 thanks guys!
 
To teleport player you can use this function:

Code:
player:TeleportTo(x, y, z)
yea bro but i need to know how to use x key on x item for get teleported to x position xd with that only i can¡t do nothing >.<

bump!
 
Last edited by a moderator:
Use an action script, so that will look like this.
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

     return true
end
Then check for itemid of the target, so target.itemid.
Code:
if target.itemid == 22607 then
Then teleport the player and close the if statement with end.

Add the script with key itemid in actions.xml.
 
Use an action script, so that will look like this.
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

     return true
end
Then check for itemid of the target, so target.itemid.
Code:
if target.itemid == 22607 then
Then teleport the player and close the if statement with end.

Add the script with key itemid in actions.xml.
okey!mate iw ill check this later and i let you know thanks for all limos!

Use an action script, so that will look like this.
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

     return true
end
Then check for itemid of the target, so target.itemid.
Code:
if target.itemid == 22607 then
Then teleport the player and close the if statement with end.

Add the script with key itemid in actions.xml.
limos one question about the another day because im idiot and i deleted some things so, when i added new event on login.lua what i need to do after? for work script? xd i can't remember it now >.<
 
Last edited by a moderator:
Register the name you used in creaturescripts.xml.
okey! thanks mate haha now yes!

Register the name you used in creaturescripts.xml.
added on creaturescripts.xml but still no work af im awesome idiot, so remember when i tried to make
print("test") on the script but don't worked? because i need add it idk where? >.<

added on creaturescripts.xml but still no work af im awesome idiot, so remember when i tried to make
print("test") on the script but don't worked? because i need add it idk where? >.<
ah omg now sorry im tard xD
 
Last edited by a moderator:
Use an action script, so that will look like this.
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

     return true
end
Then check for itemid of the target, so target.itemid.
Code:
if target.itemid == 22607 then
Then teleport the player and close the if statement with end.

Add the script with key itemid in actions.xml.
well i got it limos
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if target.itemid == 22634 then
player:TeleportTo(33607, 32396, 11)
end
return true
end
and i get on distro error attempt to call method TeleportTo
 
tried:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if comparePos(getCreaturePosition(cid), {33605, 32394, 11}) then
if target.itemid == 22634 then
item:remove(22634)
player:teleportTo(Position(33574, 32414, 12), false)
end
return true
end
but i get distro error 'end' expected < to close 'functions' at line 1> near <eof> >.<
 
You have to close if statements with end.
Also the functions from that link are for an older TFS version, so use player:getPosition() and the position should be with x,y,z or with Position, so Position(33605, 32394, 11).
 
You have to close if statements with end.
Also the functions from that link are for an older TFS version, so use player:getPosition() and the position should be with x,y,z or with Position, so Position(33605, 32394, 11).
now i get distro error Comparepos i tried
if comparePos (player:getPosition(33143, 31527, 2)) then
end

also tried
if (player:getPosition(33143, 31527, 2)) then
end < that function worked without comparePos but still can using the key from any position
 
Back
Top