Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,295 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Remove problem... #3551
05/13/01 15:38
05/13/01 15:38
Joined: Jul 2000
Posts: 1,570
Windsor, CT 06095
W
WildCat Offline OP
Expert
WildCat  Offline OP
Expert
W

Joined: Jul 2000
Posts: 1,570
Windsor, CT 06095
I have a series of jet flames attached to a model. Each flame's Entity1 points to the ship it is attached to and it runs code similar to what is listed here:


action front_flame
{
my.entity1 = you; // my.entity1 is the ship that created this flame

While(my.entity1 != null)
{Do_flame_stuff;
wait(1);}

remove(me);
}


The problem is that when the ship that MY.ENTITY1 points to is removed, The flames do not get removed with it and before too long I reach my max_entity count and the engine crashes.

Can someone tell me why MY.ENTITY1 does not turn to null once the ship is gone, or how I can fix this?

Thanks!

- WildCat



Visit us at [url=http://www.vertexgames.com]Vertex Games[/url]!
Re: Remove problem... #3552
05/13/01 15:49
05/13/01 15:49

A
Anonymous
Unregistered
Anonymous
Unregistered
A



I could be wrong on this, but you should probably set the entity1 = me using a type entity synonym, then instead of refering to my.entity1 you could just say entity1.

you set entity1 to you, meaning a different entity, so that object might always exist. Try something like:

SYNONYM entity1 { TYPE ENTITY; }

function my_flame()
{
while(entity1 != null)
{Do_flame_stuff;
wait(1);}
remove(me);
}

action front_flame
{
entity1 = me;
my_flame();
}

If you need more help feel free to email me.

Brandon

[This message has been edited by AcidCrow (edited 13 May 2001).]


Re: Remove problem... #3553
05/14/01 23:04
05/14/01 23:04
Joined: Jul 2000
Posts: 1,570
Windsor, CT 06095
W
WildCat Offline OP
Expert
WildCat  Offline OP
Expert
W

Joined: Jul 2000
Posts: 1,570
Windsor, CT 06095
Thanks for the reply AcidCrow,
but the my.entity1 is only set once, when the action is first called.

I can not use external synonyms because this action is for enemy ships which get spawned automatically, and there may be a great many of them out at once.

Any other ideas?

-WildCat



Visit us at [url=http://www.vertexgames.com]Vertex Games[/url]!
Re: Remove problem... #3554
05/15/01 16:55
05/15/01 16:55

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Hi Dale,

not sure i got everything, however i assume that you do create the jet flames in your ships code, right ? If this is the case the jet flames are a seperate entity that has to be removed separate. Let me know if this makes sense.

greetings Ronny

------------------
To boldly animate, what no man has ever animated before

cybersorcerer.de


Re: Remove problem... #3555
05/15/01 17:50
05/15/01 17:50

A
Anonymous
Unregistered
Anonymous
Unregistered
A



ummm...

Looks to me like the my.entity1 will never be null since you have several ships creating the flames.

Ive never used the command, and it may not work for what you want, but try looking at the exclusive_entity command.

From the manual Page 56:
"exclusive_entity will terminate all other functions started by my, i.e. the current entity, at their next wait() instruction."

If possible you could also put the remove me in the do_flame stuff, so when the flame stuff is done it removes the flame??

Brandon


Re: Remove problem... #3556
05/15/01 22:43
05/15/01 22:43
Joined: Jul 2000
Posts: 1,570
Windsor, CT 06095
W
WildCat Offline OP
Expert
WildCat  Offline OP
Expert
W

Joined: Jul 2000
Posts: 1,570
Windsor, CT 06095
Ooo. OOooo! Acid, you are a GEEEENIUS! That exclusive entity thing sounds like it might work! I'll let you know how I make out.

(By the way, since the variable of the flame that I am check is MY.ENTITY1 (The flames entity1) Each flame has one, and only one parent. Each flame knows the one ship it is attached to, even if multiple ships are in play)

Thanks again.

-WildCat



Visit us at [url=http://www.vertexgames.com]Vertex Games[/url]!
Re: Remove problem... #3557
05/16/01 13:33
05/16/01 13:33
Joined: Jul 2000
Posts: 1,570
Windsor, CT 06095
W
WildCat Offline OP
Expert
WildCat  Offline OP
Expert
W

Joined: Jul 2000
Posts: 1,570
Windsor, CT 06095
Now this is frustrating....

I tried AcidCrows suggestion of the Exclusive entity command before doing the REMOVE me when destroying my fighters so that it would kill the process for all of the jets.

It works like 90% of the time, and on some other times, the fighters disappear and the jet flames just hang in the air.

Why would the EXCLUSIVE_ENTITY command not kill all the flames, all the time?!

PLEASE, anyone: I have a ship model with 8 subordinate flame models. Each flame has it's entity1 variable set to the main ship. What is the proper way to terminate all 9 entities when the ship is destroyed.

Thanks in advance,

-WildCat



Visit us at [url=http://www.vertexgames.com]Vertex Games[/url]!
Re: Remove problem... #3558
05/16/01 20:35
05/16/01 20:35

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Sounds like you are getting closer...

Maybe try putting a while(my.entity1 != null){remove(me)}

Just another idea to try...might work, might not.

Dont know why it would only work 90% of the time though, like I said, I haven't used the command yet.

Brandon


Re: Remove problem... #3559
05/16/01 23:46
05/16/01 23:46
Joined: Jul 2000
Posts: 1,570
Windsor, CT 06095
W
WildCat Offline OP
Expert
WildCat  Offline OP
Expert
W

Joined: Jul 2000
Posts: 1,570
Windsor, CT 06095
Hi AcidCrow,

The "while(my.entity1 != null){do stuff} then remove me"

thing was the first thing that I tried. The problem seems to be that when the entity that *IS* entity1 is removed, the reference to it in my.entity1 never gets updated.

While this would be hideously inefficient, all I can think to do is use some scan commands to see if there is an entity where I think there should be and if not assume that it was destroyed.

Any other thoughts?

-WildCat



Visit us at [url=http://www.vertexgames.com]Vertex Games[/url]!
Re: Remove problem... #3560
05/17/01 03:00
05/17/01 03:00
Joined: Jul 2000
Posts: 8,973
Bay Area
Doug Offline
Senior Expert
Doug  Offline
Senior Expert

Joined: Jul 2000
Posts: 8,973
Bay Area
This is based on the "attach_entity" function in movement.wdl.

code:

function my_attached_entity()
{
my.passable = on;
while(you) // prevent empty synoym error if parent entity was removed
{
// do stuff...
wait(1);
}
remove(me);
}




Conitec's Free Resources:
User Magazine || Docs and Tutorials || WIKI
Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

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