iggy11
New member
White Dragon said:Teenage Mutant Ninja Turtles: Shell Shocked --> Update [REV5761]
Thanks White Dragon ! ! !
White Dragon said:Teenage Mutant Ninja Turtles: Shell Shocked --> Update [REV5761]
BeasTie said:Nice work WD.
@ O - nah it doesn't pull them in it spins them away from you
O Ilusionista said:And the code check the target distance and adapt the animation, right?
no, its not my point (WD got it already). What I mean is: if the move hits the enemy that is near, you will see less pieces of the "chain". If the enemy is far away, you will see more pieces. IOW it will put more or less pieces dinamically. Or, you use the anipos trick stored on a variable@ O - nah it doesn't pull them in it spins them away from you
O Ilusionista said:no, its not my point (WD got it already). What I mean is: if the move hits the enemy that is near, you will see less pieces of the "chain". If the enemy is far away, you will see more pieces. IOW it will put more or less pieces dinamically. Or, you use the anipos trick stored on a variable@ O - nah it doesn't pull them in it spins them away from you
wow, maybe using the anipos trick could be lighter.only the hook is about 600 code lines
#import "data/scripts/lib.c"
void main() {
void self = getlocalvar("self");
int drop = getlocalvar("drop");
int damage = getlocalvar("damage");
void parent = getentityproperty(self, "parent");
void opp = getentityproperty(self,"opponent");
int attacktype = getlocalvar("attacktype");
setentityvar(self,"opp",opp);
damage = getentityvar(self,"damage");
if ( damage != NULL() ) damage = getentityvar(self,"damage");
else damage = 10;
check_hit_type(self,parent,opp,attacktype,damage,drop);
//check_retire_hook(self); // on animationscript
//performattack(self,openborconstant("ANI_DIE"),1); // use this one instead retire_hook!
}
void generate_rope(void self, void opp, void parent) {
if ( getentityproperty(opp, "exists") && getentityproperty(parent, "exists") ) {
int opp_anim_id = getentityproperty(opp, "animationid");
int o_defaultmodel = getentityproperty(opp, "defaultmodel");
//int layer = getentityproperty(opp, "setlayer")-1; // in questo modo la corda apparirà sempre dietro il player!!
float x = getentityproperty(parent, "x");
float z = getentityproperty(parent, "z");
float a = getentityproperty(parent, "y");
float base = getentityproperty(parent, "base");
float x_distance = 0;
float ox = getentityproperty(opp, "x");
float oz = getentityproperty(opp, "z");
float oa = getentityproperty(opp, "y");
float obase = getentityproperty(opp, "base");
int i, rope_width = 16, pg_width = 40;
float x_shift = 84;
if ( ox < x ) x_distance = x-ox;
else x_distance = ox-x;
// Ora sappiamo che la distanza è di ox-x e sappiamo anche la larghezza della corda e del personaggio.
if ( x_distance >= pg_width ) x_distance = (x_distance-pg_width)/rope_width; // dividiamo per la larghezza della rope
else x_distance = x_distance/rope_width;
x_distance -= 2;
// Se il player sta più in su del nemico allora facciamo in modo che comunque la corda stia dietro il player!!
// Infatti prima sistemiamo la z del rodney ed in base a questa quella dell'opp
check_safe_pos(parent,0,1);
x = getentityproperty(parent, "x");
z = getentityproperty(parent, "z");
a = getentityproperty(parent, "y");
base = getentityproperty(parent, "base");
for ( i = 0; i < x_distance; ++i ) {
if ( getentityvar(self,"rope_"+i) == NULL() ) {
void ent;
clearspawnentry();
setspawnentry("name", "turtle_rope_part");
ent = spawn();
changeentityproperty(opp, "position", ox, z+1, oa); // il +1 lo facciamo per le z con la virgola!
if ( getentityproperty(parent, "direction") == 0 ) {
changeentityproperty(ent, "position", x-x_shift-(rope_width*i), z, a+0);
setentityvar(ent,"weap_shiftx",0-x_shift-(rope_width*i));
setentityvar(ent,"weap_shifta",0);
} else {
changeentityproperty(ent, "position", x+x_shift+(rope_width*i), z, a+0);
setentityvar(ent,"weap_shiftx",0+x_shift+(rope_width*i));
setentityvar(ent,"weap_shifta",0);
}
changeentityproperty(ent, "base", a+0);
setentityvar(self,"rope_"+i, ent);
changeentityproperty(ent, "parent", parent); // così muore quando muore il padre (self)
if ( getentityproperty(self, "direction") == 1 ) changeentityproperty(ent, "direction", 1);
else changeentityproperty(ent, "direction", 0);
//changeentityproperty(ent, "setlayer", layer);
}
} // fine for
setentityvar(self,"rope_num", x_distance);
}
}
int rope_clear() { // resettiamo le variabili globali!!
if ( getlocalvar("rope_num") != NULL() && getlocalvar("rope_num") >= 0 ) {
int i;
for ( i = 0; i < getlocalvar("rope_num"); ++i ) {
void rope_part = getlocalvar("rope_"+i);
if ( rope_part != NULL() && getentityproperty(rope_part,"exists") ) {
killentity(rope_part);
setlocalvar("rope_"+i, NULL());
}
} // fine for
}
if ( getlocalvar("hook_color_map") != NULL() && getentityproperty(getlocalvar("hook_color_map"),"exists") ) {
bindentity(getlocalvar("hook_color_map"),NULL(),0,0,0,1,0);
killentity(getlocalvar("hook_color_map"));
setlocalvar("hook_color_map", NULL());
}
}
/*void check_retire_hook(void self) {
int anim_id = getentityproperty(self, "animationid");
//int anim_pos = getentityproperty(self, "animpos");
int next_frame = 0;
int hook_frame = getentityvar(self,0);
int health = getentityproperty(self,"health");
if ( hook_frame == NULL() ) return;
//if ( anim_id != openborconstant("ANI_DIE") ) return;
performattack(self,openborconstant("ANI_DIE"),1);
//damageentity(self,self,health,0,openborconstant("ATK_NORMAL"));
// 7 frames + 1 per idle 5+1 per death
// 3 -> 1, 2 -> 2, 1 -> 3, 0 -> 4 EX. 4-3=1,4-2=2 etc...
if ( hook_frame >= 4 ) next_frame = 0;
else next_frame = 4-hook_frame;
changeentityproperty(self,"animpos",next_frame);
}*/
void check_hit_type(void self, void parent, void opp, int attacktype, int damage, int drop) {
char o_model = getentityproperty(opp, "defaultmodel");
char cFind1 = "foot", cFind2 = "FOOT", cFind3 = "rock", cFind4 = "ROCK";
char substr1 = strinfirst(o_model, cFind1);
char substr2 = strinfirst(o_model, cFind2);
char substr3 = strinfirst(o_model, cFind3);
char substr4 = strinfirst(o_model, cFind4);
if ( attacktype == openborconstant("ATK_NORMAL62") && getentityproperty(opp,"animvalid",openborconstant("ANI_PAIN62")) ) {
if ( substr1 != -1 || substr2 != -1 || substr3 != -1 || substr4 != -1 ) {
check_hit_type_atk62(self,parent,opp,damage,drop);
} else check_hit_type_normal(self,parent,opp,damage,drop);
} else {
check_hit_type_normal(self,parent,opp,damage,drop);
}
}
void check_hit_type_atk62(void self, void parent, void opp, int damage, int drop) {
void ent;
// ---------- TYPE_ENT DAMAGE ------------
/*if ( getentityproperty(parent,"exists") ) {
if ( getentityproperty(parent,"type") == openborconstant("TYPE_PLAYER") ) damage *= 1.75;
}*/
// ---------- TYPE_ENT DAMAGE ------------
// ---------- UCCIDI SU COLPO ----------
if ( opp != NULL() ) {
float oa = getentityproperty(opp,"y");
float obase = getentityproperty(opp,"base");
char ATTACK_TYPE = "ATK_NORMAL62";
if ( parent == NULL() ) parent = self;
changeentityproperty(parent, "opponent", opp);
if ( opp == parent ) {
changeentityproperty(self,"opponent",NULL());
return; // escludiamo chi ha scoccato la freccia per il noreflect
}
// Danneggia l'avversario per il noreflect
if ( getentityproperty(opp,"exists") ) {
int ohealth = getentityproperty(opp,"health");
float oa = getentityproperty(opp,"y");
float obase = getentityproperty(opp,"base");
//if ( oa > obase ) drop = 1;
if ( oa > obase ) {
drop = 1;
ATTACK_TYPE = "ATK_NORMAL";
} else {
drop = 0;
damage = 0;
}
if ( ohealth-damage > 0 ) damageentity(opp,parent,damage,drop,openborconstant(ATTACK_TYPE));
else damageentity(opp,parent,damage,drop,openborconstant(ATTACK_TYPE));
if ( !getentityproperty(opp,"aiflag","blocking") ) {
if ( !getentityproperty(opp,"flash","noattack") ) {
if ( drop ) show_flash(); // Il flash è in mostra?? Se no allora eseguilo.
playsample(loadsample("data/sounds/punch004.wav"));
}
} else {
if ( getentityproperty(self,"flash","block") ) {
show_block_flash();
playsample(loadsample("data/sounds/punch003.wav"));
}
}
// ------------ MAIN ROPE CODE --------------
generate_rope(self,opp,getentityproperty(self,"parent"));
clearspawnentry();
setspawnentry("name", "turtle_hook_color_map");
ent = spawn();
if ( getentityproperty(ent,"exists") ) {
char o_model = getentityproperty(opp, "defaultmodel");
char cFind1 = "foot", cFind2 = "FOOT", cFind3 = "rock", cFind4 = "ROCK";
char substr1 = strinfirst(o_model, cFind1);
char substr2 = strinfirst(o_model, cFind2);
char substr3 = strinfirst(o_model, cFind3);
char substr4 = strinfirst(o_model, cFind4);
setentityvar(self,"hook_color_map", ent);
setentityvar(self,"ROPE_ATK",1);
if ( getentityproperty(parent,"exists") ) {
int map = getentityproperty(parent,"map");
int mapcount = getentityproperty(parent, "mapcount")-1;
// 3 sono le mappe da 0 a 3 del player e 4 sono le mappe della nuova ent
if ( map >= mapcount-3 && map <= mapcount ) changeentityproperty(ent, "map", map-(mapcount-4));
changeentityproperty(ent,"parent",parent);
}
if ( substr3 != -1 || substr4 != -1 ) bindentity(ent,opp,0,0,-1,1,0);
else bindentity(ent,opp,0,0,0,1,0);
}
performattack(self,openborconstant("ANI_FOLLOW50"),1);
//performattack(parent,openborconstant("ANI_FOLLOW83"),1); // <---------- AGGIUNGERE ATK BTN PER SLACCIARE!!
}
}
}
void check_hit_type_normal(void self, void parent, void opp, int damage, int drop) {
// ------------- PARATI SOLO DALL'ATTACCO NORMALE -----------
/*if ( getentityproperty(opp,"aiflag","blocking") ) { // && oa <= obase
show_block_flash(opp);
changeentityproperty(opp,"aiflag","blocking",1);
changeentityproperty(opp,"takeaction","common_block",1);
opp = NULL();
}*/
// ---------- TYPE_ENT DAMAGE ------------
/*if ( getentityproperty(parent,"exists") ) {
if ( getentityproperty(parent,"type") == openborconstant("TYPE_PLAYER") ) damage *= 1.75;
}*/
// ---------- TYPE_ENT DAMAGE ------------
// ---------- UCCIDI SU COLPO ----------
if ( opp != NULL() ) {
if ( parent == NULL() ) parent = self;
changeentityproperty(parent, "opponent", opp);
if ( opp == parent ) {
changeentityproperty(self,"opponent",NULL());
return; // escludiamo chi ha scoccato la freccia per il noreflect
}
// Danneggia l'avversario per il noreflect
if ( getentityproperty(opp,"exists") ) {
int ohealth = getentityproperty(opp,"health");
float oa = getentityproperty(opp,"y");
float obase = getentityproperty(opp,"base");
//if ( oa > obase ) drop = 1;
drop = 1;
if ( ohealth-damage > 0 ) damageentity(opp,parent,damage,drop,openborconstant("ATK_NORMAL"));
else damageentity(opp,parent,damage,drop,openborconstant("ATK_NORMAL"));
if ( !getentityproperty(opp,"aiflag","blocking") ) {
if ( !getentityproperty(opp,"flash","noattack") ) {
show_flash(); // Il flash è in mostra?? Se no allora eseguilo.
playsample(loadsample("data/sounds/punch004.wav"));
}
} else {
if ( getentityproperty(self,"flash","block") ) {
show_block_flash();
playsample(loadsample("data/sounds/punch003.wav"));
}
}
}
}
}
stin said:Rock!
ps: in attachment; Funny! Verycool test![]()
magggas said:O Ilusionista said:are you sure? I think its like 10 lines of code or less versus 600 lines.
but its up to you![]()
600 lines i don´t think is a problem for White Dragon, since i think he is not even a human being. Looking to he's codes he must be for sure an computer ;D
White Dragon thanks for the demo, lets give it a try ;D
BeasTie said:@WD - if you play the surfing stage and then start a new game in arcade, you will spawn with the surf board.
stin said:Rock!
ps: in attachment; Funny! Verycool test![]()