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

Lua Teleporter Change Town_ID

Yakushi

New Member
Joined
Dec 30, 2008
Messages
110
Reaction score
0
Location
Germany
Hello you all =)

I need a script, and i hope you can help me:

In my Server I have Rookgaard and Mainland... But instead of an oracle I have a teleporter, that everybody can leave and join Rook all the time.
But when they go into the Teleporter and they die in Mainland, they respawn in Rook. Not in Mainland.

So I need a script, that changes the Town_ID of the Character to Mainland Town. And when they go back into another Teleporter, they respawn in Rook.

So a script, with Actionid.

Please help and post the script.
Thx in Advanced.
Yakushi

PS: It doesn't help when u are posting : I think u must write setPlayertown (cbid) or something else because I can't script :D Only mapping and hosting! So Thx in advanced.

Hope that somebody can help me!
 
well I found citizen.lua.. That is a teleportscript:

Code:
function onStepIn(cid, item, position, fromPosition)
	if(item.actionid > 30020 and item.actionid < 30100) then
		doPlayerSetTown(cid, item.actionid - 30020)
	end
	return TRUE
end

Other Teleporter in the temple (like in RL Tibia, that the character there respawn) have action id 30020, 30021 and so...and they work. Then I mapped in the teleporter ActionId:30039 and 30040 (no idea why :D)

But it doesn't work. Please help, what I must write in Action ID. Or give me an other script ... Please!

I need that!

It gives Rep++!!!
 
Lua:
function onStepIn(cid, item, position, fromPosition)
local townId = 2 -- your town id please.
	doPlayerSetTown(cid, townId)
	doPlayerSendTextMessage(cid, 22, "Welcome to the Mainland.") -- change the message if you want.
	return TRUE
end
In XML you can set the UniqueID or actionID.. Dont forget, you should put the position where it should teleports since this only adds the town id.
 
Mh it works, but can you make 2 in 1... so I mean one teleporter to town id 9 (that I have now) and another teleporter to town id 18..
So i mean a teleporter to mainland and one to rookgaard.
Hope u get it, what i want...

Thx in advanced.. after that I'll give you rep++...
 
Mh it works, but can you make 2 in 1... so I mean one teleporter to town id 9 (that I have now) and another teleporter to town id 18..
So i mean a teleporter to mainland and one to rookgaard.
Hope u get it, what i want...

Thx in advanced.. after that I'll give you rep++...

~Refresh~
 
Lua:
function onStepIn(cid, item, position, fromPosition)
local townId1 = 9 -- your town id please.
local townId2 = 18 -- your town id2 please.
if item.uid == 8898 then
        doPlayerSetTown(cid, townId1)
        doPlayerSendTextMessage(cid, 22, "Welcome to the "..getTownName(townId1).." City.") -- change the message if you want.
elseif item.uid == 8899 then
	doPlayerSetTown(cid, townId2)
	doPlayerSendTextMessage(cid, 22, "Welcome to the "..getTownName(townId2).." City.") -- change the message if you want.
		end
        return TRUE
end
In actions.xml put the id of the teleport.
itemid="1387".
 
And about citizen script included in TFS, and these magic numbers (30000+) :D

Its 30000 + town_id, so your 30020 will set player town to 20
 
And about citizen script included in TFS, and these magic numbers (30000+) :D

Its 30000 + town_id, so your 30020 will set player town to 20

Not exactly.. take a look again:
Lua:
function onStepIn (cid, item, position, fromPosition)
	if(item.actionid > 30020 and item.actionid < 30100) then
		doPlayerSetTown(cid, item.actionid - 30020)
	end
	return TRUE
end

Its 30020 + town_id, so your 30020 will set player town to 0
 
Lua:
function onStepIn(cid, item, position, fromPosition)
local townId1 = 9 -- your town id please.
local townId2 = 18 -- your town id2 please.
if item.uid == 8898 then
        doPlayerSetTown(cid, townId1)
        doPlayerSendTextMessage(cid, 22, "Welcome to the "..getTownName(townId1).." City.") -- change the message if you want.
elseif item.uid == 8899 then
	doPlayerSetTown(cid, townId2)
	doPlayerSendTextMessage(cid, 22, "Welcome to the "..getTownName(townId2).." City.") -- change the message if you want.
		end
        return TRUE
end
In actions.xml put the id of the teleport.
itemid="1387".
Mh it doesn't work... But i think I make what wrong.. XD
Code:
 if item.uid == 8898 then

elseif item.uid == 8899 then
Must there the action id 30039 and 30040 or what it is??

Can you say me what to add in actions.xml...
I use cryingdamson4pl2 0.3.4 Client:8.42 ^^
Pls! I give you now rep++ but please help me again :D I am too silly XD
 
an example for thais:
thais_citizen.lua
Code:
function onStepIn(cid, item, pos)

local thais = {x=32369, y=32241, z=7}

    if item.actionid == 30022 then
        doPlayerSetTown(cid,2) 
		doTeleportThing(cid,thais)
        doSendMagicEffect(getCreaturePosition(cid),12)
		doPlayerSendTextMessage(cid,22, "You are now a citzen of Thais")
        end
    return 1
end


Movements.xml
Code:
<movevent type="StepIn" actionid="30022" event="script" value="Thais_Citizen.lua" />
 
PHP:
function onStepIn(cid, item, pos)

local town = {x=32369, y=32241, z=7} -- Yours city position

    if item.actionid == 30022 then   -- Action id on the teleporter
        doPlayerSetTown(cid,CITY ID) -- Setup ur city id
		doTeleportThing(cid,town)
        doSendMagicEffect(getCreaturePosition(cid),12)
		doPlayerSendTextMessage(cid,22, "You are now a citzen of NAME OD THE CITY")
        end
    return 1
end
 
well if this help i had like a same porlbme but i putted a switch insted of a teleport well
here it is

function onUse(cid, item, frompos, item2, topos)
local townid = 1 -- townid of the temple
local playerpos = getPlayerPosition(cid)
local newpos = {x=435, y=483, z=7}
doPlayerSendTextMessage(cid,22,"You are now a citizen of the town Nova.")
doPlayerSetTown(cid, townid)
doTeleportThing(cid,newpos)
doSendMagicEffect(playerpos,12)
end

<action actionid="7659" script="nova.lua" />

well i putted it in a switch and it works fine for me
 
Back
Top