Rise dizzy settings (various)

NED

Well-known member
In my project, enemies randomly go to a dizzy anim from rise anim.
The code is OK, but there is few settings I want to edit.

during this particular dizzy anim, there is a display of a dizzy effect (stars + loop sound.
How can I make this effect (sprite and sound) disapear if enemy is hit during this dispaly?

this is the rise to dizzy code:
Code:
anim	rise
	loop	0
	offset	96 177
	bbox	0 0 0 0
	delay	15#11
      @script
    void self = getlocalvar("self");
    if( frame == 0){
      int r = rand()%30;
      if( r >= 9){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
      }
    }
   @end_script  



	frame	data/chars/mex/rise1.gif
	delay	18
	frame	data/chars/mex/rise2.gif
	delay	18
	frame	data/chars/mex/rise3.gif

anim	follow1# dizzy anim - randomly from rise
   	offset   96 177
	bbox	67 58 61 122

	subentity	stun0001
#	#spawnframe {frame} {x} {z} {a} {relative} # position est par rapport a l'offset du perso
	spawnframe	1 0 2 90 0#1 0 0 0 0
#	summonframe	1 0 2 90 0#1 0 0 0 0
#        unsummonframe   4

  	 delay   20#30#100#15
   	frame   data/chars/mex/pain2.gif
  	delay   25#40
  	frame   data/chars/mex/pain1.gif
  	 delay   30
   	frame   data/chars/mex/pain2.gif
  	delay   25
  	frame   data/chars/mex/pain1.gif
  	delay   60
  	frame   data/chars/mex/pain2.gif

How can I fix it?
Thanks
 
Thanks,
I tried to apply it using the existing values I used before, but it displays nothing?

Code:
bindentity stun0001 mex 0 2 90 1 0#(stun0001, mex, x, z, a, direction, bindanim);

Is there something wrong?
Do you have an exemple of ho you apply it?
 
Did you 'load' the entity first?


EDIT:

I have a different script I use.

@cmd spawnbind "Entity" 0 0 0

Code:
void spawnbind(void Name, float dx, float dy, float dz)
{ // Spawn and bind other entity
   void self = getlocalvar("self");
   void Spawn;

   Spawn = spawn01(Name, dx, dy, 0);
   bindentity(Spawn, self, dx, dz, dy, 0, 0);
}

The entity just has lifespan set and no loop.
 
I used this:
Code:
		@script
		if(frame==0)
		{
    void self = getlocalvar("self");
    void e;
    clearspawnentry();
    setspawnentry("name", "burnP");
    e = spawn();
    bindentity(e, self,0,1,0,1,1);
		}
	@end_script

But Beastie's code could be better.

bindentity isn't avaliable in any material, everything I know about it comes from the source code. Maybe utunnels can explain it better.

 
Not sure about better regarding this situation, but it's a handy script.

I think I made a mistake thou, I think it also needs this other script spawn01 to function. 
Sorry to be unclear about this.

Code:
void spawn01(void vName, float fX, float fY, float fZ)
{
	//spawn01 (Generic spawner)
	//Damon Vaughn Caskey
	//07/06/2007
	//
	//Spawns entity next to caller.
	//
	//vName: Model name of entity to be spawned in.
	//fX: X location adjustment.
	//fZ: Y location adjustment.
      //fY: Z location adjustment.

	void self = getlocalvar("self"); //Get calling entity.
	void vSpawn; //Spawn object.
	int  iDirection = getentityproperty(self, "direction");

	clearspawnentry(); //Clear current spawn entry.
      setspawnentry("name", vName); //Acquire spawn entity by name.

	if (iDirection == 0){ //Is entity facing left?                  
          fX = -fX; //Reverse X direction to match facing.
	}

      fX = fX + getentityproperty(self, "x"); //Get X location and add adjustment.
      fY = fY + getentityproperty(self, "a"); //Get Y location and add adjustment.
      fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.
	
	vSpawn = spawn(); //Spawn in entity.

	changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
	changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
    
	return vSpawn; //Return spawn.
}

void spawnbind(void Name, float dx, float dy, float dz)
{ // Spawn and bind other entity
   void self = getlocalvar("self");
   void Spawn;

   Spawn = spawn01(Name, dx, dy, 0);
   bindentity(Spawn, self, dx, dz, dy, 0, 0);
}

 
bindentity(entity, target, int x, int z, int a, int direction, int bindanimation)
~Bind entity to target, so the target moves, the entity moves.
~x, z, a: relative to target.
~direction: 0 no change 1 same direction as target -1 opposite direction as target 2 always right -2 always left
~bindanimation: 0 No effect. 1 Keep same animation as the target. 2 Also keep same frame as the target. 4 Kill the entity if the animation doesn't match.
~To unbind a entity, use bindentity(entity, NULL());
~Notice: You can combine those values for bindanimation, so it can be 6 which means 2 and 4.

so, you should use 4 at the last value, so the stars are killed if the parent have a different animation.

Code:
bindentity stun0001 mex 0 2 90 1 4

I just don't understand if this check the current parent animation and kill the entity if its different automatically or if you can set a specific animation number. Maybe the first option is right.
 
I tested again your choice Ilu, the entity is already loaded in the header of "mex" enemy. But the effect still don't display.

Beastie I'll try to apply your scripts too, now.
 
I tested again your choice Ilu, the entity is already loaded in the header of "mex" enemy. But the effect still don't display.

Last time I saw this, it was a bug on NSW25's mod. On his game, the code doesn't works AT ALL, dunno why. Try to test the code with a clean OpenBOR mod (the original one) to see if it works.
 
Back
Top Bottom