O Ilusionista
Captain 100K
I have an entity where I need its "parent" to receive a value from it—it's a system to control a boomerang-style projectile and track whether it's still active (since it has code to self-destruct after ricocheting a few times), and the "parent" loops until it receives that value.
Here is the code I'm using, with the problematic line commented out:
In the image below, I can see that the code correctly identifies the entity's "parent."

(but notice that "parent" has a value, whereas "tControl" does not)
The "parent" uses this code to check the value
However, if I try to pass a value to that entity, the engine crashes with the following error:
I can't figure out what's wrong.
(I can't use a global variable like I do in the Avengers project because here you can choose the same character, and that would break the movement if two characters checked the same variable.)
--------------
EDIT:
The funny part is:
I'm checking the projectile's "owner" to determine the distance between them; if it falls below a certain value, the projectile destroys itself.
I can force the "owner" to change animations without any issues (and I could switch to "parent" instead of "owner"), but I get an error if I try to pass a variable.
Here is the code I'm using, with the problematic line commented out:
C-like:
void self = getlocalvar("self"); // Get calling entity.
int Bounce = getlocalvar("Bounce" + self); // Get bounced state
void parent = getentityproperty(self, "parent"); // get parent entity
int tControl = 0;
//setentityvar(parent,"tControl",1);//control check
settextobj(1, 200, 40, 1, openborconstant("FRONTPANEL_Z"), "Bounce: " + Bounce, 300+openborvariant("elapsed_time"));
settextobj(2, 200, 50, 0, openborconstant("FRONTPANEL_Z"), "Self: " + self, 300+openborvariant("elapsed_time"));
settextobj(3, 200, 60, 0, openborconstant("FRONTPANEL_Z"), "Parent: " + parent, 300+openborvariant("elapsed_time"));
In the image below, I can see that the code correctly identifies the entity's "parent."

(but notice that "parent" has a value, whereas "tControl" does not)
The "parent" uses this code to check the value
C-like:
void self = getlocalvar("self");
int tControl = getentityvar(self,"tControl");
settextobj(10, 200, 80, 2, openborconstant("FRONTPANEL_Z"), "tControl: " + tControl, 300+openborvariant("elapsed_time"));
However, if I try to pass a value to that entity, the engine crashes with the following error:
"Script function 'setentityvar' returned an exception, check the manual for details.
parameters: <VT_EMPTY> Unitialized, "tControl", 1, "
I can't figure out what's wrong.
(I can't use a global variable like I do in the Avengers project because here you can choose the same character, and that would break the movement if two characters checked the same variable.)
--------------
EDIT:
The funny part is:
I'm checking the projectile's "owner" to determine the distance between them; if it falls below a certain value, the projectile destroys itself.
I can force the "owner" to change animations without any issues (and I could switch to "parent" instead of "owner"), but I get an error if I try to pass a variable.
C-like:
void self = getlocalvar("self"); // Get calling entity.
void Owner = getentityproperty(self, "owner"); // Get owner
int x = getentityproperty(self, "x"); // Get current x coordinate
int Ox = getentityproperty(Owner, "x"); // Get Owner's x coordinate
if(x <= Ox + 60 && x >= Ox - 60){ // Close to owner's x?
performattack(Owner, openborconstant("ANI_JUMP"));
killentity(self); //Suicide!
}
Last edited: