Bug damage all enemies

dantedevil

Well-known member
These days I find testing my mod before launching the new demo.
Normally always I am testing alone, but this time I'm playing with my daughter Carolina.
Then I found a curious bug with the script "damage all enemies".
Here the script:
Code:
void damage_all_enemies(int damage, int drop, int stay, void atk_type)
{
 	int  iEntity;
        void vEntity;
        void self        = getlocalvar("self");
        int  iMax        = openborvariant("ent_max"); 
    int Def;
               
        for(iEntity=0; iEntity<iMax; iEntity++)
        {       
        vEntity = getentity(iEntity);
        Def = getentityproperty(vEntity, "defense", openborconstant("ATK_NORMAL4"));
		if(getentityproperty(vEntity, "type")==openborconstant("TYPE_enemy") && Def != 0)
		{		
		damageentity(vEntity,self,damage,drop,openborconstant(atk_type));
		changeentityproperty(vEntity, "staydown", "riseattack", stay);	
		}
	}	
}

The bug only occurs when more than one player playing.

1- When an enemy grab a player with a script slam
2- The other player make the attack "damage all enemies"
3- The "damage all enemies"  hit the enemy before finish the script slam over the other player.
4- The enemy fall but the player get stuck with the enemy.

So to solve this the enemies need immunity to "damage all enemies" during all the script slam or throw movements.
Maybe the script need an update , the best is add an exception to avoid damage enemies during a script slam.
 
Hmm... that bug, It could be solved by excluding enemies playing grabbed animation

Code:
void damage_all_enemies(int damage, int drop, int stay, void atk_type)
{
 	int  iEntity;
        void vEntity;
        void self        = getlocalvar("self");
        int  iMax        = openborvariant("ent_max");
    int Def;
               
        for(iEntity=0; iEntity<iMax; iEntity++)
        {       
        vEntity = getentity(iEntity);
        Def = getentityproperty(vEntity, "defense", openborconstant("ATK_NORMAL4"));
	void EAnim = getentityproperty(vEntity, "animationID");

		if(getentityproperty(vEntity, "type")==openborconstant("TYPE_enemy") && Def != 0 && EAnim != openborconstant("ANI_FALL7"))
		{		
		damageentity(vEntity,self,damage,drop,openborconstant(atk_type));
		changeentityproperty(vEntity, "staydown", "riseattack", stay);	
		}
	}	
}

This updated code will exclude enemies in FALL7 animation aka grabbed animation
 
Mmmm... I do not think that works, because enemies they are not playing FALL7, the other player is playing FALL7.

Here an example:
1 - Dominatrix grab player 1 with this throw:
Code:
anim follow1
	loop	0
	offset	82 177
	bbox	 0 0 0 0
	delay      1
        attackone 1
        @cmd    stop
	frame	data/chars/dominatrix/grab.png
	delay   30
        @cmd    slamstart2
        @cmd    position 8 50 0 1 0
	frame	data/chars/dominatrix/grab.png
	delay   18
        @cmd    antiwall -55 25 -1
        @cmd    position 0 25 15 -1 0
	frame	data/chars/dominatrix/throw01.png
	delay   12
        sound   data/chars/dominatrix/at4.wav
        @cmd    position 7 0 45 1 1
	frame	data/chars/dominatrix/throw02.png
        delay   4
        @cmd    antiwall -55 30 -1
        @cmd    position 10 -50 10 -1 1
	frame	data/chars/dominatrix/throw03.png
        delay   1
        @cmd    depost 0
        @cmd    throw 15 4 -1.5 1.5 0 0 
	frame	data/chars/dominatrix/throw03.png
	delay   25
	frame	data/chars/dominatrix/throw03.png
	delay   12
	frame	data/chars/dominatrix/throw04.png
2 - Before the throw end, the player 2 perform the attack "damage all enemies"
3- "damage all enemies" hit the dominatrix before the throw end
4 - The dominatrix fall and then player 1 get stuck with Dominatrix

Your update will exclude enemies in FALL7 animation, but enemies They are not in FALL7, players are.


EDIT: You were right friend. Discovered a new bug.

The error also happens in reverse.
If player 1 make an slam script over one enemy, and the player 2 make an attack "damage all enemies" before player 1 end the script slam, the enmy get suck with player 1.

So you solve one of the bugs, thanks.

Only one left...
 
Oh I don't know that you use different FALL animations for enemies and players
I can update the script to exclude other FALL animation as well but before I do that, which FALL animation enemies are using?

Also can you ensure that player isn't using enemy's FALL animation used for grabbed and vice versa?
 
Not my friend,  the players and the enemies have the same FALL7 for the script slams.
But you say your updated script can make immune the two entities in the example?
The Dominatrix (playing follow1) and the player1 (platying FALL7).
 
Well my friend,  finally can find a way to solve this.
Using you method to disable immunity.
http://www.chronocrash.com/forum/index.php?topic=2692.msg36531#msg36531
In this animation I turn ON the immunity in the first frame, and disable the immunity when realease the player:

Code:
anim follow1
@script
    if(frame==@script
    if(frame==0){ 
      void self = getlocalvar("self");
      changeentityproperty(self, "defense", openborconstant("ATK_NORMAL4"), 0);
    }
@end_script
	loop 	0
	offset	82 177
	bbox	 0 0 0 0
	delay      1
        attackone 1
        @cmd    stop
	frame	data/chars/dominatrix/grab.png
	delay   30
        @cmd    slamstart2
        @cmd    position 8 50 0 1 0
	frame	data/chars/dominatrix/grab.png
	delay   18
        @cmd    antiwall -55 25 -1
        @cmd    position 0 25 15 -1 0
	frame	data/chars/dominatrix/throw01.png
	delay   12
        sound   data/chars/dominatrix/at4.wav
        @cmd    position 7 0 45 1 1
	frame	data/chars/dominatrix/throw02.png
        delay   4
        @cmd    antiwall -55 30 -1
        @cmd    position 10 -50 10 -1 1
	frame	data/chars/dominatrix/throw03.png
        delay   1
        @cmd    depost 0
        @cmd    throw 15 4 -1.5 1.5 0 0 
	frame	data/chars/dominatrix/throw03.png
	delay   25
@script
    if(frame==7){ // 
      void self = getlocalvar("self");
      changeentityproperty(self, "defense", openborconstant("ATK_NORMAL4"), 1);
   }
@end_script
    	frame	data/chars/dominatrix/throw03.png
	delay   12
	frame	data/chars/dominatrix/throw04.png

So with this,  I need updated all the enemies slams moves, with this immunity.  It's a tedious method, but works properly.
Please let me know if you find a better way to fix this.
Thanks!
 
Hmmm... I misunderstood

Anyways, that temporary immunity works to protect enemies from damage all enemies attack. However, there is another method which is to set script in enemy's reaction animation OR with takedamagescript to release grabbed player (if there were any)
The latter works great if you allow opponents to attack grabbing/slamming character. If you don't allow it, then the former is best way :)
 
Back
Top Bottom