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

[L4D2] Hybrid SP-VScript to fix weapons and medkits for 5+ survivor


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Earendil
Senior Member
Join Date: Jan 2020
Location: Spain
Old 01-05-2020 , 08:28   [L4D2] Hybrid SP-VScript to fix weapons and medkits for 5+ survivor
Reply With Quote #1

Hello, this is my first post, and this is the first plugin that I made for Sourcemod, but relies on VScripts, and I would like to be 100% with Sourcemod. Its for a server with 12 survivors. I was looking for a plugin that allowed to increase the limit of 5 max weapon pickup and also give medkits to everyone without spawning too much, but I found nothing that matched what I wanted.

I found some plugins like https://forums.alliedmods.net/showthread.php?p=1254023 but that only decreases the max times a weapon can be picked (or removes it), it doesnt exceed the default 5 weapon limit.

Also I'm starting to learn about sourcepawn, I must admit im terrible in this, but I know a little about VScripts, so I make a plugin that relies in a VScript at the beggining of the game that changes the max weapon count from 5 to whatever I want, and also can make medkits in saferoom can be picked up the times I want to prevent spawning more entities, same with pain pills and adrenaline shots around the map.

To do this VScript changes the "count" keyvalue, its pretty simple by using "Addoutput" "count X", so I started making a basic code, it covers weapons, healthpacks, pills and adrenaline for now, basically with Sourcemod spanws a logic_relay wich holds a VScript wich is autoexec when entity spawns at the beggining of any round:
Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION		"0.1"

new entindex 				= -1;
new bool:g_weaponchanged	= false;

public Plugin myinfo =
{
	name = "Weapon Count Modifyer",
	author = "Eärendil",
	description = "Modify the number of times weapons can be picked before removing",
	version = PLUGIN_VERSION,
	url = "",
};

public void OnPluginStart()
{
	CreateConVar("l4d_wcm_version", PLUGIN_VERSION, "L4D Weapon Count Modifyer", FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
	HookEvent("round_end", Event_Round_End);
	HookEvent("player_spawn", Event_Player_Spawn);
}

public OnMapStart()
{
	g_weaponchanged = false;
}

public Event_Round_End(Handle:event, const String:name[], bool:dontBroadcast)
{
	g_weaponchanged = false;
}

public Event_Player_Spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	if (!g_weaponchanged)
	{
		spawn_script();
		g_weaponchanged = true;
	}
}
bool spawn_script()
{
	entindex = CreateEntityByName("logic_relay");
	if (entindex != -1)
	{
		DispatchKeyValue (entindex, "spawnflags", "0");
		DispatchKeyValue (entindex, "StartDisabled", "0");
		DispatchKeyValue (entindex, "targetname", "wcm_scrpitholder");
		DispatchKeyValue (entindex, "vscripts", "wcm_file");
		DispatchKeyValue (entindex, "thinkfunction", "WCM_Function");
	}
	DispatchSpawn(entindex);
}
wcm_file is this, at the end kills the logic relay to stop spamming the script, here is where weapon count is modifyed:
Code:
function WCM_Function()
{
	local i = null
	local g_weaponlist = ["weapon_spawn",
	"weapon_pistol_spawn",
	"weapon_pistol_magnum_spawn",
	"weapon_shotgun_chrome_spawn",
	"weapon_pumpshotgun_spawn",
	"weapon_smg_spawn",
	"weapon_smg_silenced_spawn",
	"weapon_rifle_spawn",
	"weapon_rifle_ak47_spawn",
	"weapon_rifle_desert_spawn",
	"weapon_hunting_rifle_spawn",
	"weapon_sniper_military_spawn"]
	foreach (k in g_weaponlist)
	{
		while (i = Entities.FindByClassname(i, k))
		{
			DoEntFire("!self", "AddOutput", "count 15", 0, i, i);
		}
	}
	while (i = Entities.FindByClassname (i, "weapon_first_aid_kit_spawn"))
	{
		DoEntFire("!self", "AddOutput", "count 3", 0, i, i);
	}
	while (i = Entities.FindByClassname (i, "weapon_pain_pills_spawn"))
	{
		DoEntFire("!self", "AddOutput", "count 2", 0, i, i);
	}
	while (i = Entities.FindByClassname (i, "weapon_adrenaline_spawn"))
	{
		DoEntFire("!self", "AddOutput", "count 2", 0, i, i);
	}
	while (i = Entities.FindByName (i, "wcm_scrpitholder"))
	{
		i.Kill();
	}
}
The problem I have here: If I want to change the max number of times a weapon/health item can be picked, I need to change the VScript, also VScripts reload on mapchange, so cannot modify in midgame. I would like to do it 100% coded in the .sp file. That would allow to create ConVars, to modify max pickups for every weapon/item, also I would make public for everyone. But as long as I'm learning I have almost no idea about SourcePawn language, so the question would be: How can I fire the "Addoutput" to change the keyuvalue with Sourcemod?

I attached all the files, if you want to test it in a server.
Also feel free to tell me if I made something weird or wrong in the code, im learning. Thanks!
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_wcm.sp - 256 views - 1.4 KB)
File Type: zip l4d2_wnc.zip (4.5 KB, 91 views)
Earendil is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-05-2020 , 10:48   Re: [L4D2] Hybrid SP-VScript to fix weapons and medkits for 5+ survivor
Reply With Quote #2

The SourceMod version of DoEntFire is AcceptEntityInput, but it is a lot simpler to set the count value directly.

If you look at a datamap dump for L4D2 (sm_dump_datamaps, it'll probably crash but hopefully after writing the file) you can see that the count key for CWeaponSpawn (which is what all those classnames you've listed are internally) is mapped to m_itemCount.

Code:
CWeaponSpawn - weapon_first_aid_kit_spawn
- m_weaponID (Save)(4 Bytes)
- m_itemCount (Save|Key)(4 Bytes) - count
- m_bActivateWhenAtRest (Save)(1 Bytes)
And you can set that with the SetEntProp function:
PHP Code:
int i = -1;
while ((
FindEntityByClassname(i"weapon_first_aid_kit_spawn")) != -1) {
    
SetEntProp(iProp_Datam_itemCount3);

__________________
asherkin is offline
Earendil
Senior Member
Join Date: Jan 2020
Location: Spain
Old 01-07-2020 , 06:49   Re: [L4D2] Hybrid SP-VScript to fix weapons and medkits for 5+ survivor
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
The SourceMod version of DoEntFire is AcceptEntityInput, but it is a lot simpler to set the count value directly.

If you look at a datamap dump for L4D2 (sm_dump_datamaps, it'll probably crash but hopefully after writing the file) you can see that the count key for CWeaponSpawn (which is what all those classnames you've listed are internally) is mapped to m_itemCount.

Code:
CWeaponSpawn - weapon_first_aid_kit_spawn
- m_weaponID (Save)(4 Bytes)
- m_itemCount (Save|Key)(4 Bytes) - count
- m_bActivateWhenAtRest (Save)(1 Bytes)
And you can set that with the SetEntProp function:
PHP Code:
int i = -1;
while ((
FindEntityByClassname(i"weapon_first_aid_kit_spawn")) != -1) {
    
SetEntProp(iProp_Datam_itemCount3);

Thanks!!! It seems to work, hat help me a lot, when done I will publish the addon. Maybe someone finds this useful.
Earendil is offline
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 01-08-2020 , 09:26   Re: [L4D2] Hybrid SP-VScript to fix weapons and medkits for 5+ survivor
Reply With Quote #4

Ah, I made my own plugin that spawns extra first aid kits for each survivor, but it seems you're beating me to it with adjusting the weapon count as well.

Here's the source code of my plugin:
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#pragma newdecls required
#pragma semicolon 1

#define PLUGIN_NAME_SHORT "First Aid Manager"
#define PLUGIN_NAME "[L4D2] First Aid Manager"
#define PLUGIN_AUTHOR "Shadowysn"
#define PLUGIN_DESC "Manage the amount of first aid kits spawned for survivors."
#define PLUGIN_VERSION "1.0.2"
#define PLUGIN_URL "tobeadded"

#define PLUGIN_TARGETNAME "f_aid_manager_plugin"

#define CFG "l4d_firstaid_manager"
#define MDL_FIRSTAID "models/w_models/weapons/w_eq_medkit.mdl"

ConVar version_cvar null;
//ConVar Manager_AllowOnInitialStart = null;
ConVar Manager_TimeLimit null;
ConVar Manager_Multiply null;
ConVar Manager_FinaleMultiply null;

//ConVar Manager_ManageType = null;
//ConVar Manager_FinaleManageType = null;

ConVar Manager_ForEachSurvivorOnSurvivor null;
ConVar Manager_ForEachSurvivorOnMedkit null;
ConVar Manager_ForEachMedkit null;

static 
int survivorCount 0;
//static bool mustSetCloneMedkit = false;
//static bool isCloneMedkit[2048] = false;
//static Handle registeredPositions[2048] = null;
static bool hasRoundEnded false;

public 
APLRes AskPluginLoad2(Handle myselfbool latechar[] errorint err_max)
{
    if(
GetEngineVersion() == Engine_Left4Dead2)
    {
        return 
APLRes_Success;
    }
    
strcopy(errorerr_max"Plugin only supports Left 4 Dead 2.");
    return 
APLRes_SilentFailure;
}

public 
Plugin myinfo 
{
    
name PLUGIN_NAME,
    
author PLUGIN_AUTHOR,
    
description PLUGIN_DESC,
    
version PLUGIN_VERSION,
    
url PLUGIN_URL
}

public 
void OnPluginStart()
{
    
char cvar_str[500];
    
Format(cvar_strsizeof(cvar_str), "%s plugin version."PLUGIN_NAME_SHORT);
    
version_cvar CreateConVar("sm_firstaid_manager"PLUGIN_VERSIONcvar_str0|FCVAR_NOTIFY|FCVAR_REPLICATED|FCVAR_DONTRECORD);
    if(
version_cvar != null)
        
SetConVarString(version_cvarPLUGIN_VERSION);
    
    
//Format(cvar_str, sizeof(cvar_str), "Should the %s plugin spawn medkits on initial map start?", PLUGIN_NAME_SHORT);
    //Manager_AllowOnInitialStart = CreateConVar("sm_faid_manager_start", "1.0", cvar_str, FCVAR_ARCHIVE, true, 0.0, true, 1.0);
    
    
Format(cvar_strsizeof(cvar_str), "The delay before the %s plugin registers survivors and spawns medkits."PLUGIN_NAME_SHORT);
    
Manager_TimeLimit CreateConVar("sm_faid_manager_delay""1.0"cvar_strFCVAR_ARCHIVEtrue0.5false100.0);
    
    
Format(cvar_strsizeof(cvar_str), "Excluding finales, the number for the %s plugin to multiply by."PLUGIN_NAME_SHORT);
    
Manager_Multiply CreateConVar("sm_faid_manager_multiply""1.0"cvar_strFCVAR_ARCHIVEtrue1.0false20.0);
    
    
Format(cvar_strsizeof(cvar_str), "For finales, the number for the %s plugin to multiply by."PLUGIN_NAME_SHORT);
    
Manager_FinaleMultiply CreateConVar("sm_faid_manager_multiply_finale""2.0"cvar_strFCVAR_ARCHIVEtrue1.0false20.0);
    
    
//char type_str[] = "0 = Spawn for each survivor, on survivor. 1 = Spawn for each survivor, on medkit spawns. 2 = Spawn for each medkit spawn. 3 = Spawn for each survivor, doubled on both survivor and medkit spawn.";
    //Format(cvar_str, sizeof(cvar_str), "Excluding finales, what type of spawning should the %s plugin use? %s", PLUGIN_NAME_SHORT, type_str);
    //Manager_ManageType = CreateConVar("sm_faid_manager_type", "0.0", cvar_str, FCVAR_ARCHIVE, true, 0.0, true, 3.0);
    
    //Format(cvar_str, sizeof(cvar_str), "For finales, what type of spawning should the %s plugin use? %s", PLUGIN_NAME_SHORT, type_str);
    //Manager_FinaleManageType = CreateConVar("sm_faid_manager_type_finale", "3.0", cvar_str, FCVAR_ARCHIVE, true, 0.0, true, 3.0);
    
    
char type_str[] = "0 = Don't enable. 1 = Enable, excluding finales. 2 = Enable, only finales. 3 = Enable for both.";
    
Format(cvar_strsizeof(cvar_str), "Toggle %s's 'Spawn for each survivor, on survivor' method. %s"PLUGIN_NAME_SHORTtype_str);
    
Manager_ForEachSurvivorOnSurvivor CreateConVar("sm_faid_manager_mode_1""3.0"cvar_strFCVAR_ARCHIVEtrue0.0true3.0);
    
Format(cvar_strsizeof(cvar_str), "Toggle %s's 'Spawn for each survivor, on medkit spawns' method. %s"PLUGIN_NAME_SHORTtype_str);
    
Manager_ForEachSurvivorOnMedkit CreateConVar("sm_faid_manager_mode_2""2.0"cvar_strFCVAR_ARCHIVEtrue0.0true3.0);
    
Format(cvar_strsizeof(cvar_str), "Toggle %s's 'Spawn for each medkit spawn' method. %s"PLUGIN_NAME_SHORTtype_str);
    
Manager_ForEachMedkit CreateConVar("sm_faid_manager_mode_3""0.0"cvar_strFCVAR_ARCHIVEtrue0.0true3.0);
    
    
//HookEvent("game_init", game_init, EventHookMode_PostNoCopy);
    
HookEvent("player_spawn"player_spawnEventHookMode_Post);
    
HookEvent("round_end"round_endEventHookMode_PostNoCopy);
    
    
AutoExecConfig(trueCFG);
}

public 
void OnMapStart()
{
    
//if (GetConVarBool(Manager_AllowOnInitialStart)) hasRoundEnded = true;
    
hasRoundEnded true;
    if (!
IsModelPrecached(MDL_FIRSTAID)) PrecacheModel(MDL_FIRSTAIDtrue);
}

public 
void player_spawn(Handle event, const char[] namebool dontBroadcast)
{
    
//PrintToServer("%s plugin detected event: %s", PLUGIN_NAME_SHORT, name);
    
if (!hasRoundEnded) return;
    
    
int clientID GetEventInt(event"userid");
    
int client GetClientOfUserId(clientID);
    if (!
IsValidClient(client) || !IsSurvivor(client)) return;
    
    
hasRoundEnded false;
    
    
ManageFirstAidFunction();
}

public 
void round_end(Handle event, const char[] namebool dontBroadcast)
{
    
//PrintToServer("%s plugin detected event: %s", PLUGIN_NAME_SHORT, name);
    
hasRoundEnded true;
}

bool IsValidClient(int clientbool replaycheck true)
{
    if (!
IsValidEntity(client)) return false;
    if (
client <= || client MaxClients) return false;
    if (!
IsClientInGame(client)) return false;
    
//if (GetEntProp(client, Prop_Send, "m_bIsCoaching")) return false;
    
if (replaycheck)
    {
        if (
IsClientSourceTV(client) || IsClientReplay(client)) return false;
    }
    return 
true;
}

bool IsSurvivor(int client)
{
    if (!
IsValidClient(client)) return false;
    if (
GetClientTeam(client) == 2) return true;
    return 
false;
}

void SpawnFirstAidKit(int entity)
{
    if (!
IsValidEntity(entity)) return;
    
float fPos[3];
    
float fAng[3];
    if (
IsValidClient(entity))
    {
        
GetClientAbsOrigin(entityfPos);
        
GetClientAbsAngles(entityfAng);
        
fPos[2] += 10;
    }
    else
    {
        
GetEntPropVector(entityProp_Send"m_vecOrigin"fPos);
        
GetEntPropVector(entityProp_Send"m_angRotation"fAng);
    }
    
    
int first_aid_kit CreateEntityByName("weapon_first_aid_kit_spawn");
    
TeleportEntity(first_aid_kitfPosfAngNULL_VECTOR);
    
DispatchKeyValue(first_aid_kit"model"MDL_FIRSTAID);
    
DispatchKeyValue(first_aid_kit"spawnflags""3");
    
DispatchSpawn(first_aid_kit);
    
ActivateEntity(first_aid_kit);
    
    
char name_str[64];
    
Format(name_strsizeof(name_str), "%s%i"PLUGIN_TARGETNAMEEntRefToEntIndex(first_aid_kit));
    
DispatchKeyValue(first_aid_kit"targetname"name_str);
    
    
//SetVariantString("weapon_first_aid_kit");
    /*DispatchKeyValue(first_aid_kit, "classname", "weapon_first_aid_kit"); // This will fill the edict slots with garbage and potentially crash the game
    SetVariantString("OnUser1 !self:AddOutput:classname weapon_first_aid_kit_spawn:0.5:1");
    AcceptEntityInput(first_aid_kit, "AddOutput");
    AcceptEntityInput(first_aid_kit, "FireUser1");*/
    
    //if (mustSetCloneMedkit)
    //{ isCloneMedkit[first_aid_kit] = true; }
}

void RegisterSurvivors()
{
    
survivorCount 0;
    for (
int client 1client <= MAXPLAYERSclient++) {
        if (!
IsValidClient(client)) continue;
        if (!
IsSurvivor(client)) continue;
        
survivorCount += 1;
    }
}

int GetFirstSurvivor()
{
    
int firstClient = -1;
    for (
int client 1client <= MAXPLAYERSclient++) {
        if (!
IsValidClient(client)) continue;
        if (!
IsSurvivor(client)) continue;
        if (!
IsValidClient(firstClient))
        { 
firstClient client; break; }
    }
    return 
firstClient;
}

void FirstAidAction(int special_Num 0int multi_Num 1)
{
    if (
special_Num == 2)
    {
        for (
int i = -1GetMaxEntities(); i++) 
        {
            if (!
IsValidEntity(i)) continue;
            
char class[64];
            
GetEntityClassname(i, class, sizeof(class));
            
char name_str[64];
            
GetEntPropString(iProp_Data"m_iName"name_strsizeof(name_str));
            if (!
StrEqual(class, "weapon_first_aid_kit_spawn") || StrContains(name_strPLUGIN_TARGETNAMEfalse) > -1) continue;
            
SpawnFirstAidKit(i);
        }
    }
    else if (
special_Num == 1)
    {
        
survivorCount -= 4;
        if (
multi_Num 1survivorCount *= multi_Num;
        
        for (
int i = -1GetMaxEntities(); i++) 
        {
            if (
survivorCount <= 0) break;
            if (!
IsValidEntity(i)) continue;
            
char class[64];
            
GetEntityClassname(i, class, sizeof(class));
            
char name_str[64];
            
GetEntPropString(iProp_Data"m_iName"name_strsizeof(name_str));
            if (!
StrEqual(class, "weapon_first_aid_kit_spawn") || StrContains(name_strPLUGIN_TARGETNAMEfalse) > -1) continue;
            
SpawnFirstAidKit(i);
            
survivorCount -= 1;
        }
        
        
//for (int i = 0; i < sizeof(isCloneMedkit); i++)
        //{ isCloneMedkit[i] = false; }
        //mustSetCloneMedkit = true;
        /*int base_Ent = FindEntityByClassname(-1, "weapon_first_aid_kit_spawn");
        for (int i = 4; i < (survivorCount*2); i++) 
        {
            if (IsValidEntity(base_Ent))
            {
                int temp = FindEntityByClassname(base_Ent, "weapon_first_aid_kit_spawn");
                if (!IsValidEntity(temp))
                { temp = FindEntityByClassname(-1, "weapon_first_aid_kit_spawn"); }
                //if (isCloneMedkit[temp])
                //{ temp = FindEntityByClassname(temp, "weapon_first_aid_kit_spawn"); }
                base_Ent = temp;
            }
            if (!IsValidEntity(base_Ent)) continue;
            SpawnFirstAidKit(base_Ent);
        }*/
        //mustSetCloneMedkit = false;
    
}
    else
    {
        
survivorCount -= 4;
        if (
multi_Num 1survivorCount *= multi_Num;
        
//PrintToServer("%i", survivorCount);
        
int entity GetFirstSurvivor();
        if (!
IsValidClient(entity) || !IsSurvivor(entity)) return;
        
        for (
int i 0survivorCounti++) 
        {
            
SpawnFirstAidKit(entity);
        }
    }
}

//void FirstAidManage(int client)
Action FirstAidManage(Handle timer)
{
    
RegisterSurvivors();
    if (
survivorCount <= 4) return;
    
int finale_ent FindEntityByClassname(-1"trigger_finale");
    
    
//int cvar_int = GetConVarInt(Manager_ManageType);
    //int finale_cvar_int = GetConVarInt(Manager_FinaleManageType);
    
int mode_1 GetConVarInt(Manager_ForEachSurvivorOnSurvivor);
    
int mode_2 GetConVarInt(Manager_ForEachSurvivorOnMedkit);
    
int mode_3 GetConVarInt(Manager_ForEachMedkit);
    
bool isFinale IsValidEntity(finale_ent);
    
//bool useSpecial_1 = (isFinale && finale_cvar_int >= 1) || (!isFinale && cvar_int >= 1);
    //bool useSpecial_2 = (isFinale && finale_cvar_int >= 2) || (!isFinale && cvar_int >= 2);
    //bool useSpecial_3 = (isFinale && finale_cvar_int >= 3) || (!isFinale && cvar_int >= 3);
    
bool useMode_1 = (mode_1 >= 3) || (isFinale && mode_1 == 2) || (!isFinale && mode_1 1);
    
bool useMode_2 = (mode_2 >= 3) || (isFinale && mode_2 == 2) || (!isFinale && mode_2 1);
    
bool useMode_3 = (mode_3 >= 3) || (isFinale && mode_3 == 2) || (!isFinale && mode_3 1);
    
int multi_Num RoundToFloor(isFinale GetConVarFloat(Manager_FinaleMultiply) : GetConVarFloat(Manager_Multiply));
    
    
//if (useSpecial_3)
    //{
    //    FirstAidAction(0, multi_Num);
    //    RegisterSurvivors();
    //    FirstAidAction(1, multi_Num);
    //}
    //else if (useSpecial_2)
    //{ FirstAidAction(2, multi_Num); }
    //else if (useSpecial_1)
    //{ FirstAidAction(1, multi_Num); }
    //else
    //{ FirstAidAction(0, multi_Num); }
    
    
if (useMode_1)
    { 
FirstAidAction(0multi_Num); }
    if (
useMode_2)
    { 
FirstAidAction(1multi_Num); }
    if (
useMode_3)
    { 
FirstAidAction(2multi_Num); }
    
    
//int first_aid_kit = GetNearestEntity(entity, "weapon_first_aid_kit_spawn");
    //if (!IsValidEntity(first_aid_kit)) return;
}

void ManageFirstAidFunction()
{
    if (
Manager_TimeLimit != null)
    {
        
float delay GetConVarFloat(Manager_TimeLimit);
        
CreateTimer(delayFirstAidManage);
    }
    else
    { 
CreateTimer(1.0FirstAidManage); }
}

/*int GetNearestEntity(int client, const char[] classname)
{
    //Get the first entity
    int nearestEntity = FindEntityByClassname(entity, classname);
    if (!IsValidEntity(nearestEntity))
    {
        return -1;
    }
    
    float clientVecOrigin[3], entityVecOrigin[3];
    GetEntPropVector(client, Prop_Data, "m_vecOrigin", clientVecOrigin);
    GetEntPropVector(nearestEntity, Prop_Data, "m_vecOrigin", entityVecOrigin);
    
    //Get the distance between the first entity and client
    float distance, nearestDistance = GetVectorDistance(clientVecOrigin, entityVecOrigin);
    
    //Find all the entity and compare the distances
    int entity = -1;
    while (entity = FindEntityByClassname(entity, classname) != -1)
    {
        GetEntPropVector(entity, Prop_Data, "m_vecOrigin", entityVecOrigin);
        distance = GetVectorDistance(clientVecOrigin, entityVecOrigin);
        
        if (distance < nearestDistance)
        {
            nearestEntity = entity;
            nearestDistance = distance;
        }
    }
    
    return nearestEntity;
}*/ 
__________________
ragdoll spam, that is all

Steam profile, where I game, obviously.
Youtube channel, where I do Stick Death Maze animations and some other stuff.
no plugin requests, sorry


My Plugins:
-search list-
Modified Plugins:
1 | 2 | 3 | 4
Shadowysn is offline
Earendil
Senior Member
Join Date: Jan 2020
Location: Spain
Old 01-09-2020 , 05:26   Re: [L4D2] Hybrid SP-VScript to fix weapons and medkits for 5+ survivor
Reply With Quote #5

Quote:
Originally Posted by Shadowysn View Post
Ah, I made my own plugin that spawns extra first aid kits for each survivor, but it seems you're beating me to it with adjusting the weapon count as well.
My idea is to edit the current ingame weapons without spawning any entity. By the way, I published the plugin: https://forums.alliedmods.net/showthread.php?t=320775

Right now the plugin has a limitation, when talking about medkits, it only removes/modifies the fixed medkits, basically because they are "weapon_first_aid_kit_spawn", but the random medkits around the map are not modified, that other kits are "weapon_first_aid_kit" and they dont have a "count" keyvalue to modify the amount of times can be picked before removing. Also I have an aditional problem with that, if I try to manipulate "weapon_first_aid_kit" I manipulate the medkits carried by survivors too. So, If I try to remove that random medkits around the map, survivors end with no medkits in their back, maybe there is a way to check if a medkit is being carried by a survivor or its free, or maybe is easier to remove the medkit and give to the survivor another one, and pretend nothing happened.

Another side effect its that the number of uses remaining on a first aid kit spawn is reseted on map change, obviuosly the game was intended to have 1 kit on each spawn, not multiple. When map changes all entities inside the saferoom are deleted (the times used and remaining uses too), a new medkit with only 1 use is spawned and then the plugin sets its use to the desired amount again, so at the end you have more medkits to use. Only if the medkit is picked enough times to dissapear before th emapchange it wont spawn when next map is loaded. Maybe I can make something to fix that, or maybe not, as long as my intention was to give medkit to everyone, giving a little more than intended on +5 survivor server would not affect too much.

Last edited by Earendil; 01-09-2020 at 05:53.
Earendil is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 01-09-2020 , 20:33   Re: [L4D2] Hybrid SP-VScript to fix weapons and medkits for 5+ survivor
Reply With Quote #6

You can make that changes through stripper too
Is not that flexible but also works.

Also a good addition would change the medkit cabinet as the following stripper example:

Spoiler


I know that "HealthCount" "4" works but dont know what happens with higher values.
__________________

Last edited by Marttt; 01-09-2020 at 20:34.
Marttt 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 13:14.


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