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,767 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
Empty Pointer #89208
09/09/06 08:34
09/09/06 08:34
Joined: Apr 2006
Posts: 37
Swiss
M
mfuada Offline OP
Newbie
mfuada  Offline OP
Newbie
M

Joined: Apr 2006
Posts: 37
Swiss
Hi..
What kind of mistake that usually cause the Empty pointer error...
beside forget to put the "wait(1)" line...

Re: Empty Pointer [Re: mfuada] #89209
09/09/06 11:53
09/09/06 11:53
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
If the empty pointer happens at game start:
A function/action trys to access a pointer which is not set yet.
This happens, because some entities are created before others.
So lets say the enemie accesses the player pointer in his action while loop.
But because he is created earlier (for any reason) he gets an empty pointer and you as a developer an empty pointer error.
This can be sorted out by simply adding another while loop _before_ the main while loop in the entities action.
If we use the example from above, we would change our enemies action to something like this:
Code:

action enemie_act
{
while(!player) { wait(1); } //waits until the player pointer is none zero (!=0)
while(my.health > 0)
{
...




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