Cataclysm-BN
Cataclysm-BN copied to clipboard
Game crashes when attempting to use a spell with SWAP_POS that would kill the target
Describe the bug
When attempting to cast a spell that has the SWAP_POS flag, if the spell would kill the target monster it instead crashes the game.
Expected behavior: The game would not crash and the player would still get swapped with the monster. (Or, I suppose, its corpse)
Steps To Reproduce
- Learn/have a spell that has both the POS_SWAP flag and does damage to the targeted monster
- Attempt to use the spell on a monster that would die from the damage
- Watch the game crash (assuming the spell cast succeeds of course)
Screenshots
No response
Versions and configuration
- OS: Windows
- OS Version: 10.0.19045.3930 (22H2)
- Game Version: b625f1f [64-bit]
- Graphics Version: Tiles
- LAPI Version: 2
- Game Language: []
- Mods loaded: [ Bright Nights [bn], Disable NPC Needs [no_npc_food], Simplified Nutrition [novitamins], No Rail Stations [No_Rail_Stations], Prevent Zombie Revivication [no_reviving_zombies], Limit Fungal Growth [limit_fungal_growth], Magical Nights [MagicalNights] ]
Additional context
For ease of testing, have a spell file containing a spell fitting the descriptions. weapon_artes.json
Unfortunately, Catapult seems to not give me a crash.log file for some reason (alternatively, one just isn't generating for some reason unrelated). And the debug.log file isn't triggering due to the lack of any error messages prior to the crash.
have you tried changing the sequence in how the spells are casted?(as a quick fix). iirc the arcana mod has a spell like that but i havent tested it
This is all with a single spell. So no changing of any ordering is possible.
And yes, Arcana got around this bug cleverly by not damaging the direct target of the spell but rather using an effect in an AOE around your new location.
Hello. I ran into this problem while trying to add a SWAP_POS
spell too.
It happens because the spell effects (generic meaning, not the effect
field) apply before the flag, so when the target is killed by the spell it tries to apply the flag's effect, can't do it and crashes. Because the flag is specific to entities, no workaround is possible by adding ground
and none
as targets.
Ignaramico is right. The fix is to split the spell into two parts: main component with EXTRA_EFFECTS_FIRST
and then the SWAP_POS
subspell. This guarantees the target will be alive and swapped before applying the primary spell.