Jump to content
Sign in to follow this  

Turning Lost Souls into projectiles with BEX (question)

Recommended Posts

The goal being to have an all new "projectile" for pain elementals (or anything using their attack action, I'm just sticking with PEs here).

This is what I have so far and it seems to work OK, save for the fact that the "projectile" doesn't disappear when hitting a wall or when something is too close to the PE, and just sits there. I tried to get around that by having the normal frames leading to the death sequence anyway, but obviously that means the projectile wouldn't travel for long - or I could use more/longer frames, but the projectile would then stand a longer time stuck in a wall.

I'm thinking it might not be that bad with the right graphic, but still, this is pretty hacky and messy. Is there any better way to get the whole thing done?

Share this post

Link to post

I haven't looked at it yet, but how about making the monster facetarget then attack when it spawns, and have the chase state lead to death?

also i forget how being fired from a PE affects lost souls so i'll have to check that too

Share this post

Link to post

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:


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!

Share this post

Link to post

A monster is never in an 'attack status'. All A_Chase does (other than move the monster) is randommly set a monster to enter the state listed as it's ranged attack state or melee state (obviously based off distance and existence).

Any state that contains A_Chase has a chance of setting a monster to one of the afore mentioned attack states (indeed putting A_Chase on either of the attack states can cause an infinite loop, I assume as the game doesn't know what to do if the RNG comes up make attack and the monster is already in one of the attack states).

Hope that makes sense.

Share this post

Link to post

I think you may extend this trick into MBF Dehacked by using the Spawn codepointer instead of PainAttack... but the problem with Spawn is that it creates an actor right inside the spawner and there's no collision check.

Share this post

Link to post

Pretty cool, printz. Most of the drawbacks you listed seem to be relatively easy to work around, save for the "blocked by items" which is a bit of a showstopper unfortunately.

Share this post

Link to post

Semi-noclip only makes actors pass stairs of any height (and in addition, prevents them from activating walk-over triggers). It doesn't make them pass through other solid actors or solid walls.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this