View Single Post
Author Message
alcybery
Member
Join Date: Apr 2016
Old 07-12-2018 , 12:12   [L4D2] VScript help
Reply With Quote #1

I don't know if it's the correct place to post this, since it is not about sourcemod.
I'm trying to modify VScript to randomly replace weapon spawns, for example this should replace pistols with molotovs with 50% chance:
PHP Code:
weaponsToConvert =
    {
        
weapon_pistol =     "weapon_molotov_spawn"
    
}

    function 
ConvertWeaponSpawnclassname )
    {
        
local chance RandomInt(0100 )
        if( 
chance 50 )
        {
            if ( 
classname in weaponsToConvert )
            {
                return 
weaponsToConvert[classname];
            }
        }
        return 
0;
    } 
I added this to director_base.nut, packed this file in vpk with scripts\vscripts path.

final director_base.nut


This doesn't work, error log:
Spoiler


What am I doing wrong?
alcybery is offline