Throwing enemies

brikinhos

New member
Hi all. I want to improve physics when I throw an enemy over another enemy. Sometimes, when an enemy falling hits another one, for example, the first one goes to right and the second one goes to left. I want both go to the same direction.

I tried changing at run time from onfallscript  "xdir" of the second one.

Code:
void self = getlocalvar("self");
void attacker = getlocalvar("attacker");
if (getentityproperty(attacker, "type") == openborconstant("TYPE_ENEMY")){
	if(getentityproperty(attacker, "xdir") > 0){
		if(getentityproperty(self, "xdir") < 0)
			changeentityproperty(self, "xdir", getentityproperty(self, "xdir") * -1);
			
	}else if(getentityproperty(attacker, "xdir") < 0){
		if(getentityproperty(self, "xdir") > 0)
			changeentityproperty(self, "xdir", getentityproperty(self, "xdir") * -1);
	}
}

The problem is I got an exception: "Script function 'changeentityproperty' returned an exception, check the manual for details."

I did something wrong? Is there a solution for this problem? Thanks in advance.
 
O Ilusionista said:
You don't need a script for that - set an attack box in the fall animation and use forcedirection
Thanks for the solution, I will keep in mind for other projects. I can't apply your solution because I would have to modify 160 files and I would die trying it  ;D.
 
Back
Top Bottom