forgottenserver
forgottenserver copied to clipboard
Revscript MonsterType Spell Fixes
Pull Request Prelude
- [X] I have followed proper The Forgotten Server code styling.
- [X] I have read and understood the contribution guidelines before making this PR.
- [X] I am aware that this PR may be closed if the above-mentioned criteria are not fulfilled.
Protocol version Any
Changes Proposed
Spells aren't handled correctly in register_monster_type.lua, Not exactly sure if this is the fully correct way to handle these, but at least I am bringing the issue to everyones attention.
Issues addressed: Within revscript monstertype lua files, spells named "condition" wouldn't be registered and would cause errors. Spells named "drunk" would create condition twice, once at line 281 and again at line 331, which would cause all sorts of crashes. You can reproduce these errors by adding a monster lua file and adding these types of spells below.
{name ="condition", interval = 2000, chance = 30, type = CONDITION_POISON, startDamage = 0, tick = 4000, minDamage = -440, maxDamage = -520, radius = 5, target = false, effect = CONST_ME_POISONAREA}
{name ="drunk", interval = 2000, chance = 10, drunkenness = 25, duration = 5000, range = 7, shootEffect = CONST_ANI_ENERGY}
The easiest way is to convert the current monster xml files into revscript using this tool: https://otland.net/threads/ot-monster-converter.277546/
Note: You may need to create multiple files containing drunk spells in order to make the crash happen, not sure why though. Sometimes it crashes, sometimes it doesn't, the more files the easier it is to replicate.
great! I would like to hear @soul4soul input on this as well
https://github.com/otland/forgottenserver/blob/master/data/scripts/lib/register_monster_type.lua#L337-L354
{name ="condition", interval = x, chance = x, condition = { type = x , startDamage = x, minDamage = x, maxDamage = x, duration = x, interval = x}
https://github.com/otland/forgottenserver/blob/master/data/scripts/lib/register_monster_type.lua#L337-L354
{name ="condition", interval = x, chance = x, condition = { type = x , startDamage = x, minDamage = x, maxDamage = x, duration = x, interval = x}
Pretty sure you'll still get an error from here:
https://github.com/otland/forgottenserver/blob/b73ac8c77bd81471eef587f9d0e7c3b83256895c/data/scripts/lib/register_monster_type.lua#L281
I believe that section is more target to melee attacks that include a condition along with it. Like this:
{name ="melee", interval = 2000, chance = 100, minDamage = 0, maxDamage = -100, condition = {type = CONDITION_POISON, startDamage = 3, interval = 4000}},
https://github.com/otland/forgottenserver/pull/3499 Allow conditions to be used with all predefine creature abilities. Conditions can be used with "melee", "combat", "speed", "condition", "outfit", "invisible", "*field", etc.. Conditions won't work with named spells such as "energy strike".
#3499 Allow conditions to be used with all predefine creature abilities. Conditions can be used with "melee", "combat", "speed", "condition", "outfit", "invisible", "*field", etc.. Conditions won't work with named spells such as "energy strike".
Alright, great. I guess @soul4soul will have to check into adapting his system for this format. I reverted the changes for that part. However, the drunk spells are still an issue.
This could use a rebase and add back the outfits spells and it would be good to go.