Working with multiple entities

Posted By: Torr

Working with multiple entities - 10/19/07 13:36

Is binding an action to multiple entities similar in concept to instantiating? Will each entity have its own copy of all variable within the script and run the functions independently?

If so, is there any way I can watch the variable values for each entity? Such as my.x of 2 entities.
Posted By: Torr

Re: Working with multiple entities - 10/20/07 06:01

I don't understand this part of the manual fully.
Quote:

If many instances of the same function are running, which is normally the case with entity actions, each instance uses its own independent set of local variables.



For the code below, if I create 10 entities with the action Bot, would each entity have its own copy of botcount? Or do all 10 share just 1 botcount?
Code:
var botcount = 0;
function BotUpdate()
{
...
botcount = 0;
if (vec_dist(my.x, you.x) < 200)
{
botcount += 1;
}
}
action Bot
{
...
}


Posted By: Bot190

Re: Working with multiple entities - 10/20/07 13:02

that isn't a local variable, im not sure so you should look it up in the manual but i think a variable is made local if its defined in an action.
© 2024 lite-C Forums