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

[HELP] Portal that change the Town

witze15

New Member
Joined
Mar 21, 2010
Messages
29
Reaction score
1
Hey Guys,

i hope i'm Right here.

I Just looking for a Script, that allows me to Change my Town-ID when i walk Through a Portal like in Real Tibia.

I feel Like Searched the Whole Internet, but nothing find anything like this..

And how can i change MySQL datas with Lua etc.?

i Hope you can Help me.

Thank you
Daniel
 
movement script
add action id to teleport
player:setTown(town) or doPlayerSetTown(cid, town) for older tfs
 
It's usually best to post in Support or Requests. :p

What your looking for is called a "Citizen Portal".

You most likely have one already installed in data/movements/scripts

In map editor put AID on tile Underneath your portal, and make portal teleport to the temple position for that town.

ActionID 30021 = town 1
ActionID 30022 = town 2
et cetera.

Code:
function onStepIn(cid, item, position, fromPosition)
    if item.actionid > 30020 and item.actionid < 30100 then
        local townId = (item.actionid - 30020)
        doPlayerSetTown(cid, townId)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are the newest resident of " .. getTownName(townId) .. ".")
    end
    return true
end

(sometimes you need to change the first line to item.aid .. depends on your tfs)
 
Thank You :D

But the TownID wouldn't Change in my Database..
When i Die i will come ever to Town 1..

I tested this two Options:
Setted the Portal ActionID to 30022
Setted the Ground Underneath the Portal to 30022
and Setted Both to 30022

And i Tested your Code, cause it looks Different than Mine ^^

This path i Changed:
Data/movements/scripts/citizen.lua

i Hope you can help me.

Is it Recommend which Bottem underneath the Portal is?

Thank you
Daniel
 
Depends how your movements.xml looks like.

Can you post your movements.xml line for the "citizen.lua"?
 
Alright, so this is using your standard "portal".

So in this case you should be placing the AID onto the portal, and set the portal co-ordinates for the temple of that city.

If it's working properly, it should display "You are the newest resident of Thais.", and teleport you to wherever you set.

Play around with it for awhile, and see if you can figure it out.

If you can't figure it out, I can teamviewer with you. (when I get home in 1h 20m)
 
nooow it works :D

yeah the problem was that i use the Portals 5023 and 5024 cause i don't find the 1387 xD

i have changed it and Now it work ^^

Thank you A lot :)
 
Back
Top