printz
CRAZY DUMB ZEALOT

Posts: 8152
Registered: 06-06 |
What you have there is a racing problem between a monster's unintended switching to its spawn state (due to SKULLFLY set internally by the PainAttack triggering the SkullAttack logic) and intended switching to its death state (due to MISSILE, set by you in the DEH).
However, I think I found the solution. Here's how it goes:
- Give the Lost Soul-projectile both spawn and see state. They can be the default ones.
- Give the Lost Soul its ranged attack state, which can also be the default one.
- The spawn state has Look codepointers, as usual, except that they lead into death (projectile fizzling frames). You can make the Look frames of 1 duration.
- The see state has Chase, as usual, but it also leads into death. You can also make the Chase frames of 1 duration.
- Set the Lost Soul's speed to 0.
- The important part: set Lost Soul's JUSTHIT flag.
- Set the FLOAT flag.
The effect: the monster will be created on its spawn state facing you, so it will automatically see you, immediately going into the see state. Thanks to the JUSTHIT flag, it will attack you as soon as it sees you, going into the stable attack mode and act like a typical charging Lost Soul. On impact, it will either die (due to being a MISSILE) or reset to spawn (due to SKULLFLY). If reset, it will see you again, but because the JUSTHIT flag only works once, it will NOT attack you instantly, so it will just have time to fizzle and disappear.
Even if they fail to trigger their see-state (player dead or no-alert area), they'll still be thrusted in the direction of the target and probably go a long way till they fizzle (something like 480 units).
The FLOAT bit is important, so the monster doesn't "teleport" to the ground when entering its chase frames. The speed is 0 so it doesn't creep around when in its chase frames.
Here's pastebin of the code. It doesn't seem to crash in vanilla:
http://pastebin.com/BYmNr7W9
Some drawbacks of this entire idea:
- Lost Souls are spawned at height 0 relative to the monster, which means that they'll be stopped by any solid decoration.
- They can hurt the same species as their parent.
- They won't cause any infighting (I wonder if they'll cause confusion instead)
- There's a slight homing behavior, because the see states may last longer than 1, during which they will adapt their aiming.
- A melee attack with these projectiles causes the damage to be inflicted twice, because there are two successive SkullAttacks: one at spawn-time, another at attack-time.
- Speed is fixed to 20.0
- Attack sound occurs twice.
- Death sound might occur twice.
- I don't know the Chase AI on its entirety, so I can't guarantee that it won't attack the second time instead of fizzling. But most of the time and during all the checks, it fizzled.
- The projectiles will be stopped by items!
Last edited by printz on 12-23-11 at 17:30
|