Raised This Month: $ Target: $400
 0% 

Respawn some NPC after X seconds.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 01-12-2011 , 11:48   Respawn some NPC after X seconds.
Reply With Quote #1

I tried http://forums.alliedmods.net/showthread.php?t=21819 but doesn't work very well. Error is: [FAKEMETA] Invalid entity

Origins is Ok, but the entity id is wrong.

Last edited by dFF; 01-12-2011 at 11:50.
dFF is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-12-2011 , 11:50   Re: Respawn some NPC after X seconds.
Reply With Quote #2

Tried what exactly. Show the code here.
__________________
Arkshine is offline
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 01-12-2011 , 11:56   Re: Respawn some NPC after X seconds.
Reply With Quote #3

Here is the partial code I used:
PHP Code:
public fw_touch(toucherent)
{
    
//check valid...

    
new Float:curOrigin[3]
    
pev(entpev_origincurOrigin)
    
    new 
data[3]
    
FVecIVec(curOrigindata)

    
set_task(5.0"RecreateEnt"entdata3)

    
engfuncEngFunc_RemoveEntityent )
}

public 
RecreateEntiEntitydata[3])
{
    
client_print03"%d | %d %d %d"iEntitydata[0],data[1],data[2])
    
    new 
Float:origin[3]
    
IVecFVec(dataorigin)
    
    
engfuncEngFunc_SetOriginiEntityorigin // here is the fault, server freeze X seconds.
    
    //some stuff

Debug Test

Code:
Entity ID | Entity Origin
10632 | 552 560 56

Last edited by dFF; 01-14-2011 at 05:38.
dFF is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 01-12-2011 , 12:07   Re: Respawn some NPC after X seconds.
Reply With Quote #4

Code:
public RecreateEnt( iEntity, data[3])
change to
Code:
public RecreateEnt( data[3], iEntity)
__________________
hleV is offline
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 01-12-2011 , 12:24   Re: Respawn some NPC after X seconds.
Reply With Quote #5

Yep, working if change this
PHP Code:
set_task(5.0"RecreateEnt"entdata3

to
set_task(5.0, "RecreateEnt", 0, data, 3)

But have another problem, game freeze during the re-create ent / or players is blocked.
dFF is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 01-12-2011 , 12:52   Re: Respawn some NPC after X seconds.
Reply With Quote #6

It seems that you're setting origin to an entity which doesn't exist (as you remove it). If you provide 0 as entity, it will set origin to the 0th entity, which is not the entity you want to set origin to.
__________________
hleV is offline
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 01-12-2011 , 13:00   Re: Respawn some NPC after X seconds.
Reply With Quote #7

Yes, You're right. But I don't have a idea how to restore my entity (NPC).
For example I spawn some NPCs, and when player touch any NPC, the NPC is removed and after 5 seconds she restored in the same origin after spawn first time. How to make this ?

Edit.

Last edited by dFF; 01-12-2011 at 13:24.
dFF is offline
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 01-14-2011 , 05:33   Re: Respawn some NPC after X seconds.
Reply With Quote #8

Any ideas ? Or How to check if an entity is already spawned in some origin ?
dFF is offline
Elusive138
Senior Member
Join Date: Dec 2010
Old 01-14-2011 , 06:42   Re: Respawn some NPC after X seconds.
Reply With Quote #9

PointContents(vOrigin)

// engfunc(EngFunc_PointContents, Floatrigin) return values
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
#define CONTENTS_ORIGIN -7 // Removed at csg time
#define CONTENTS_CLIP -8 // Changed to contents_solid
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_TRANSLUCENT -15
#define CONTENTS_LADDER -16
#define CONTENT_FLYFIELD -17
#define CONTENT_GRAVITY_FLYFIELD -18
#define CONTENT_FOG -19
Elusive138 is offline
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 01-14-2011 , 07:36   Re: Respawn some NPC after X seconds.
Reply With Quote #10

Tried and doesn't work.
dFF is offline
Old 01-14-2011, 07:45
Elusive138
This message has been deleted by Elusive138. Reason: .
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:59.


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