Help throw sewer

kmilloz

Member
Hi, can anyone give me idea? I'm trying to do an animation for my mod, I hit the cap, but to achieve it, it appears on the chars, before returning to the enemy ... I tried using idle anim and death ... Thanks.
 
O Ilusionista said:
I don't get. What are you trying to do?
put, in quote, in portuguese too, so I can understand it better.

Quero fazer aquele movimento de bater na tampa do bueiro quando o inimigo arremessa, para que ela volte e acerte o próprio inimigo... Tentei fazer usando a animação "death", mas logo que acerto a tampa com a espada, ela aparece no alto do player e depois começa a animação death, que fiz para voltar em direção ao oponente...

1ª figura: O inimigo arremessa a tampa;
2ª figura: Leo atinge a tampa;
3ª figura: A tampa aparece no alto, é como se ela estivesse caindo, tipo chars que não tem anim spawn e aparece caindo na tela...
4ª figura: Em seguida começa a mostrar o anim death, seguindo em direção do inimigo com o comando move -xxx....

não entendi porque a tampa aparece no alto, caindo na tela para depois mostrar a animação death...
Obrigado pelo interesse!


I want to make that move to beat in the manhole cover when the enemy throws for her to come back and hit the enemy itself ... I tried using the animation "death", but as soon as the cap hit with the sword, she appears at the top the player then begins a death animation I made to return towards the opponent ...

1st figure: The enemy throws the lid;
2nd figure: Leo hits the cover;
3rd picture: The cover appears high, it is as if she were falling, chars kind that has no anim spawn and falling appears on the screen ...
4th picture: Then begins to show the death anim, heading toward the enemy with the command moves -xxx ....

not understand why appears the lid on top, falling on the screen to show after the death animation ...
 
did you set falldie?

Code:
falldie {value} or death {value}

~Determines how DEATH animation will be played when the character dies.
0 = fall, blink on ground then disappear without playing DEATH at all (default).
1 = No FALL animation, DEATH animation will be played right after final blow
2 = Fall first then play DEATH animation.
~MAKE SURE that the character have DEATH animation when using this!
 
BeasTie said:
did you set falldie?

Code:
falldie {value} or death {value}

~Determines how DEATH animation will be played when the character dies.
0 = fall, blink on ground then disappear without playing DEATH at all (default).
1 = No FALL animation, DEATH animation will be played right after final blow
2 = Fall first then play DEATH animation.
~MAKE SURE that the character have DEATH animation when using this!

yes! I try for all...

Sim! tentei com todas as opções...
Coloquei até ani fall, mas não adiantou...

name bueiro
type    none
health  5
gfxshadow 1
speed  10
remove 0
falldie 1
nodieblink 2

noatflash  1
flash fflash

anim death
offset 3 15
delay 40
frame data/chars/foot/vazio.gif
offset -21 48
move -10
frame data/chars/armas/bueiro.gif
delay 1
frame data/chars/armas/bueiro.gif
frame data/chars/armas/bueiro.gif
frame data/chars/armas/bueiro.gif
frame data/chars/armas/bueiro.gif
frame data/chars/armas/bueiro.gif

anim idle
loop 1
bbox 1 1 31 16
delay 100
offset -22 -27
frame data/chars/armas/bueiro.gif

Tentei até como "enemy" se eu colocar um frame "vazio" com delay de 40, no inicio do anim death, ele esconde a queda da tampa, mas o tempo de espera é muito grande...
 
try this:
counterframe {frame} {cond} {damaged}

~Animation header. If all conditions are met, entity will perform animation set by followanim. This command is outdated and only included for backward compatibility. Use Counterrange instead.
~This command is to make entity performs FOLLOW{#} if the entity is hit in set frame.
~frame determines at which frame if entity is hit , FOLLOW{#} would be played.
~cond determines the condition requirements before FOLLOW{#} is played.
1: The counter will always be used.
2: The counter will be used as long as the attacker was an enemy (Or a player if an enemy uses it).
3: The counter will be used as long as the attacker was an enemy, the attack was not unblockable, hits the user from the front, and was not a FREEZE attack.
~damaged determines whether the entity will receive damage from the hit or not.
0, the damage won't be taken
1, the damage will be taken
~Which FOLLOW animation played is determined by 'followanim'.

-----------------------------------------------

counterrange {start} {end} {condition} {damage}

~Animation header. Replaces Counterframe and works identically except where noted.
~{start} Start of frame range when counter may trigger.
~{end} End of frame range when counter may trigger.

Use counterrange instead. Put this at the anim where the lid "attacks"
 
O Ilusionista said:
try this:
counterframe {frame} {cond} {damaged}

~Animation header. If all conditions are met, entity will perform animation set by followanim. This command is outdated and only included for backward compatibility. Use Counterrange instead.
~This command is to make entity performs FOLLOW{#} if the entity is hit in set frame.
~frame determines at which frame if entity is hit , FOLLOW{#} would be played.
~cond determines the condition requirements before FOLLOW{#} is played.
1: The counter will always be used.
2: The counter will be used as long as the attacker was an enemy (Or a player if an enemy uses it).
3: The counter will be used as long as the attacker was an enemy, the attack was not unblockable, hits the user from the front, and was not a FREEZE attack.
~damaged determines whether the entity will receive damage from the hit or not.
0, the damage won't be taken
1, the damage will be taken
~Which FOLLOW animation played is determined by 'followanim'.

-----------------------------------------------

counterrange {start} {end} {condition} {damage}

~Animation header. Replaces Counterframe and works identically except where noted.
~{start} Start of frame range when counter may trigger.
~{end} End of frame range when counter may trigger.

Use counterrange instead. Put this at the anim where the lid "attacks"
D'ont works...
a tampa aparece no alto do players e continua a trajetória, não volta para o inimigo, mesmo colocando move -
Você conhece algum mod que tem este movimento? Onde um inimigo joga algo no players e ele rebate? Obrigado!
 
Here my manhole cover entity. enjoy!
Code:
name	manhole_cover
type	obstacle
health	9999
speed 15
#diesound data/sounds/break02.wav
nolife 1
noatflash 1
#flash cflash
noquake 1
falldie 2
nodieblink 0
offscreenkill 50
#remove 1
gfxshadow 1

#antigravity 1
subject_to_platform 0
subject_to_obstacle 0
subject_to_wall 0
subject_to_hole 0
subject_to_gravity 0
no_adjust_base 1

candamage npc obstacle

load cflash_fake
load dflash_fake

takedamagescript	@script

#import "data/scripts/lib.c"
#import "data/scripts/wall_splat.c"
#import "data/scripts/platform_splat.c"

void main() {
  void self = getlocalvar("self");
  void attacker = getlocalvar("attacker");
  void damage = getlocalvar("damage");
  void parent = getentityproperty(self, "parent");
  float x = getentityproperty(self,"x");
  float z = getentityproperty(self,"z");
  float a = getentityproperty(self,"y");
  float base = getentityproperty(self,"base");
  int dir = getentityproperty(self,"direction");
  int health = getentityproperty(self,"health");
  int maxhealth = getentityproperty(self, "maxhealth");
  int anim_id = getentityproperty(self,"animationid");
  int otype = getentityproperty(attacker,"type");
  void oparent = getentityproperty(attacker,"parent");
  float ox = getentityproperty(attacker, "x");
  float oz = getentityproperty(attacker, "z");
  float oa = getentityproperty(attacker, "y");
  float obase = getentityproperty(attacker, "base");
  float xdir = abs(getentityvar(self,3));

  // ---------- CHECK SE L'ARMA HA LO STESSO PARENT ------------
  if ( getentityproperty(oparent,"exists") && getentityproperty(parent,"exists") ) {
  	if ( oparent == parent ) {
		changeentityproperty(self,"opponent",NULL());
		return;
	}
  }
  // ---------- CHECK SE L'ARMA HA LO STESSO PARENT ------------

  // ---------- ANTI SPECIAL OBJECTS -----------
  if ( self != attacker && otype != openborconstant("TYPE_PLAYER") && otype != openborconstant("TYPE_ENEMY") ) {
	changeentityproperty(self,"opponent",NULL()); // IMPORTANTE ANTI-BUGS
	return;
  }
  // ---------- ANTI SPECIAL OBJECTS -----------	

  // ########### PARTE DEL PLAYER (da togliere per l'enemy) ############
  // ---------- IL PROIETTILE ORA COLPISCE ANCHE I NEMICI ----------
  if ( parent != NULL() && attacker != NULL() ) {
	int pcandamage = getentityproperty(parent,"candamage");
	int candamage = getentityproperty(self,"candamage");
        int type_player = openborconstant("TYPE_PLAYER");
        int type_enemy = openborconstant("TYPE_ENEMY");
	int type_of_ent = getentityproperty(parent,"type");
	int otype_of_ent = getentityproperty(attacker,"type");

	//drawstring( 10,100,0,"flag_byte: "+candamage+" flag_value: "+type_player+" == "+is_flag_on(candamage,type_player));

	if ( otype_of_ent == type_player ) {
		if ( !is_flag_on(candamage,type_enemy)  ) {
			changeentityproperty(self,"candamage",candamage+type_enemy);
		}
	}
  }
  // ########### PARTE DEL PLAYER (da togliere per l'enemy) ############

  // ---------- MORTE O RILANCIO ----------
  if ( attacker != self ) {
	playsample(loadsample("data/sounds/hydrant2.wav"));
	if ( ox <= x ) {
		changeentityproperty(self,"direction",1);
		changeentityproperty(self,"parent",NULL());
	} else {
		xdir = -1*xdir;
		changeentityproperty(self,"direction",0);
		changeentityproperty(self,"parent",NULL());
	}
	changeentityproperty(self,"velocity",xdir,NULL(),NULL());
  }
  // ---------- MORTE O RILANCIO ----------

  if ( !getentityproperty(self,"aiflag","dead") && health > 0 ) changeentityproperty(self,"health",maxhealth);

}
@end_script

didhitscript	@script

#import "data/scripts/lib.c"

void main() {
  void self = getlocalvar("self");
  void parent = getentityproperty(self, "parent");
  void opp = getentityproperty(self, "opponent");
  float a = getentityproperty(self,"y");
  int health = getentityproperty(self,"health");
  int game_speed = openborvariant("game_speed");
  int damage = 10;

  // ---------- TYPE_ENT DAMAGE ------------
  if ( getentityproperty(parent,"exists") ) {
	if ( getentityproperty(parent,"type") == openborconstant("TYPE_PLAYER") ) damage *= 1.75;
  }
  // ---------- TYPE_ENT DAMAGE ------------

  // ---------- CHECK KUNAI ------------
  if ( getentityproperty(opp,"exists") ) {
  	void oparent = getentityproperty(opp,"parent");
	if ( getentityproperty(oparent,"exists") && getentityproperty(parent,"exists") ) {
  		if ( oparent == parent ) { 
			changeentityproperty(self,"opponent",NULL()); // IMPORTANTE ANTI-BUGS
			return;
		}
	}
  }
  // ---------- CHECK KUNAI ------------

  // ------------- PARATI SOLO DALL'ATTACCO NORMALE -----------
  /*if ( getentityproperty(opp,"aiflag","blocking") ) { // && oa <= obase 
	if ( getentityproperty(opp,"flash","block") ) show_block_flash(opp);
	changeentityproperty(opp,"aiflag","blocking",1);
	changeentityproperty(opp,"takeaction","common_block",1);
	opp = NULL();
  }*/

  // ---------- UCCIDI SU COLPO ----------
  if (parent != NULL() && opp != NULL()) {
	changeentityproperty(parent, "opponent", opp);

	if ( opp == parent ) {
		changeentityproperty(self,"opponent",NULL());
		return; // escludiamo chi ha scoccato la freccia per il noreflect
	}

	// ########### PARTE DEL PLAYER (da togliere per l'enemy) ############
	// Danneggia l'avversario per il noreflect
	if ( getentityproperty(opp,"exists") ) {
		int ohealth = getentityproperty(opp,"health");

		if ( ohealth-damage > 0 ) damageentity(opp,parent,damage,1,openborconstant("ATK_NORMAL"));
		else damageentity(opp,parent,damage,1,openborconstant("ATK_NORMAL"));
    		changeentityproperty(self, "invincible", 1);
    		changeentityproperty(self, "invinctime", openborvariant("elapsed_time")+get_next_time(game_speed*0.5));
		if ( !getentityproperty(opp,"flash","noattack") ) show_flash(opp);
		playsample(loadsample("data/sounds/punch004.wav"));
	}
	// ########### PARTE DEL PLAYER (da togliere per l'enemy) ############
  } else if ( parent == NULL() && opp != NULL() ) {
	// ########### PARTE DEL PLAYER (da togliere per l'enemy) ############
	// Danneggia l'avversario per il noreflect
	if ( getentityproperty(opp,"exists") ) {
		int ohealth = getentityproperty(opp,"health");

		if ( ohealth-damage > 0 ) damageentity(opp,self,damage,1,openborconstant("ATK_NORMAL"));
		else damageentity(opp,self,damage,1,openborconstant("ATK_NORMAL"));
    		changeentityproperty(self, "invincible", 1);
    		changeentityproperty(self, "invinctime", openborvariant("elapsed_time")+get_next_time(game_speed*0.5));
		if ( !getentityproperty(opp,"flash","noattack") ) show_flash(opp);
		playsample(loadsample("data/sounds/punch004.wav"));
	}
	// ########### PARTE DEL PLAYER (da togliere per l'enemy) ############
  }

  if ( getentityvar(self,2) != NULL() ) changeentityproperty(self,"direction",getentityvar(self,2));
  changeentityproperty(self,"no_adjust_base",1);
  changeentityproperty(self,"subject_to_gravity",0);
  changeentityproperty(self,"position",NULL(),NULL(),a);
  changeentityproperty(self,"base",a);
}

void show_flash(void opp) {
  if (opp != NULL()) {
	void flash;

	flash = spawnsubentity("cflash_fake",openborvariant("lasthitx"),openborvariant("lasthitz")+1,openborvariant("lasthita"));
  }
}

void show_block_flash(void opp) {
  if (opp != NULL()) {
	void flash;

	flash = spawnsubentity("dflash_fake",openborvariant("lasthitx"),openborvariant("lasthitz")+1,openborvariant("lasthita"));
  }
}
@end_script

ondrawscript	@script

#import "data/scripts/lib.c"
#import "data/scripts/wall_splat.c"
#import "data/scripts/platform_splat.c"

#define MAX_ALTITUDE 5000

void main() {
  void self = getlocalvar("self");
  void parent = getentityproperty(self, "parent");
  float x = getentityproperty(self,"x");
  float z = getentityproperty(self,"z");
  float a = getentityproperty(self,"y");
  float base = getentityproperty(self,"base");
  int dir = getentityproperty(self,"direction");
  int health = getentityproperty(self,"health");

  //drawstring(10,100,0,"health: "+health);

  // Ricorda cha no_adjust_base on non farà mai che la a <= base!!
  if ( health > 0 && !getentityproperty(self,"aiflag","dead") ) {
	setentityvar(self,2,dir); // conserva la direzione
	setentityvar(self,3,getentityproperty(self,"xdir")); // conserva la velocità iniziale
  }


  // ########### PARTE DEL PLAYER (da togliere per l'enemy) ############
  // ---------- RENDI IL PROIETTILE ADATTO AI PLAYERS SE POSSONO COLPIRSI ----------
  if ( parent != NULL() ) {
	int pcandamage = getentityproperty(parent,"candamage");
	int candamage = getentityproperty(self,"candamage");
        int type_player = openborconstant("TYPE_PLAYER");
        int type_enemy = openborconstant("TYPE_ENEMY");
	int type_of_ent = getentityproperty(parent,"type");

	//drawstring( 10,100,0,"flag_byte: "+candamage+" flag_value: "+type_player+" == "+is_flag_on(candamage,type_player));

	if ( type_of_ent == type_player ) {
		if ( is_flag_on(pcandamage,type_player) && !is_flag_on(candamage,type_player)  ) {
			changeentityproperty(self,"candamage",candamage+type_player);
		}
		if ( !is_flag_on(candamage,type_enemy)  ) {
			changeentityproperty(self,"candamage",candamage+type_enemy);
		}
	} else if ( type_of_ent == type_enemy ) {
		if ( !is_flag_on(candamage,type_player)  ) {
			changeentityproperty(self,"candamage",candamage+type_player);
		}
	}
  } else if ( !is_flag_on(getentityproperty(self,"candamage"),openborconstant("TYPE_PLAYER")) ) changeentityproperty(self,"candamage",getentityproperty(self,"candamage")+openborconstant("TYPE_PLAYER"));
  // ########### PARTE DEL PLAYER (da togliere per l'enemy) ############

}
@end_script

anim	IDLE
	loop	1
	#hitflash cflash
	#hitfx   data/sounds/knifes.wav
	fastattack 1

		bbox  -3  -2  37  26
	delay	3
	offset	16 20
		noreflect 1
		attack  0  2  32  18  0  1  0  0  0  10
	frame	data/chars/foot/weapons/bonus/manhole/y8a.gif
 
White Dragon said:
Here my manhole cover entity. enjoy!
Code:
name	manhole_cover
type	obstacle
health	9999
speed 15
#diesound data/sounds/break02.wav
nolife 1
noatflash 1
#flash cflash
noquake 1
falldie 2
nodieblink 0
offscreenkill 50
#remove 1
gfxshadow 1

#antigravity 1
subject_to_platform 0
subject_to_obstacle 0
subject_to_wall 0
subject_to_hole 0
subject_to_gravity 0
no_adjust_base 1

candamage npc obstacle

load cflash_fake
load dflash_fake

takedamagescript	@script

#import "data/scripts/lib.c"
#import "data/scripts/wall_splat.c"
#import "data/scripts/platform_splat.c"

void main() {
  void self = getlocalvar("self");
  void attacker = getlocalvar("attacker");
  void damage = getlocalvar("damage");
  void parent = getentityproperty(self, "parent");
  float x = getentityproperty(self,"x");
  float z = getentityproperty(self,"z");
  float a = getentityproperty(self,"y");
  float base = getentityproperty(self,"base");
  int dir = getentityproperty(self,"direction");
  int health = getentityproperty(self,"health");
  int maxhealth = getentityproperty(self, "maxhealth");
  int anim_id = getentityproperty(self,"animationid");
  int otype = getentityproperty(attacker,"type");
  void oparent = getentityproperty(attacker,"parent");
  float ox = getentityproperty(attacker, "x");
  float oz = getentityproperty(attacker, "z");
  float oa = getentityproperty(attacker, "y");
  float obase = getentityproperty(attacker, "base");
  float xdir = abs(getentityvar(self,3));

  // ---------- CHECK SE L'ARMA HA LO STESSO PARENT ------------
  if ( getentityproperty(oparent,"exists") && getentityproperty(parent,"exists") ) {
  	if ( oparent == parent ) {
		changeentityproperty(self,"opponent",NULL());
		return;
	}
  }
  // ---------- CHECK SE L'ARMA HA LO STESSO PARENT ------------

  // ---------- ANTI SPECIAL OBJECTS -----------
  if ( self != attacker && otype != openborconstant("TYPE_PLAYER") && otype != openborconstant("TYPE_ENEMY") ) {
	changeentityproperty(self,"opponent",NULL()); // IMPORTANTE ANTI-BUGS
	return;
  }
  // ---------- ANTI SPECIAL OBJECTS -----------	

  // ########### PARTE DEL PLAYER (da togliere per l'enemy) ############
  // ---------- IL PROIETTILE ORA COLPISCE ANCHE I NEMICI ----------
  if ( parent != NULL() && attacker != NULL() ) {
	int pcandamage = getentityproperty(parent,"candamage");
	int candamage = getentityproperty(self,"candamage");
        int type_player = openborconstant("TYPE_PLAYER");
        int type_enemy = openborconstant("TYPE_ENEMY");
	int type_of_ent = getentityproperty(parent,"type");
	int otype_of_ent = getentityproperty(attacker,"type");

	//drawstring( 10,100,0,"flag_byte: "+candamage+" flag_value: "+type_player+" == "+is_flag_on(candamage,type_player));

	if ( otype_of_ent == type_player ) {
		if ( !is_flag_on(candamage,type_enemy)  ) {
			changeentityproperty(self,"candamage",candamage+type_enemy);
		}
	}
  }
  // ########### PARTE DEL PLAYER (da togliere per l'enemy) ############

  // ---------- MORTE O RILANCIO ----------
  if ( attacker != self ) {
	playsample(loadsample("data/sounds/hydrant2.wav"));
	if ( ox <= x ) {
		changeentityproperty(self,"direction",1);
		changeentityproperty(self,"parent",NULL());
	} else {
		xdir = -1*xdir;
		changeentityproperty(self,"direction",0);
		changeentityproperty(self,"parent",NULL());
	}
	changeentityproperty(self,"velocity",xdir,NULL(),NULL());
  }
  // ---------- MORTE O RILANCIO ----------

  if ( !getentityproperty(self,"aiflag","dead") && health > 0 ) changeentityproperty(self,"health",maxhealth);

}
@end_script

didhitscript	@script

#import "data/scripts/lib.c"

void main() {
  void self = getlocalvar("self");
  void parent = getentityproperty(self, "parent");
  void opp = getentityproperty(self, "opponent");
  float a = getentityproperty(self,"y");
  int health = getentityproperty(self,"health");
  int game_speed = openborvariant("game_speed");
  int damage = 10;

  // ---------- TYPE_ENT DAMAGE ------------
  if ( getentityproperty(parent,"exists") ) {
	if ( getentityproperty(parent,"type") == openborconstant("TYPE_PLAYER") ) damage *= 1.75;
  }
  // ---------- TYPE_ENT DAMAGE ------------

  // ---------- CHECK KUNAI ------------
  if ( getentityproperty(opp,"exists") ) {
  	void oparent = getentityproperty(opp,"parent");
	if ( getentityproperty(oparent,"exists") && getentityproperty(parent,"exists") ) {
  		if ( oparent == parent ) { 
			changeentityproperty(self,"opponent",NULL()); // IMPORTANTE ANTI-BUGS
			return;
		}
	}
  }
  // ---------- CHECK KUNAI ------------

  // ------------- PARATI SOLO DALL'ATTACCO NORMALE -----------
  /*if ( getentityproperty(opp,"aiflag","blocking") ) { // && oa <= obase 
	if ( getentityproperty(opp,"flash","block") ) show_block_flash(opp);
	changeentityproperty(opp,"aiflag","blocking",1);
	changeentityproperty(opp,"takeaction","common_block",1);
	opp = NULL();
  }*/

  // ---------- UCCIDI SU COLPO ----------
  if (parent != NULL() && opp != NULL()) {
	changeentityproperty(parent, "opponent", opp);

	if ( opp == parent ) {
		changeentityproperty(self,"opponent",NULL());
		return; // escludiamo chi ha scoccato la freccia per il noreflect
	}

	// ########### PARTE DEL PLAYER (da togliere per l'enemy) ############
	// Danneggia l'avversario per il noreflect
	if ( getentityproperty(opp,"exists") ) {
		int ohealth = getentityproperty(opp,"health");

		if ( ohealth-damage > 0 ) damageentity(opp,parent,damage,1,openborconstant("ATK_NORMAL"));
		else damageentity(opp,parent,damage,1,openborconstant("ATK_NORMAL"));
    		changeentityproperty(self, "invincible", 1);
    		changeentityproperty(self, "invinctime", openborvariant("elapsed_time")+get_next_time(game_speed*0.5));
		if ( !getentityproperty(opp,"flash","noattack") ) show_flash(opp);
		playsample(loadsample("data/sounds/punch004.wav"));
	}
	// ########### PARTE DEL PLAYER (da togliere per l'enemy) ############
  } else if ( parent == NULL() && opp != NULL() ) {
	// ########### PARTE DEL PLAYER (da togliere per l'enemy) ############
	// Danneggia l'avversario per il noreflect
	if ( getentityproperty(opp,"exists") ) {
		int ohealth = getentityproperty(opp,"health");

		if ( ohealth-damage > 0 ) damageentity(opp,self,damage,1,openborconstant("ATK_NORMAL"));
		else damageentity(opp,self,damage,1,openborconstant("ATK_NORMAL"));
    		changeentityproperty(self, "invincible", 1);
    		changeentityproperty(self, "invinctime", openborvariant("elapsed_time")+get_next_time(game_speed*0.5));
		if ( !getentityproperty(opp,"flash","noattack") ) show_flash(opp);
		playsample(loadsample("data/sounds/punch004.wav"));
	}
	// ########### PARTE DEL PLAYER (da togliere per l'enemy) ############
  }

  if ( getentityvar(self,2) != NULL() ) changeentityproperty(self,"direction",getentityvar(self,2));
  changeentityproperty(self,"no_adjust_base",1);
  changeentityproperty(self,"subject_to_gravity",0);
  changeentityproperty(self,"position",NULL(),NULL(),a);
  changeentityproperty(self,"base",a);
}

void show_flash(void opp) {
  if (opp != NULL()) {
	void flash;

	flash = spawnsubentity("cflash_fake",openborvariant("lasthitx"),openborvariant("lasthitz")+1,openborvariant("lasthita"));
  }
}

void show_block_flash(void opp) {
  if (opp != NULL()) {
	void flash;

	flash = spawnsubentity("dflash_fake",openborvariant("lasthitx"),openborvariant("lasthitz")+1,openborvariant("lasthita"));
  }
}
@end_script

ondrawscript	@script

#import "data/scripts/lib.c"
#import "data/scripts/wall_splat.c"
#import "data/scripts/platform_splat.c"

#define MAX_ALTITUDE 5000

void main() {
  void self = getlocalvar("self");
  void parent = getentityproperty(self, "parent");
  float x = getentityproperty(self,"x");
  float z = getentityproperty(self,"z");
  float a = getentityproperty(self,"y");
  float base = getentityproperty(self,"base");
  int dir = getentityproperty(self,"direction");
  int health = getentityproperty(self,"health");

  //drawstring(10,100,0,"health: "+health);

  // Ricorda cha no_adjust_base on non farà mai che la a <= base!!
  if ( health > 0 && !getentityproperty(self,"aiflag","dead") ) {
	setentityvar(self,2,dir); // conserva la direzione
	setentityvar(self,3,getentityproperty(self,"xdir")); // conserva la velocità iniziale
  }


  // ########### PARTE DEL PLAYER (da togliere per l'enemy) ############
  // ---------- RENDI IL PROIETTILE ADATTO AI PLAYERS SE POSSONO COLPIRSI ----------
  if ( parent != NULL() ) {
	int pcandamage = getentityproperty(parent,"candamage");
	int candamage = getentityproperty(self,"candamage");
        int type_player = openborconstant("TYPE_PLAYER");
        int type_enemy = openborconstant("TYPE_ENEMY");
	int type_of_ent = getentityproperty(parent,"type");

	//drawstring( 10,100,0,"flag_byte: "+candamage+" flag_value: "+type_player+" == "+is_flag_on(candamage,type_player));

	if ( type_of_ent == type_player ) {
		if ( is_flag_on(pcandamage,type_player) && !is_flag_on(candamage,type_player)  ) {
			changeentityproperty(self,"candamage",candamage+type_player);
		}
		if ( !is_flag_on(candamage,type_enemy)  ) {
			changeentityproperty(self,"candamage",candamage+type_enemy);
		}
	} else if ( type_of_ent == type_enemy ) {
		if ( !is_flag_on(candamage,type_player)  ) {
			changeentityproperty(self,"candamage",candamage+type_player);
		}
	}
  } else if ( !is_flag_on(getentityproperty(self,"candamage"),openborconstant("TYPE_PLAYER")) ) changeentityproperty(self,"candamage",getentityproperty(self,"candamage")+openborconstant("TYPE_PLAYER"));
  // ########### PARTE DEL PLAYER (da togliere per l'enemy) ############

}
@end_script

anim	IDLE
	loop	1
	#hitflash cflash
	#hitfx   data/sounds/knifes.wav
	fastattack 1

		bbox  -3  -2  37  26
	delay	3
	offset	16 20
		noreflect 1
		attack  0  2  32  18  0  1  0  0  0  10
	frame	data/chars/foot/weapons/bonus/manhole/y8a.gif

thanks!
 
you can archive the same effect without scripts, just use counterrange.
just remember to put the right offsets.

counterrange {start} {end} {condition} {damage}

~Animation header. Replaces Counterframe and works identically except where noted.
~{start} Start of frame range when counter may trigger.
~{end} End of frame range when counter may trigger.

read counterframe to understand the other options:
counterframe {frame} {cond} {damaged}

~Animation header. If all conditions are met, entity will perform animation set by followanim. This command is outdated and only included for backward compatibility. Use Counterrange instead.
~This command is to make entity performs FOLLOW{#} if the entity is hit in set frame.
~frame determines at which frame if entity is hit , FOLLOW{#} would be played.
~cond determines the condition requirements before FOLLOW{#} is played.
1: The counter will always be used.
2: The counter will be used as long as the attacker was an enemy (Or a player if an enemy uses it).
3: The counter will be used as long as the attacker was an enemy, the attack was not unblockable, hits the user from the front, and was not a FREEZE attack.
~damaged determines whether the entity will receive damage from the hit or not.
0, the damage won't be taken
1, the damage will be taken
~Which FOLLOW animation played is determined by 'followanim'.
 
Back
Top Bottom