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
3 registered members (AndrewAMD, TipmyPip, OptimusPrime), 15,229 guests, and 7 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
Page 2 of 2 1 2
Re: Following one entity with another [Re: Siegewolf] #261707
04/19/09 17:04
04/19/09 17:04
Joined: Mar 2009
Posts: 23
S
Siegewolf Offline OP
Newbie
Siegewolf  Offline OP
Newbie
S

Joined: Mar 2009
Posts: 23
Uh-oh, this is not working fully after all.

Sometimes it still happens that a new entity (created after the old, followed one had been removed) is detected as the old entity. As if the new entity got both the same handle and the same pointer as the old one, such that the equality of original pointer and the pointer obtained by handle still holds. Any further ideas?

Re: Following one entity with another [Re: Siegewolf] #261712
04/19/09 17:33
04/19/09 17:33
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
This can happen on the "rare" (coding caused) occasion where the old entity is removed,
and A new entity is created in the same place in memory in the same frame.

IF the function that does the remove is the same function that does the create,
put a single wait between the remove and the create to give the action time to kill itself.

If thats not managable, try this variation.
Code:
action follower_action()
{
        wait(1);
        ENTITY* ent = ptr_for_handle(my.skill10);
        var ID = random(100000);
        if(ent)   ent.skill75 = ID;    //pick a skill number unused by parent entity
        while(ent)
        {
                vec_set(my.x,ent.x);
                wait(1);
                if(ent!=NULL)   if(ent.skill75!=ID)   ent = NULL;   //dual IF's required
        }
}



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Page 2 of 2 1 2

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