Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (monk12), 1,487 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 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 | chip programmers | 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