void main()
{// Wall bounce on falling state
void self = getlocalvar("self");
int Vx = getentityproperty(self,"xdir");
int Vy = getentityproperty(self,"tossv");
int Vz = getentityproperty(self,"zdir");
int Fall = getentityproperty(self, "aiflag", "drop");
if(Fall==1){
changeentityproperty(self, "velocity", -Vx*0.5, -Vz*0.5, Vy+1); // bounced
}
}
onblockwscript data/scripts/wallbons.c
That animation has a bug with binded entities - once you trigger thre hitwall, any entity which was binded is unbind.Anim HITWALL (players,enemies)
Optional.
This animation is played when entity hits a wall while falling.
Check the manual
thank you However, if you apply this command and climb the terrain corresponding to the wall, the fallen enemy will instantly move away.Anim HITWALL (players,enemies)
Optional.
This animation is played when entity hits a wall while falling.
Check the manual
void main()
{// Wall bounce on falling state
void self = getlocalvar("self");
int Vx = getentityproperty(self,"xdir");
int Vy = getentityproperty(self,"tossv");
int Vz = getentityproperty(self,"zdir");
int Fall = getentityproperty(self, "aiflag", "drop");
if(Fall==1){
changeentityproperty(self, "velocity", -Vx*0.5, -Vz*0.5, Vy+1); // bounced
}
}
onblockwscript data/scripts/wallbons.c
thank you It works fine. Now it looks natural on the wall.You'd need to give your enemies certain onblockwscript. Here's one for wall bounce:
WallBons.c
C:void main() {// Wall bounce on falling state void self = getlocalvar("self"); int Vx = getentityproperty(self,"xdir"); int Vy = getentityproperty(self,"tossv"); int Vz = getentityproperty(self,"zdir"); int Fall = getentityproperty(self, "aiflag", "drop"); if(Fall==1){ changeentityproperty(self, "velocity", -Vx*0.5, -Vz*0.5, Vy+1); // bounced } }
Save that script in data/scripts folder.
Declare this in enemies header text to apply that script:
something like unless walls the enemy hits the screen limits as it is subject to the screen.
How to do it for screen edge?You'd need to give your enemies certain onblockwscript. Here's one for wall bounce:
WallBons.c
C:void main() {// Wall bounce on falling state void self = getlocalvar("self"); int Vx = getentityproperty(self,"xdir"); int Vy = getentityproperty(self,"tossv"); int Vz = getentityproperty(self,"zdir"); int Fall = getentityproperty(self, "aiflag", "drop"); if(Fall==1){ changeentityproperty(self, "velocity", -Vx*0.5, -Vz*0.5, Vy+1); // bounced } }
Save that script in data/scripts folder.
Declare this in enemies header text to apply that script:
onblocksscript data/scripts/wallbons.c
Thank you it's working but I need to use subject to screen on every fall and rise anim to do this, is there a way to modify this wallbons script to get a similar result?The script only works if the enemy is subject to screen. If you want to use this, either make enemies subject to screen or make them subject to screen only if they are knocked down by certain attack. Subject to screen is disabled after enemy lands or when enemy rises.
@machokThank you it's working but I need to use subject to screen on every fall and rise anim to do this, is there a way to modify this wallbons script to get a similar result?
void main()
{//Lock the screen edge (for enemies) if take any damage
void self = getlocalvar("self");
void type = getentityproperty(self,"type");
int dead = getentityproperty(self, "dead");
if(type == openborconstant("TYPE_ENEMY") && !dead){
changeentityproperty(self, "subject_to_screen", 1);
}
}
void main()
{//Unlock the screen edge (for enemies) according to defined animations
void self = getlocalvar("self");
void type = getentityproperty(self,"type");
int anim = getentityproperty(self, "animationID");
if(type == openborconstant("TYPE_ENEMY")){
if( anim == openborconstant("ANI_WALK")||
anim == openborconstant("ANI_RUN")){
changeentityproperty(self, "subject_to_screen", 0);
}
}
}
You can combine the wall previous bouncing script inside the onblocksscript, like this@Kratus It works perfectly many thanks
but how you make enemy bounce back with screen edges? I mean like the screen edge hitting the enemy back inside so player can continue the combo
void main()
{
wallBounce();
wallUnlock();
}
void wallBounce()
{// Wall bounce on falling state
void self = getlocalvar("self");
int Vx = getentityproperty(self,"xdir");
int Vy = getentityproperty(self,"tossv");
int Vz = getentityproperty(self,"zdir");
int Fall = getentityproperty(self, "aiflag", "drop");
if(Fall==1){
changeentityproperty(self, "velocity", -Vx*0.5, -Vz*0.5, Vy+1); // bounced
}
}
void wallUnlock()
{//Unlock the screen edge (for enemies) according to defined animations
void self = getlocalvar("self");
void type = getentityproperty(self,"type");
int anim = getentityproperty(self, "animationID");
if(type == openborconstant("TYPE_ENEMY")){
if( anim == openborconstant("ANI_WALK")||
anim == openborconstant("ANI_RUN")){
changeentityproperty(self, "subject_to_screen", 0);
}
}
}