spawn at death animation

Die_In_Fire

Well-known member
Basically I want an entity to be spawned when an enemy dies, before blinking.

this is the enemy txt
Code:
nodieblink	1
anim death
	loop       0
	spawnframe 2 0 244 1 1
	subentity texto1d
	offset     36 81
	 delay      50
         frame      data/chars/abobo/13.png
	 frame      data/chars/abobo/13.png
	 frame      data/chars/abobo/13.png

the entity I want to spawn is "load"ed on models.txt
:-X
 
so you mean something like this?

Code:
anim death
	@script
    void parent = getlocalvar("self");
    int frame = getlocalvar("frame");
    
    if ( frame == 1 ) { // <------ TO CHANGE
        void subent;
        float x, z, a, base;
        char ent = "texto1d"; // <------ TO CHANGE
        float rx = 0, rz = 0, ra = 0;  // <------ TO CHANGE // shift relative to parent

          clearspawnentry();
          setspawnentry("name", ent);
          subent = spawn();

          if ( getentityproperty(parent,"exists") ) {
              int p_dir = getentityproperty(parent,"direction");

              if (!p_dir) rx *= -1;
              changeentityproperty(subent, "parent", parent);
              x = getentityproperty(parent, "x");
              z = getentityproperty(parent, "z");
              a = getentityproperty(parent, "a");
              base = getentityproperty(parent, "base");
              changeentityproperty(subent, "direction", p_dir);
          } else {
              x = 0;
              z = 0;
              a = 0;
          }

          if ( ra != NULL() ) {
            changeentityproperty(subent, "position", x+rx, z+rz, a+ra);
            changeentityproperty(subent, "base", a+ra);
          } else {
            changeentityproperty(subent, "position", x+rx, z+rz, base);
            changeentityproperty(subent, "base", base);
          }

        return subent;
    }
@end_script
	loop       0
	offset     36 81
	 delay      50
         frame      data/chars/abobo/13.png
	 frame      data/chars/abobo/13.png
	 frame      data/chars/abobo/13.png
	delay      10
	 frame      data/chars/abobo/empty.png	
	 frame      data/chars/abobo/13.png
	 frame      data/chars/abobo/empty.png
         @cmd     suicide
	 frame      data/chars/abobo/13.png

and with O' script:
Code:
anim death
	loop       0
	offset     36 81
	 delay      50
         frame      data/chars/abobo/13.png
	 frame      data/chars/abobo/13.png
	@cmd   spawn000 "texto1d" 0 20 0
	 frame      data/chars/abobo/13.png
	delay      10
	 frame      data/chars/abobo/empty.png	
	 frame      data/chars/abobo/13.png
	 frame      data/chars/abobo/empty.png     
         @cmd     suicide
	 frame      data/chars/abobo/13.png
 
just tried this:
Code:
anim death
	loop       0
	offset     36 81
	 delay      50
         frame      data/chars/abobo/13.png
	 frame      data/chars/abobo/13.png
	@cmd   spawn000 "texto1d" 0 20 0
	 frame      data/chars/abobo/13.png
	delay      10
	 frame      data/chars/abobo/empty.png	
	 frame      data/chars/abobo/13.png
	 frame      data/chars/abobo/empty.png
	@cmd   killentity getlocalvar("self")
	 frame      data/chars/abobo/13.png

still Aboghost is there  :(
 
Hi.  To avoid the ghost issue, open the texto1d.txt and add this condition "&& getentityproperty(ent, "health")>0 " on the int setidle_after_spawn(). So the code will be like this:

Code:
int setidle_after_spawn() {
		int i;

		for (i = 0; i < openborvariant("count_entities"); ++i) {
			void ent = getentity(i);

			if ( getentityproperty(ent, "exists") ) {
				if ( getentityproperty(ent, "type") == openborconstant("TYPE_ENEMY") && getentityproperty(ent, "health")>0 ) {
					int anim_id = getentityproperty(ent, "animationid");

					if ( anim_id != openborconstant("ANI_SPAWN") && anim_id != openborconstant("ANI_RESPAWN") && anim_id != openborconstant

("ANI_IDLE") )	changeentityproperty(ent, "animation", openborconstant("ANI_IDLE"));
						
						
		}
		
			} // fine if exists
		} // fine for
	}

 
[off topic] That script you made is awesome, White Dragon! Thank you very much! I was using openbor 3849 (it is very stable with my MOD) but I recently changed to 3965 just to be able to use your script.
 
lagarto said:
[off topic] That script you made is awesome, White Dragon! Thank you very much! I was using openbor 3849 (it is very stable with my MOD) but I recently changed to 3965 just to be able to use your script.

Thank you legarto!! =)
Ps. WARNING: Death check is in setidle_after_spawn(), ondestroy() and main() of onspawnscript too
 
moito obrigado!! gratzie!! thanks guys

I love how is looking now. And works with both spawn scripts!

(need the smile with the beer, how I miss that icon!!)


[attachment deleted by admin]
 
Back
Top Bottom