Raised This Month: $32 Target: $400
 8% 

Killing an entity fails (Somtimes)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 09-05-2017 , 20:18   Killing an entity fails (Somtimes)
Reply With Quote #1

So in my Artillery strike addon which spawns "env_smoke" to mark the location of the explosions sometimes fails to remove itself after the artillery strike has finished. Is it because I'm using the same array to hold entity values? I.E. one player calls an artillery strike and it uses the same arrays as the previous client who called a strike in too?

The timer that starts creates the smoke entity
Code:
public Action ArtillarySmokeTimer(Handle timer, any Client)
{
	float ArtillarySmokePos1[3];
	GetAimPos(Client, ArtillarySmokePos1);
	ArtillarySmoke[0] = CreateEntityByName("env_smokestack");
	DispatchKeyValue(ArtillarySmoke[0], "InitialState", "1");
	DispatchKeyValue(ArtillarySmoke[0], "SpreadSpeed", "10");
	DispatchKeyValue(ArtillarySmoke[0], "Speed", "15");
	DispatchKeyValue(ArtillarySmoke[0], "StartSize", "8");
	DispatchKeyValue(ArtillarySmoke[0], "EndSize", "16");
	DispatchKeyValue(ArtillarySmoke[0], "Rate", "10");
	DispatchKeyValue(ArtillarySmoke[0], "JetLength", "150");
	DispatchKeyValue(ArtillarySmoke[0], "WindAngle", "23");
	DispatchKeyValue(ArtillarySmoke[0], "WindSpeed", "10");
	DispatchKeyValue(ArtillarySmoke[0], "rendercolor", "233 3 9");
	DispatchKeyValue(ArtillarySmoke[0], "twist", "5");
	DispatchKeyValue(ArtillarySmoke[0], "roll", "3");
	DispatchKeyValue(ArtillarySmoke[0], "SmokeMaterial", "particle/SmokeStack.vmt");
	DispatchSpawn(ArtillarySmoke[0]);
	TeleportEntity(ArtillarySmoke[0], ArtillarySmokePos1, NULL_VECTOR, NULL_VECTOR);
	AcceptEntityInput(ArtillarySmoke[0], "TurnOn");
}
Removing smoke
Code:
public Action KillSmoke(Handle timer)
{
	AcceptEntityInput(ArtillarySmoke[0], "Kill");
	AcceptEntityInput(ArtillarySmoke[1], "Kill");
	AcceptEntityInput(ArtillarySmoke[2], "Kill");
	AcceptEntityInput(ArtillarySmoke[3], "Kill");
	AcceptEntityInput(ArtillarySmoke[4], "Kill");
}
Halt is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 09-05-2017 , 22:23   Re: Killing an entity fails (Somtimes)
Reply With Quote #2

https://forums.alliedmods.net/showpo...28&postcount=5

use
PHP Code:
stock KillEntityIn(iEntFloat:flSeconds)
{
    
decl String:szAddOutput[32];
    
Format(szAddOutputsizeof(szAddOutput), "OnUser1 !self,Kill,,%0.2f,1"flSeconds);
    
SetVariantString(szAddOutput);
    
AcceptEntityInput(iEnt"AddOutput");
    
AcceptEntityInput(iEnt"FireUser1");

also this post should go to scripting

Last edited by 8guawong; 09-05-2017 at 22:24.
8guawong is offline
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 09-06-2017 , 11:46   Re: Killing an entity fails (Somtimes)
Reply With Quote #3

Apologize for posting in the wrong section (twice), didn't notice. Thanks, I'll give it a try next time I test the mod!
Halt is offline
Reply


Thread Tools
Display Modes

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 16:07.


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