Sign in to follow this  
Followers 0

setthingspecial to projectile

If I spawn an imp and setthingspecial to it, that special function will execute when the imp dies.
But I want to do it to a projectile like a cacodemonball. Apparently a cacodemonball doesn't "die" (even though it has 1000 health... it has a death state so I don't get it) or execute a set special after it hits a wall (only want to use acs/not decorate preferably).

I want lots of projectiles, and when each "dies" (or whatever), I want to delete a point associated with the projectile (or just execute my own script). I think I can do acs_execute always and have a while(1) constantly checking the "health" of the projectile.. I guess eventually when it "dies", that tid won't exist anymore, so the getactorproperty(tid) will fail and just return 0, so at that point I at least know the projectile died. Seems like lots of unnecessary while loops per projectile when it can just execute code once only when it "dies".

Or something.

And how to give a tid to, say, each rocket the player shoots? Can't use acs only for that maybe?


EDIT:
this works good enough (spawns cacoball and prints its tid when it hits a wall):

#include "zcommon.acs"

script 1 open
{
    spawnspot("cacodemonball", 1, 3, 128);
    acs_executealways(2,0,3);
    thrustthing(128, 6, 0, 3);
}

script 2 (int tid)
{
    while(1)
    {
        if(getactorproperty(tid, aprop_health) == 0)
        {
            print(d:tid);
            break;
        }
        delay(1);
    }
}

Share this post


Link to post

When a missile explodes, it isn't "killed", even if it goes to its death state. Dying and exploding are different functions, which do different things, despite having in common that they put the actor in its death state.

You might try to toy a bit with the activation property.

Another thing you can do to force a missile to execute its special when it explodes is this:

Death:
    BOOM A 0 A_CallSpecial(special, args[0], args[1], args[2], args[3], args[4])
    <rest of death state goes here>

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  
Followers 0