Raised This Month: $ Target: $400
 0% 

Solved [L4D2] env_spritetrail


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
000
Senior Member
Join Date: Jul 2022
Old 08-04-2022 , 06:46   [L4D2] env_spritetrail
Reply With Quote #1

Hi, I'd like to know how to fix env_spritetrail in L4D2.

I tested it by attaching it to func_rotating and the result is that it rotates once and then it disappears.

For CS:GO there was the same problem, which was fixed with [CS:GO] Spritetrail fix.

However, in L4D2 it is not working.
Is there a way at all?

Best regards.

Last edited by 000; 08-23-2022 at 10:15. Reason: fixed.
000 is offline
VladimirTk
Senior Member
Join Date: Apr 2021
Location: Perú - Latino América
Old 08-05-2022 , 00:50   Re: [L4D2] env_spritetrail
Reply With Quote #2

Quote:
Originally Posted by 000 View Post
Hi, I'd like to know how to fix env_spritetrail in L4D2.

I tested it by attaching it to func_rotating and the result is that it rotates once and then it disappears.

For CS:GO there was the same problem, which was fixed with [CS:GO] Spritetrail fix.

However, in L4D2 it is not working.
Is there a way at all?

Best regards.

Could you share the code snippet to help you better?
VladimirTk is offline
000
Senior Member
Join Date: Jul 2022
Old 08-05-2022 , 03:41   Re: [L4D2] env_spritetrail
Reply With Quote #3

Quote:
Originally Posted by VladimirTk View Post
Could you share the code snippet to help you better?
Hello.

Snippet:
Code:
#include <sourcemod>
#include <sdktools>

public void OnPluginStart()
{
	RegConsoleCmd("sm_test", test);
}

public Action test(int iClient, int iArgs)
{
	float fvec1[3];
	
	// We will attach entity to client.
	GetClientAbsOrigin(iClient, fvec1);
	
	// we customize vector.
	fvec1[2] += 50;
	
	// We create entity ev_spritetrail & func_rotating.
	int iEnt_1 = CreateEntityByName("func_rotating");
	int iEnt_2 = CreateEntityByName("env_spritetrail");
	
	// Attach to client/player.
	DispatchKeyValue(iClient, "targetname", "player");
	SetVariantString("player");
	AcceptEntityInput(iEnt_1, "SetParent");
	DispatchKeyValueVector(iEnt_1, "origin", fvec1);
	
	// Customize entity properties (of func_rotating).
	DispatchKeyValue(iEnt_1, "targetname", "trail1");
	DispatchKeyValue(iEnt_1, "renderfx", "5");
	DispatchKeyValue(iEnt_1, "rendermode", "5");
	DispatchKeyValue(iEnt_1, "renderamt", "255");
	DispatchKeyValue(iEnt_1, "rendercolor", "255 255 255"); 
	DispatchKeyValue(iEnt_1, "maxspeed", "300");
	DispatchKeyValue(iEnt_1, "friction", "20");
	DispatchKeyValue(iEnt_1, "dmg", "0");
	DispatchKeyValue(iEnt_1, "solid", "0");
	DispatchKeyValue(iEnt_1, "spawnflags", "64");
	
	// Spawn Entity (func_rotating).
	DispatchSpawn(iEnt_1);
	
	fvec1[0] += 35.0;
	
	// Set env_spritetrail origin is origin of GetClientAbsOrigin,
	// where AbsOrigin is fvec1[0] += 35.0. 
	DispatchKeyValueVector(iEnt_2, "origin", fvec1);
	
	// Customize entity properties (of env_spritetrail).
	DispatchKeyValue(iEnt_2, "lifetime", "1.0");
	DispatchKeyValue(iEnt_2, "startwidth", "5.0");
	DispatchKeyValue(iEnt_2, "endwidth", "1.0");
	DispatchKeyValue(iEnt_2, "spritename", "materials/sprites/laserbeam.vmt");
	DispatchKeyValue(iEnt_2, "rendermode", "5");
	DispatchKeyValue(iEnt_2, "rendercolor", "255 0 0");
	DispatchKeyValue(iEnt_2, "renderamt", "255");
	
	// Spawn Entity (env_spritetrail).
	DispatchSpawn(iEnt_2);
	
	// Attach env_spritetrail to func_rotating.
	SetVariantString("trail1");
	AcceptEntityInput(iEnt_2, "SetParent");
	
	// Start to show sprite in the world.
	AcceptEntityInput(iEnt_2, "ShowSprite");
	
	// Start rotating of func_rotating.
	AcceptEntityInput(iEnt_1, "Start");
	
	/*
	
	In CS:S it continues to rotate after circle finished.
	In CS:GO, like in L4D2, it does not.
	However, for CS:GO there was a fix made (plugin mentioned in thread).
	
	*/
	
	return Plugin_Handled;
}
Greetings.
Attached Files
File Type: sp Get Plugin or Get Source (test.sp - 27 views - 2.4 KB)

Last edited by 000; 08-23-2022 at 03:21.
000 is offline
000
Senior Member
Join Date: Jul 2022
Old 08-05-2022 , 14:01   Re: [L4D2] env_spritetrail
Reply With Quote #4

Quote:
Originally Posted by 000 View Post
Hello.

Snippet:
Code:
#include <sourcemod>
#include <sdktools>

public void OnPluginStart()
{
	RegConsoleCmd("sm_test", test);
}

public Action test(int iClient, int iArgs)
{
	float fvec1[3];
	
	// We will attach entity to client.
	GetClientAbsOrigin(iClient, fvec1);
	
	// we customize vector.
	fvec1[2] += 50;
	
	// We create entity ev_spritetrail & func_rotating.
	int iEnt_1 = CreateEntityByName("func_rotating");
	int iEnt_2 = CreateEntityByName("env_spritetrail");
	
	// Attach to client/player.
	DispatchKeyValue(iClient, "targetname", "player");
	SetVariantString("player");
	AcceptEntityInput(iEnt_1, "SetParent");
	DispatchKeyValueVector(iEnt_1, "origin", fvec1);
	
	// Customize entity properties (of func_rotating).
	DispatchKeyValue(iEnt_1, "targetname", "trail1");
	DispatchKeyValue(iEnt_1, "renderfx", "5");
	DispatchKeyValue(iEnt_1, "rendermode", "5");
	DispatchKeyValue(iEnt_1, "renderamt", "255");
	DispatchKeyValue(iEnt_1, "rendercolor", "255 255 255"); 
	DispatchKeyValue(iEnt_1, "maxspeed", "300");
	DispatchKeyValue(iEnt_1, "friction", "20");
	DispatchKeyValue(iEnt_1, "dmg", "0");
	DispatchKeyValue(iEnt_1, "solid", "0");
	DispatchKeyValue(iEnt_1, "spawnflags", "64");
	
	// Spawn Entity (func_rotating).
	DispatchSpawn(iEnt_1);
	
	fvec1[0] += 35.0;
	
	// Set env_spritetrail origin is origin of GetClientAbsOrigin,
	// where AbsOrigin is fvec1[0] += 35.0. 
	DispatchKeyValueVector(iEnt_2, "origin", fvec1);
	
	// Customize entity properties (of env_spritetrail).
	DispatchKeyValue(iEnt_2, "lifetime", "1.0");
	DispatchKeyValue(iEnt_2, "startwidth", "5.0");
	DispatchKeyValue(iEnt_2, "endwidth", "1.0");
	DispatchKeyValue(iEnt_2, "spritename", "materials/sprites/laserbeam.vmt");
	DispatchKeyValue(iEnt_2, "rendermode", "5");
	DispatchKeyValue(iEnt_2, "rendercolor", "255 0 0");
	DispatchKeyValue(iEnt_2, "renderamt", "255");
	
	// Spawn Entity (env_spritetrail).
	DispatchSpawn(iEnt_2);
	
	// Attach env_spritetrail to func_rotating.
	SetVariantString("trail1");
	AcceptEntityInput(iEnt_2, "SetParent");
	
	// Start to show sprite in the world.
	AcceptEntityInput(iEnt_2, "ShowSprite");
	
	// Start rotating of func_rotating.
	AcceptEntityInput(iEnt_1, "Start");
	
	/*
	
	In CS:S it continues to rotate after circle finished.
	In CS:GO, like in L4D2, it does not.
	However, for CS:GO there was a fix made (plugin mentioned in thread).
	
	*/
	
	return Plugin_Handled;
}
The main plugin will be released soon.
It will fully work in CS:S & CS:GO.
However, the exact (changed) same method(s) will be used.

The ideas was to fully support all SRCDS games which contain these 2 entities.

I think it would be fun for people to have.

However, I do not own all games, nor can I achieve everything.

Greetings.
Here is the whole thing:
https://forums.alliedmods.net/showth...55#post2785655

Last edited by 000; 08-23-2022 at 03:21.
000 is offline
000
Senior Member
Join Date: Jul 2022
Old 08-23-2022 , 10:15   Re: [L4D2] env_spritetrail
Reply With Quote #5

Fixed.

https://forums.alliedmods.net/showthread.php?t=339197
000 is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 08-23-2022 , 13:35   Re: [L4D2] env_spritetrail
Reply With Quote #6

Nice work, it's indeed working (L4D2), the only downside is that seems that the func_rotation is following the player angles, don't know if this is intended nor is possible to make it in a fixed pos.
__________________

Last edited by Marttt; 08-23-2022 at 13:35.
Marttt is offline
000
Senior Member
Join Date: Jul 2022
Old 08-23-2022 , 15:55   Re: [L4D2] env_spritetrail
Reply With Quote #7

Quote:
Originally Posted by Marttt View Post
Nice work, it's indeed working (L4D2), the only downside is that seems that the func_rotation is following the player angles, don't know if this is intended nor is possible to make it in a fixed pos.
Hi,

I think it is because env_spritetrail is set parent with func_rotating and func_rotating is set parent with client.

env_spritetrail's lifetime may causing it.

I have tested it with a 0.1 sec timer and used TeleportEntity to client instead of SetParent. It just fixed the issue with when client looks up/down that the entities will do the same.

I really don't know, and I am far from being an expert.

Do you have any ideas?

Last edited by 000; 08-23-2022 at 16:00.
000 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-24-2022 , 11:57   Re: [L4D2] env_spritetrail
Reply With Quote #8

https://developer.valvesoftware.com/...ing)#SetParent

Normally, you need little delay between SetParent -> SetParentAttachment (or SetParentAttachmentMaintainOffset)

Also, you need little delay when teleport entity to right place, before SetParent.

Use timers.
__________________
Do not Private Message @me
Bacardi is online now
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 08-24-2022 , 13:49   Re: [L4D2] env_spritetrail
Reply With Quote #9

The parenting actually works,
What I mean is that it follows the player's eyes' angles when it should be static.
I don't know going deep if when we attach it "chooses" the first attachment slot.
__________________
Marttt is offline
000
Senior Member
Join Date: Jul 2022
Old 08-24-2022 , 14:08   Re: [L4D2] env_spritetrail
Reply With Quote #10

So for as I understood the problem, it is about the trails "expand in lenght" when player is walking. For that i do not know how to solve (if it is even solveable).

Now, for the problem where the trails change their origin when the player is looking up/down, i dont know how to fix it without using a timer teleporting the entities every 0.1 seconds.

¯\_(ツ)_/¯
000 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 15:43.


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