oen432
Legendary OT User
Cursed Chests
Cursed Chests are a new treasure type chests that are spawned randomly on the map. They can't be just opened like any other, first, player will have to defend against waves of powerful monsters. After surviving and killing every spawned monster, chest will open with rewards inside.
Cursed Chests are a new treasure type chests that are spawned randomly on the map. They can't be just opened like any other, first, player will have to defend against waves of powerful monsters. After surviving and killing every spawned monster, chest will open with rewards inside.
Installation
- Open
data/actions/actions.xml
. - Add
XML:
<action actionid="9000" script="custom/cursed_chest.lua" />
- Open
data/creaturescripts/creaturescripts.xml
. - Add
XML:
<event type="death" name="CursedChestsDeath" script="cursed_chests.lua" />
- Open
data/globalevents/globalevents.xml
. - Add (300000 = 5 minutes, spawn new chest every 5 minutes)
XML:
<globalevent name="CursedChestSpawner" interval="300000" script="cursed_chest_spawner.lua"/>
- Open
data/events/events.xml
. - Enable
onMoveItem
, setenabled="1"
hereXML:<event class="Player" method="onMoveItem" enabled="1" />
- Open
data/events/scripts/player.lua
. - Find function
Player:onMoveItem
and add as first line in that functionLua:if item:getActionId() == CURSED_CHESTS_AID then return false end
- Open
data/globalevents/scripts/startup.lua
. - At the end of the function
onStartup
(before lastend
) add thisCursedChestsLoad()
. - Open
data/lib/core/position.lua
. - Add if you don't have this function
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
cursed_chests.rar
from attachment at the bottom of this post. - Copy
cursed_chest.lua
todata/actions/scripts/custom/cursed_chest.lua
. - Copy
cursed_chests.lua
todata/creaturescripts/scripts/cursed_chests.lua
. - Copy
cursed_chest_spawner.lua
todata/globalevents/scripts/cursed_chest_spawner.lua
.
Configuration
Basic chests configuration - data/actions/scripts/custom/cursed_chest.lua
.Here you can set chance to spawn given tier and text to be shown on spawned chest.
Change
item
to ids of your chests if you want different chest look for each tier.
Lua:
CURSED_CHESTS_TIERS = {
{
tier = CURSED_CHESTS_TIER_COMMON,
chance = 70,
text = "Common Cursed Chest",
item = 1750
},
{
tier = CURSED_CHESTS_TIER_RARE,
chance = 50,
text = "Rare Cursed Chest",
item = 1750
},
{
tier = CURSED_CHESTS_TIER_EPIC,
chance = 30,
text = "Epic Cursed Chest",
item = 1750
},
{
tier = CURSED_CHESTS_TIER_LEGENDARY,
chance = 10,
text = "Legendary Cursed Chest",
item = 1750
}
}
CURSED_CHESTS_SKULL_DEFAULT
- skull type to set to wave monsters.CURSED_CHESTS_SKULL_BOSS
- skull type to set to boss monster.CURSED_CHESTS_CONFIG
- here you can add, remove and adjust chests.[1], [2]
- these are Chests IDs, make sure they are unique to each other.message
- text to show when player activates the chest.rewards
- list of items that can be added to the chest after every monster dies.chance
- value in % indicates chance for that item to be added. If set to 100, then will be added only ONCEitem
- ID of the itemamount
- how many items to addrandom
- set to true
if you want to randomize amount of that item (from 1 to amount set)waves
- list of monsters that are randomly chosen to spawn"Monster Name"
- name of the monster to spawnboss
- optional if you want to spawn Boss at the endname
- name of the monster to be Boss.fightDuration
- in seconds, if this time passes and boss is alive, chest and boss will be removed from the map, player failed.message
- text to show on the player when boss is about to be spawnedChests spawn configuration -
data/globalevents/scripts/cursed_chest_spawner.lua
.CURSED_CHESTS_AID
- action id set to the chest, change if already in use, change in actions.xml
too.CURSED_CHESTS_SPAWNS
- list of centers of the spawn area where chests can appear.[1]
- Spawn ID, make sure they are unique to each other.pos
- Center of the spawn area.size
- Size of the spawn area.chests
- list of Chests IDs that can be spawned in that area, eg. { 1, 2, 6, 10 }
.Changelog
[1.1.1] - 2019-03-28- Fixed spawning monsters and chests in PZ
- Rewritten basic functionality
- Chest and monsters won't spawn in PZ anymore
- Removed level requirements to open chest
- Added chest tiers
- Changed monster spawning, amount of monsters depends on a wave number and tier of the chest
- Monsters are spawned randomly from a list
- If player is not in a party and activates the chest, only he is able to open that chest
- If player is in a party and activates the chest, only he and party members are able to open that chest
- If chest is not emptied and 5 minutes passes, it is removed from the map
- Added poff effect when chest is removed
- New configuration fields
- New wave - Boss - starts after all waves are cleared (optional)
- Added skulls to spawned monster (white for default, black for boss), to show which monster is from the chest
- New configuration fields
- Removed unnecessary code
- Release version
Attachments
-
cursed_chests-1_1_1.rar4.4 KB · Views: 338 · VirusTotal
Last edited by a moderator: