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

Solved [L4D2] Is it possible to set this value for specified group only?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kot4404
Senior Member
Join Date: Mar 2013
Old 01-30-2018 , 11:35   [L4D2] Is it possible to set this value for specified group only?
Reply With Quote #1

I would like to set the z_charge_duration longer for specified players and https://forums.alliedmods.net/showthread.php?p=2043735 method doesn't work, value is set to 30 but players still stop charging after the default 2.5 seconds. So is there way I could achieve this effect?

Last edited by kot4404; 01-31-2018 at 18:10.
kot4404 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 01-30-2018 , 12:05   Re: [L4D2] Is it possible to set this value for specified group only?
Reply With Quote #2

Quote:
Originally Posted by kot4404 View Post
I would like to set the z_charge_duration longer for specified players and https://forums.alliedmods.net/showthread.php?p=2043735 method doesn't work, value is set to 30 but players still stop charging after the default 2.5 seconds. So is there way I could achieve this effect?
If you're sure that you filled all instructions right, try to hook charger_charge_start on EventHookMode_Pre and send the con var value there for all players, if it doesn't work then activate the big guns and change the actual cvar with SetConVarFloat every charger_charge_start ( pre of course )
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 01-31-2018 , 00:33   Re: [L4D2] Is it possible to set this value for specified group only?
Reply With Quote #3

Actually, you can just put this in your server.cfg to avoid hassles.
PHP Code:
//Your server's cvars here

sm_cvar "z_charge_duration" "<time/duration that you want>" 
cravenge is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 01-31-2018 , 16:59   Re: [L4D2] Is it possible to set this value for specified group only?
Reply With Quote #4

Quote:
Originally Posted by cravenge View Post
Actually, you can just put this in your server.cfg to avoid hassles.
PHP Code:
//Your server's cvars here

sm_cvar "z_charge_duration" "<time/duration that you want>" 
Quote:
For specified players
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
kot4404
Senior Member
Join Date: Mar 2013
Old 01-31-2018 , 18:09   Re: [L4D2] Is it possible to set this value for specified group only?
Reply With Quote #5

I managed to set the cvar when the specified players start charging and reset it when they die or another player starts charging, not the best way but the only possible I guess, ty eyal
kot4404 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 02-01-2018 , 05:26   Re: [L4D2] Is it possible to set this value for specified group only?
Reply With Quote #6

Quote:
Originally Posted by kot4404 View Post
I managed to set the cvar when the specified players start charging and reset it when they die or another player starts charging, not the best way but the only possible I guess, ty eyal
Have you attempted SendConVarValue when a player starts charging?
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
kot4404
Senior Member
Join Date: Mar 2013
Old 02-01-2018 , 06:12   Re: [L4D2] Is it possible to set this value for specified group only?
Reply With Quote #7

I tried to do it with prehook, it changes the value to 30 but you still stop after the default 2.5 seconds it is only global cvar I guess
kot4404 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 02-01-2018 , 10:41   Re: [L4D2] Is it possible to set this value for specified group only?
Reply With Quote #8

Quote:
Originally Posted by kot4404 View Post
I tried to do it with prehook, it changes the value to 30 but you still stop after the default 2.5 seconds it is only global cvar I guess
Okay then, if you change the cvar to all players, it will never be bugged.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 02-01-2018 , 11:19   Re: [L4D2] Is it possible to set this value for specified group only?
Reply With Quote #9

It is possible using the Prop m_chargeStartTime on the charger ability entity:

PHP Code:
ability GetEntPropEnt(chargerProp_Send"m_customAbility");
if(
IsValidEntity(ability))
{
    
SetEntPropFloat(abilityProp_Send"m_chargeStartTime"GetGameTime());

You basically have to reset the start time (with a timer for example) until you want them to stop. But you have to calculate in the 2.5 seconds (or what ever cvar value you use).

For example if you want to let a charger charge for 10 seconds you have to keep resetting it for 7.5 seconds because after the 7.5 seconds the normal 2.5 seconds start so we end up at 10 seconds.
Though there CAN and probably WILL be issues if you try to charge from a very close range.
Thats because how valve has changed the code where you as charger just stagger instead of charging through a survivor.

This could especially happen if you have more than 4 survivors. As the game keeps track who was recently hit by which charger or if they were hit at all recently with the charge ability
xerox8521 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 02-01-2018 , 11:51   Re: [L4D2] Is it possible to set this value for specified group only?
Reply With Quote #10

I have a solution but it has a bit annoying condition.

Solution:
PHP Code:
    HookEvent("charger_charge_start"Event_ChargeEventHookMode_Post);
}

public 
Action:Event_Charge(Handle:hEvent, const String:Name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(hEvent"userid"));
    
    
RequestFrame(Testclient);
}

public 
Test(client)
{
    new 
ability GetEntPropEnt(clientProp_Send"m_customAbility");
    
    new 
Float:Duration 5.0;

    if(
IsValidEntity(ability))
        
SetEntPropFloat(abilityProp_Send"m_chargeStartTime"GetGameTime() - GetConVarFloat(FindConVar("z_charge_duration")) + Duration);

Condition: z_charge_duration must be higher than the float Duration in the code. Basically if you hook the change of z_charge_duration and whenever it changes you set it to 1000 or something and cache the change to set as the duration, you now have the ability to affect the duration.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 02-01-2018 at 12:00.
eyal282 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 08:46.


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