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

[l4d2] painter!! (version: 2.1)


Post New Thread Reply   
 
Thread Tools Display Modes
Toranks
Senior Member
Join Date: Dec 2021
Location: Spain
Old 05-11-2022 , 11:27   Re: [l4d2] painter!! (version: 2.1)
Reply With Quote #81

It is possible to add a random color option on every special spawn with not so much changes to the code?
I use this small code to change Spitter and Jockey to a random color in a range where it still looks attractive and not saturated. Each SI spawned has a different color -even fitting with dead body color-, which makes the game much more varied and allows you to identify any special even if have the same model. It has many advantages for me.
However, this method does NOT work on specials other than Jockey, Spitter and Tank, nothing else. I don't know how to do it on other SI, and the code for this plugin is too complex for my skills.

Code:
public OnPluginStart() 
{ 
	HookEvent("player_spawn", PlayerSpawn_Event);
}

public PlayerSpawn_Event(Handle:event, const String:name[], bool:dontBroadcast) 
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
	if (client <= 0 || client > MaxClients || !IsClientInGame(client) || GetClientTeam(client) != 3) {
		return
	}
    
	new class = GetEntProp(client, Prop_Send, "m_zombieClass");

	if (class == ZOMBIECLASS_SPITTER)
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
	else if (class == ZOMBIECLASS_JOCKEY) 
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
}
Toranks is offline
weffer
Member
Join Date: Oct 2020
Old 05-11-2022 , 11:57   Re: [l4d2] painter!! (version: 2.1)
Reply With Quote #82

Quote:
Originally Posted by Toranks View Post
It is possible to add a random color option on every special spawn with not so much changes to the code?
I use this small code to change Spitter and Jockey to a random color in a range where it still looks attractive and not saturated. Each SI spawned has a different color -even fitting with dead body color-, which makes the game much more varied and allows you to identify any special even if have the same model. It has many advantages for me.
However, this method does NOT work on specials other than Jockey, Spitter and Tank, nothing else. I don't know how to do it on other SI, and the code for this plugin is too complex for my skills.

Code:
public OnPluginStart() 
{ 
	HookEvent("player_spawn", PlayerSpawn_Event);
}

public PlayerSpawn_Event(Handle:event, const String:name[], bool:dontBroadcast) 
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
	if (client <= 0 || client > MaxClients || !IsClientInGame(client) || GetClientTeam(client) != 3) {
		return
	}
    
	new class = GetEntProp(client, Prop_Send, "m_zombieClass");

	if (class == ZOMBIECLASS_SPITTER)
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
	else if (class == ZOMBIECLASS_JOCKEY) 
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
}
just add more conditions
Code:
public OnPluginStart() 
{ 
	HookEvent("player_spawn", PlayerSpawn_Event);
}

public PlayerSpawn_Event(Handle:event, const String:name[], bool:dontBroadcast) 
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
	if (client <= 0 || client > MaxClients || !IsClientInGame(client) || GetClientTeam(client) != 3) {
		return
	}
    
	new class = GetEntProp(client, Prop_Send, "m_zombieClass");

	if (class == ZOMBIECLASS_SPITTER)
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
	else if (class == ZOMBIECLASS_JOCKEY) 
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
        else if (class == ZOMBIECLASS_BOOMER) 
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
        else if (class == ZOMBIECLASS_CHARGER) 
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
        else if (class == ZOMBIECLASS_HUNTER) 
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
}
weffer is offline
Toranks
Senior Member
Join Date: Dec 2021
Location: Spain
Old 05-11-2022 , 12:00   Re: [l4d2] painter!! (version: 2.1)
Reply With Quote #83

Quote:
Originally Posted by weffer View Post
just add more conditions
Code:
public OnPluginStart() 
{ 
	HookEvent("player_spawn", PlayerSpawn_Event);
}

public PlayerSpawn_Event(Handle:event, const String:name[], bool:dontBroadcast) 
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
	if (client <= 0 || client > MaxClients || !IsClientInGame(client) || GetClientTeam(client) != 3) {
		return
	}
    
	new class = GetEntProp(client, Prop_Send, "m_zombieClass");

	if (class == ZOMBIECLASS_SPITTER)
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
	else if (class == ZOMBIECLASS_JOCKEY) 
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
        else if (class == ZOMBIECLASS_BOOMER) 
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
        else if (class == ZOMBIECLASS_CHARGER) 
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
        else if (class == ZOMBIECLASS_HUNTER) 
	{
			SetEntityRenderColor(client, GetRandomInt(155, 255), GetRandomInt(155, 255), GetRandomInt(155, 255), 255);
	}
}
I know, I did that a while ago and it didn't work. You can see more details on this thread:
https://forums.alliedmods.net/showthread.php?t=294293
This painter plugin uses a different method that I don't know how to read and snip.

Last edited by Toranks; 05-11-2022 at 12:01.
Toranks is offline
Toranks
Senior Member
Join Date: Dec 2021
Location: Spain
Old 05-11-2022 , 12:31   Re: [l4d2] painter!! (version: 2.1)
Reply With Quote #84

Here I learned to adapt the code to Spitter and Jockey, and discussion of why it doesn't work on others SI

https://forums.alliedmods.net/showthread.php?t=261374
Toranks is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 05-11-2022 , 20:48   Re: [l4d2] painter!! (version: 2.1)
Reply With Quote #85

Some SI can't be recolored (until the next TLS update) because the model doesn't allow it.

Some workshop add-ons related:


I won't explain exactly what setting prevents that, but opening and comparting the addon .vpk should give you some info.
__________________

Last edited by Marttt; 05-11-2022 at 20:48.
Marttt is offline
Toranks
Senior Member
Join Date: Dec 2021
Location: Spain
Old 05-12-2022 , 01:39   Re: [l4d2] painter!! (version: 2.1)
Reply With Quote #86

Quote:
Originally Posted by Marttt View Post
Some SI can't be recolored (until the next TLS update) because the model doesn't allow it.

Some workshop add-ons related:

I won't explain exactly what setting prevents that, but opening and comparting the addon .vpk should give you some info.


Thanks!! Now work for me! I have updated the small plugin that I used to randomize the colors:

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

Last edited by Toranks; 05-12-2022 at 14:48.
Toranks is offline
valedar
Member
Join Date: May 2022
Location: Russian
Old 05-12-2022 , 09:03   Re: [l4d2] painter!! (version: 2.1)
Reply With Quote #87

Removed hunter and changer to prevent bugs in logs
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_painter.sp - 70 views - 11.0 KB)
valedar is offline
sourcemoduser02
New Member
Join Date: Apr 2022
Old 06-05-2022 , 01:57   Re: [l4d2] painter!! (version: 2.1)
Reply With Quote #88

hello, i am asking if is it possible to save your body paint (example: red) when you leave the game and enter back, if so then how?
sourcemoduser02 is offline
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 03:18.


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