Placing the int above won't do anything. Currently you are trying to access an actor's enemy1x variable and set it equal to the event actor's x. This won't work because enemy1x is not an actor variable. You just declared it in that script. Assuming in your actual setup it is an actor variable, that code would work, but it doesn't sound like what you want it to do. From your topic's title, I would think you want something more like this (note that enemy1x is a global variable defined elsewhere).
- Code: Select all
Actor* enemy1 = getclone2(player1Name, 0);
enemy1x = enemy1->x;
As for how you are "supposed" to do it. That depends greatly on what you are actually trying to do.