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

Action [TFS 1.X] Town Portals like in Diablo

oen432

Legendary OT User
Joined
Oct 3, 2014
Messages
1,917
Solutions
55
Reaction score
2,144
Location
Poland
GitHub
Oen44
Town Portals
More Diablo style additions. This time Town Portals. Scrolls that can be used to create a portal that will teleport us back to our town. If we use special portal in a town, we can get back to where we created our portal (which then will be removed). Can be customized to allow only portal creator to use it or anyone. Also when portal should be removed, when creator goes back or anyone goes back. Duration can be set too, after passed time, teleport will be removed.​


Installation

  1. Open data/movements/movements.xml.
  2. Add
    XML:
    <movevent event="StepIn" actionid="5623" script="town_portal.lua" />
    <movevent event="StepIn" actionid="5624" script="town_portal.lua" />
  3. Open data/creaturescripts/creaturescripts.xml.
  4. Add
    XML:
    <event type="logout" name="TownPortalsLogout" script="town_portal.lua" />
  5. Open data/actions/actions.xml
  6. Add
    XML:
    <action itemid="5952" script="custom/town_portal_scroll.lua" />
  7. Download town_portals.rar from attachment at the bottom of this post.
  8. Copy town_portal_scroll.lua to data/actions/scripts/custom/town_portal_scroll.lua.
  9. Copy town_portal.lua to data/creaturescripts/scripts/town_portal.lua.
  10. Copy town_portal.lua to data/movements/scripts/town_portal.lua.
Configuration
Create item using map editor and set Action ID 5623. This is your Town Portal tile where players can step on and teleport back to their created portal.
Save that item position in configuration table TOWN_PORTALS.
Every configuration is in - data/movements/scripts/town_portal.lua.

Lua:
TOWN_PORTALS = {
  creatorOnly = true, -- only portal creator can teleport back to town
  creatorDestroy = true, -- remove Town Portal only when creator teleports back, false = destroy portal when any player teleports back
  duration = -1, -- in seconds, for how long should created portal be active, -1 = unlimited
  townText = "Town Portal", -- Text on the portal in a town, nil = nothing
  portalText = nil, -- text on the portal create by a player, nil = Town Name
  townPortals = { -- list of Town Portals in towns that are used to teleport back to player portal
    Position(1000, 1000, 7)
  }
}

Changelog
[1.0.1] - 2019-03-26
  • Disabled using scroll if player is near city temple
  • Now after using scroll when portal is active, old portal is destroyed
[1.0.0] - 2019-03-25
  • Release version
 

Attachments

  • town_portals-1_0_1.rar
    2.9 KB · Views: 68 · VirusTotal
Last edited:
What happen to the portals in the city when multiple ppl use portal scroll?
 
Or u can make a default portal in city that checks if u have a portal active, and if you do ,it teleports you to your scroll location.
 
First post updated
[1.0.1] - 2019-03-26
  • Disabled using scroll if player is near city temple
  • Now after using scroll when portal is active, old portal is destroyed
 
Hi @oen432 is there any chance to dont allow to enter players who attacked other players (with white skull/ yellow skull), and players that has fighting condition? (those who are being attacked or are attacking a monster)...

Thanks in advance!
 
Hi @oen432 is there any chance to dont allow to enter players who attacked other players (with white skull/ yellow skull), and players that has fighting condition? (those who are being attacked or are attacking a monster)...

Thanks in advance!
Well, you can just add Protection Zone on the Waypoint tiles in map editor. For those who attacked/been attacked by a monster that would require editing the script itself.
 
Found a bug (or more like missed feature?)

If you put the scroll on the ground it becomes infinite. I just added a failsafe with player:getItemcount()
 
Found a bug (or more like missed feature?)

If you put the scroll on the ground it becomes infinite. I just added a failsafe with player:getItemcount()
Change player:removeItem(item:getId(), 1) to item:remove(1).
 
Back
Top