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
2 registered members (TipmyPip, AndrewAMD), 14,136 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
functions called by entity retain pointers to that entity? #219487
08/02/08 19:43
08/02/08 19:43
Joined: May 2006
Posts: 90
England
TigerTao Offline OP
Junior Member
TigerTao  Offline OP
Junior Member

Joined: May 2006
Posts: 90
England

I was going through George's Purrfect Ai tutorials and whilst looking at his ai4 code I found this called in the enemy action:

find_path(my.start_node, target_node, my.skill48, path_index)

my.startnode is the enemies closest node already defined.
my.skill48 is the enemy ID which also is already defined.

Now my problem is that Ive made a function that is called by one of my enemies and I found that I dont need to pass its ID number across (eg, my.skill48) for it to work on that particular enemy. The function still seems to retain the "my." pointer for the calling entity and Ive got six enemies calling the same function and working.

Am I just being dumb or is this something unique to the C-script compiler?

Re: functions called by entity retain pointers to that entity? [Re: TigerTao] #219496
08/02/08 20:45
08/02/08 20:45
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
No you're not dumb.
Every function called by an entity has its own my pointer set to that very entity.
If an amount of x entities call the same function you have a number of x function instances running. Each with a different my pointer, pointing to the entity which called the function.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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