Raised This Month: $12 Target: $400
 3% 

L4D2 vscript spawn env_spritetrail ,but it does not work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xiaoer
New Member
Join Date: Jul 2019
Old 02-12-2020 , 06:53   L4D2 vscript spawn env_spritetrail ,but it does not work
Reply With Quote #1

i try to spawn a env_spritetrail entity.but i find it is spawned but not work. i try it in hammer with a simple code.
Code:
hPlayer1<-null;
others<-null;
function OnGameEvent_player_say(event)
{
	
	if (GetPlayerFromUserID(event.userid) == null) return;
	local hPlayer = GetPlayerFromUserID(event.userid);
	local sText = event.text;
	if (hPlayer != null)
	{
	hPlayer1=hPlayer;
	 local other=null;
	other=Entities.FindByName(other,"truesw")
	local entity_effect=clone Entitysword_effect;
	entity_effect.origin=other.GetOrigin();
	 others=g_ModeScript.CreateSingleSimpleEntityFromTable(entity_effect)
	 printl(others.GetName());
	 	DoEntFire("!self", "SetParent", "!activator", 0.1 ,other,others)
AddThinkToEnt(self,"t");
	}
	}
	function t(){

	local sb=null
	sb=Entities.FindByName(sb,"_4_svb")
//The targetname of entity spawned by script
	 local other=null;
	other=Entities.FindByName(other,"truesw")
printl(sb.GetOrigin());
printl(other.GetOrigin());
	}
	
	Entitysword_effect <-
{
    classname = "env_spritetrail"
	startwidth ="8.0"
	endwidth ="1.0"
	lifetime= "3"
	renderamt ="255"
	rendercolor= "0 48 96"
	rendermode ="5"
	spritename ="models/SS/sword_trail.vmt"
	targetname="svb"
	origin = Vector(0, 0, 0)

}
printl shows this entity indeed move with its parent. truesw is a prop_dynamic entity,whitch is moving .what the most strange is that i put a env_spritetrail by hammer it is work prefectly,but spawn by script with the same parameter it just does not work. Thank you
Xiaoer is offline
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 02-12-2020 , 08:01   Re: L4D2 vscript spawn env_spritetrail ,but it does not work
Reply With Quote #2

I'll to tried spawn env_spritetrail from VScript but only sprite color doesn't changed
Vit_amin is offline
Xiaoer
New Member
Join Date: Jul 2019
Old 02-12-2020 , 09:25   Re: L4D2 vscript spawn env_spritetrail ,but it does not work
Reply With Quote #3

Quote:
Originally Posted by Vit_amin View Post
I'll to tried spawn env_spritetrail from VScript but only sprite color doesn't changed
you mean...it works,just color is not right? why ...mine doesn't show trail at all...
Xiaoer is offline
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 02-12-2020 , 13:45   Re: L4D2 vscript spawn env_spritetrail ,but it does not work
Reply With Quote #4

Yes, but i using other code
Vit_amin is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 02-12-2020 , 15:51   Re: L4D2 vscript spawn env_spritetrail ,but it does not work
Reply With Quote #5

Try to convert it into a plugin, or is it mandatory to be a vscript?
__________________
Marttt is offline
Xiaoer
New Member
Join Date: Jul 2019
Old 02-12-2020 , 22:16   Re: L4D2 vscript spawn env_spritetrail ,but it does not work
Reply With Quote #6

Quote:
Originally Posted by Marttt View Post
Try to convert it into a plugin, or is it mandatory to be a vscript?
it is vscript in a mod,plugin can not Put in mod to use, it maybe a bug for vscript
Xiaoer is offline
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 02-13-2020 , 16:30   Re: L4D2 vscript spawn env_spritetrail ,but it does not work
Reply With Quote #7

Paste this to the end script
Code:
__CollectEventCallbacks(this, "OnGameEvent_", "GameEventCallbacks", RegisterScriptGameEventListener)
Vit_amin 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 00:48.


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