Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,561 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Working with multiple entities #162081
10/19/07 13:36
10/19/07 13:36
Joined: Aug 2007
Posts: 17
T
Torr Offline OP
Newbie
Torr  Offline OP
Newbie
T

Joined: Aug 2007
Posts: 17
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.

Re: Working with multiple entities [Re: Torr] #162082
10/20/07 06:01
10/20/07 06:01
Joined: Aug 2007
Posts: 17
T
Torr Offline OP
Newbie
Torr  Offline OP
Newbie
T

Joined: Aug 2007
Posts: 17
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
{
...
}



Re: Working with multiple entities [Re: Torr] #162083
10/20/07 13:02
10/20/07 13:02
Joined: May 2006
Posts: 398
Bot190 Offline
Senior Member
Bot190  Offline
Senior Member

Joined: May 2006
Posts: 398
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.


Wait, there isn't a "Make My Game Now" button?

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1