• 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] Shrines

oen432

Legendary OT User
Joined
Oct 3, 2014
Messages
1,900
Solutions
55
Reaction score
2,121
Location
Poland
GitHub
Oen44
Shrines
Shrines are new objects that can be added on the map. After activation, shrine becomes inactive and can change type upon reactivation.​

Power Shrine
  • 30% chance to spawn
  • 25% damage bonus
  • 30 seconds duration
Protection Shrine
  • 15% chance to spawn
  • 25% damage reduction
  • 15 seconds duration
Recovery Shrine
  • 5% chance to spawn
  • 10% of Max HP & MP every second
  • 20 seconds duration
Wisdom Shrine
  • 20% chance to spawn
  • 25% bonus experience
  • 20 seconds duration

Installation

  1. Open data/actions/actions.xml.
  2. Add
    XML:
    <action itemid="7823" script="custom/shrine.lua" />
  3. Open data/creaturescripts/creaturescripts.xml.
  4. Add
    XML:
    <event type="login" name="ShrinesLogin" script="shrines.lua" />
    <event type="logout" name="ShrinesLogout" script="shrines.lua" />
    <event type="kill" name="ShrinesKill" script="shrines.lua" />
    <event type="death" name="ShrinesDeath" script="shrines.lua" />
    <event type="healthchange" name="ShrinesHealth" script="shrines.lua" />
  5. Open data/events/events.xml
  6. Find <event class="Creature" method="onTargetCombat" enabled="0" /> and change enabled="0" to enabled="1"
  7. Open data/events/scripts/creature.lua
  8. Find function Creature:onTargetCombat(target) and add there target:registerEvent("ShrinesHealth")
  9. Open data/globalevents/globalevents.xml.
  10. Add (60000 = 1 minute)
    XML:
    <globalevent name="ShrineSpawn" interval="60000" script="shrine_spawner.lua"/>
  11. Open data/globalevents/scripts/startup.lua.
  12. At the end of the function onStartup (before last end) add this ShrinesLoad().
  13. Open data/lib/core/position.lua.
  14. Add
    Lua:
    function Position.sendAnimatedText(self, message)
        local specs = Game.getSpectators(self, false, true, 9, 9, 8, 8)
        if #specs > 0 then
            for i = 1, #specs do
                local player = specs[i]
                player:say(message, TALKTYPE_MONSTER_SAY, false, player, self)
            end
        end
    end
  15. Download shrines.rar from attachment at the bottom of this post.
  16. Copy shrine.lua to data/actions/scripts/custom/shrine.lua.
  17. Copy shrines.lua to data/creaturescripts/scripts/shrines.lua.
  18. Copy shrine_spawner.lua to data/globalevents/scripts/shrine_spawner.lua.
Configuration
Every configuration is inside data/actions/scripts/custom/shrine.lua.
SHRINES_STORAGE_BASE - this is base storage that Shrines are using, leave it or change if in use.
SHRINES_ITEM_ID - this is item / tile id used as a Shrine, see video example above to see which is used (Obsidian Statue, 7823).
SHRINES_CONFIG - here you can add, remove and adjust shrines.
[1234], [1235], [1236], [1237] - these are Action Ids used by shrines, they are used by script to check shrine type and set bonuses.
effect - shrine indicator, displayed on the shrine and on the player if shrine effect is active.
storage - this is needed to set which effect is player affected by. It's based on SHRINES_STORAGE_BASE and increased for every next shrine type.
spawnChance - chance in % to spawn this particular shrine type by shrine_spawner.lua.
duration - how long will shrine effect be active when player uses it.
bonus - value in % that affects bonuses.
text - text that will appear on the shrine if active.
message - text that will appear when shrine is activated by the player.
SHRINES_DATA - here you add positions of every shrine that you added in the map editor. 4 examples are added, follow them to see how to add more.
!!Remember to change Action Ids in ShrinesPlayerEffect, Shrines_onHealthChange, Shrines_onKill and onUse if you change them in SHRINES_CONFIG!!

Changelog
[1.0.3] - 2019-03-22
  • Fixed HealthChange event for Power Shrine
  • Corrected installation instructions (forgot about events.xml)
[1.0.2] - 2019-03-20
  • Removed unnecessary code
[1.0.1] - 2019-03-14
  • Fixed onLogin causing error
  • Added version print
  • Renamed Damage Shrine to Power Shrine
[1.0.0] - 2019-03-12
  • Release version
 

Attachments

Last edited by a moderator:
i think is still the same, im checking step by step and all are correct.
 
Fast update, very important
[1.0.3] - 2019-03-22
  • Fixed HealthChange event for Power Shrine
  • Corrected installation instructions (forgot about events.xml)
 

Attachments

Incredible code, thanks for sharing!

@edit
I have a little suggestion. You could add shrine item ID transformation on use, so it would look different when the shrine is active and inactive.
 
Last edited:
Not working mate, the shrine don't work anymore
 
The shrine does not work at all now ^^
No way. Check at the bottom of the map if there is any message when you click on them.
And make sure you set positions properly in SHRINES_DATA.
They are working, tested.
 
Sorry my fault, forgot to change position for the shrines_data xD
 
Back
Top