AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Respawn an entity? (https://forums.alliedmods.net/showthread.php?t=82268)

FakeNick 12-20-2008 06:46

Respawn an entity?
 
Hello.
I have a problem. When player touch an entity, it dissapear and i want to respawn a new entity on the origins of the old entity. I was thinking about set_task, but my code isn't working. Can someone help me? ;>

xPaw 12-20-2008 07:02

Re: Respawn an entity?
 
mm show code, dont understand why its dissapear

FakeNick 12-20-2008 07:06

Re: Respawn an entity?
 
No no, it must dissapear, because im deleting it, but how i can respawn a new entity on the origins of the old entity (just deleted one) ? Like in healthpacks :].

ConnorMcLeod 12-20-2008 07:11

Re: Respawn an entity?
 
Don't delete it.
Set pev_solid -> SOLID_NOT
Set pev_effects -> pev_effects | EF_NODRAW
Set pev_nextthink -> get_gametime() + time_you_want_to_respawn


Then you also have to hook FM_THINK

in the Think function, check if the entity is one of those you use in your plugin, then, check if pev_effects & EF_NODRAW
In that case :
Set pev_solid to what it was set before when the entity should trigger the Touch
Set pev_effects -> pev_effects & ~EF_NODRAW
Set pev_nextthink if you need to.

FakeNick 12-20-2008 07:15

Re: Respawn an entity?
 
I was thinking about FM_Think :). Thanks connor, gonna test it.

@Edit

Hmm, when i set a ~EF_NODRAW like this :

PHP Code:

set_pev(ent,pev_effects & ~EF_NODRAW

there's a not needed light aura on entity. How i can delete it?

ConnorMcLeod 12-20-2008 09:16

Re: Respawn an entity?
 
set_pev(ent,pev_effects, pev(ent,pev_effects) & ~EF_NODRAW)

But as you normally already no what is pev_effects value :

PHP Code:

new iEffects pev(ent,pev_effects)
if( 
iEffects EF_NODRAW )
{
    
set_pev(ent,pev_effectsiEffects & ~EF_NODRAW



FakeNick 12-20-2008 09:35

Re: Respawn an entity?
 
Thank you again connor, but i can't give You more karma.


All times are GMT -4. The time now is 09:14.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.