Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Removing an entity #157110
09/27/07 00:06
09/27/07 00:06
Joined: Aug 2005
Posts: 390
Florida
O
oldschoolj Offline OP
Senior Member
oldschoolj  Offline OP
Senior Member
O

Joined: Aug 2005
Posts: 390
Florida
Sounds easy, doesn't it? Well this is becoming a mystery to me, simply because when ever I try to remove my ents, i get an invalid argument. Maybe someone could shed some light on it for me.
I define a model with a string:
STRING* item_model_0000 = "item_sword_00001.mdl";

Now I give it a handle:
item_model_array[0]=handle(item_model_0000);

Now I point to that model:
temp_ent[0] = ptr_for_handle(item_model_array[0]);

And create it:
ent_create(temp_ent[0], player.x, attach_item);

So far, so good. It gets created, and does it's job, but now I need to remove it, because we wont need it anymore:

if (temp_ent[0] != NULL){temp_ent[0] = you; wait (1); ent_remove(you);}

That draws up an "invalid argument", but not just that, I can also do this:
if (temp_ent[0] != NULL)ent_remove(temp_ent[0]);

Still the same results, and I am totally stumped for days...

I know that things are working up untill the ent_remove, because if I do this:
if (temp_ent[0] != NULL)beep();

I get a nice resounding beep, letting me know that the ent is in fact alive.

If anyone has any suggestions, please enlighten me


THANKS!

Jesse

Last edited by oldschoolj; 09/27/07 02:12.

you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe. __________________________________ yours truly
Re: Removing an entity [Re: oldschoolj] #157111
09/27/07 02:10
09/27/07 02:10
Joined: Aug 2005
Posts: 390
Florida
O
oldschoolj Offline OP
Senior Member
oldschoolj  Offline OP
Senior Member
O

Joined: Aug 2005
Posts: 390
Florida
Well it appears I finally solved the problem, and it's really really easy, lol. This is why I wish I were a good programmer, so I didnt have to beat my head against the wall on issues like this.....

Here's the beef:
Added a second ent:
ENTITY* item_temp[25];

edited the ent_create line:
item_temp[0] = ent_create(temp_ent[0], player.x, attach_item);

and changed the ent_remove line:
if (item_temp[0] != NULL)ent_remove (item_temp[0]);

I don't know how it fixed it, but it did, and I think it might havesomething to do with the strings, but I'm unsure, lol....

Until the next issue, happy programming!

Jesse

Last edited by oldschoolj; 09/27/07 02:12.

you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe. __________________________________ yours truly

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