AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Off-Topic (https://forums.alliedmods.net/forumdisplay.php?f=15)
-   -   [L4D2] VScript help (https://forums.alliedmods.net/showthread.php?t=309062)

alcybery 07-12-2018 12:12

[L4D2] VScript help
 
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?

Visual77 07-15-2018 07:55

Re: [L4D2] VScript help
 
this doesn't per say need vscripts. just a findentitybyclassname loop on weapon_molotov_spawn and replace with said weapon. take a look at how the css weapon unlocker plugins do it.

alcybery 07-15-2018 19:48

Re: [L4D2] VScript help
 
Quote:

Originally Posted by Visual77 (Post 2603785)
this doesn't per say need vscripts. just a findentitybyclassname loop on weapon_molotov_spawn and replace with said weapon. take a look at how the css weapon unlocker plugins do it.

Thanks, looks like those plugins can be modified to do exactly what I want.

But now I'm just wondering what is the correct way to load vscripts? Because even if I load unmodified version, for example this file there are still errors:
Spoiler


All times are GMT -4. The time now is 19:10.

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