ent_remove doesn't remove

Posted By: JazzDude

ent_remove doesn't remove - 05/07/07 20:01

Why doesn't this work?

Code:

ACTION Player
...
ent_create("knife.mdl",my.x,attach_weapon);
if(my.health <= 0){ent_remove("knife.mdl");}
...


Posted By: nipx

Re: ent_remove doesn't remove - 05/07/07 20:16

because you have to use a pointer for ent_remove.

==>>

Code:

//now you is the pointer to my knife model
you=ent_create("knife.mdl",my.x,attach_weapon);

//now remove you and you is the knife
ent_remove(you);




should work


nipx
Posted By: JazzDude

Re: ent_remove doesn't remove - 05/07/07 20:21

Thanks, Nipx, but it didn't work. No error, tho.
Posted By: nipx

Re: ent_remove doesn't remove - 05/07/07 20:24

do you call any wait before you remove the model?


nipx
Posted By: oliver2s

Re: ent_remove doesn't remove - 05/07/07 20:43

Try this:

Code:
entity* ent_knife;

ACTION Player
...
ent_knife = ent_create("knife.mdl",my.x,attach_weapon);
if(my.health <= 0){ent_remove(ent_knife);}
...


Posted By: JazzDude

Re: ent_remove doesn't remove - 05/07/07 21:10

I appreciate the suggestions.

But that ornery knife just won't go away.
Perhaps the reason is in some other part of the script rather than the player action.
Posted By: quasarchangel

Re: ent_remove doesn't remove - 05/07/07 21:15

Do some easy debugging. Use an snd_play() function to "hear" which functions are being run or which ifs are being entered. If you can't here the sound then you know its not getting to that point in the script.
Otherwise, post some more of your code.
Posted By: JazzDude

Re: ent_remove doesn't remove - 05/07/07 21:27

I thing that's what beep() is for.

Thanks, guys. I found a workaround, or maybe a better way to do it.

I put the health condition in the attach_weapon action and that works.
Posted By: quasarchangel

Re: ent_remove doesn't remove - 05/07/07 21:28

lol, no comment
© 2024 lite-C Forums