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.
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.
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.