oen432
Legendary OT User
Shrines
Shrines are new objects that can be added on the map. After activation, shrine becomes inactive and can change type upon reactivation.
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
- 15% chance to spawn
- 25% damage reduction
- 15 seconds duration
- 5% chance to spawn
- 10% of Max HP & MP every second
- 20 seconds duration
- 20% chance to spawn
- 25% bonus experience
- 20 seconds duration
Installation
- Open
data/actions/actions.xml
. - Add
XML:
<action itemid="7823" script="custom/shrine.lua" />
- Open
data/creaturescripts/creaturescripts.xml
. - 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" />
- Open
data/events/events.xml
- Find
<event class="Creature" method="onTargetCombat" enabled="0" />
and changeenabled="0"
toenabled="1"
- Open
data/events/scripts/creature.lua
- Find
function Creature:onTargetCombat(target)
and add theretarget:registerEvent("ShrinesHealth")
- Open
data/globalevents/globalevents.xml
. - Add (60000 = 1 minute)
XML:
<globalevent name="ShrineSpawn" interval="60000" script="shrine_spawner.lua"/>
- Open
data/globalevents/scripts/startup.lua
. - At the end of the function
onStartup
(before lastend
) add thisShrinesLoad()
. - Open
data/lib/core/position.lua
. - 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
- Download
shrines.rar
from attachment at the bottom of this post. - Copy
shrine.lua
todata/actions/scripts/custom/shrine.lua
. - Copy
shrines.lua
todata/creaturescripts/scripts/shrines.lua
. - Copy
shrine_spawner.lua
todata/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)
- Removed unnecessary code
- Fixed
onLogin
causing error - Added version print
- Renamed Damage Shrine to Power Shrine
- Release version
Attachments
-
shrines-1_0_3.rar2.8 KB · Views: 102 · VirusTotal
Last edited by a moderator: