Solved: spawn issue

msmalik681

OpenBOR Developer
Staff member
I made a new stage and whenever I spawn a entity they fall from the sky but I cant figure out why can anyone help ?
 
msmalik681 said:
how would I use this ?

You really shouldn't - it's an outdated model attribute that was put in before the SPAWN animation was available. Here's a quick rundown of spawn behavior, in order of highest to lowest priority:

[list type=decimal]
[*]Has SPAWN or RESPAWN - Appears at base height playing the respective animation.
[*]No SPAWN or RESPAWN:
[list type=decimal]
[*]Model is Arrow subtype, Boomerang subtype, has nodropspawn 1 attribute, or level is vertically scrolling - Appears at base height.
[*]X position is 30 or more pixels outside of viewing area - Appears at base height.
[*]Default - Drops from sky (Y position is adjusted randomly from 0 to 40 pixels above screen top) playing JUMP animation if available, and IDLE otherwise.
[/list]

[/list]

For any interested, here's a look under the engine's hood:

Code:
        if(validanim(e, ANI_SPAWN) || validanim(e, ANI_RESPAWN))
        {
            e->takeaction = common_spawn;
        }
        else
        {
            dodrop = (e->modeldata.subtype != SUBTYPE_ARROW && e->modeldata.subtype != SUBTYPE_BOOMERANG && level && (level->scrolldir == SCROLL_UP || level->scrolldir == SCROLL_DOWN));

            if(!nodropspawn && (dodrop || (e->position.x > advancex - 30 && e->position.x < advancex + videomodes.hRes + 30 && e->position.y == 0)) )
            {
                e->position.y += videomodes.vRes + randf(40);
            }
            if(inair(e))
            {
                e->takeaction = common_drop;
                if(validanim(e, ANI_JUMP))
                {
                    ent_set_anim(e, ANI_JUMP, 0);
                }
            }
        }
 
This is something we modders should have as a option to disable.  Thanks for the insight DC.

I fixed my problem then broke it again lol.  So your spawn animation has to have a valid offset or they will still fall from the sky.
 
msmalik681 said:
This is something we modders should have as a option to disable.

The SPAWN animation IS how you disable default spawning behavior. Even if you don't want a true spawn animation, you could just make a single frame, delay 1 SPAWN identical to IDLE and there you go. Assuming it's valid, heh. Beyond that, you can use script to set up any funky spawning paradigm imaginable.

DC
 
Let me bump this topic with some info: as DC said, you should not use "nodropspawn" at all.
I tried it to make solve the spawn animations of all my enemies, but then the engine will force any enemy to be standing as they spawn and this can be a mess - remember custom spawn animations? They won't work anymore.

I followed DC's advice and made a spawn animation with just one frame and dealy 1 and that is it.
 
Back
Top Bottom