Raised This Month: $170 Target: $400
 42% 

[L4D2] VScript help


Post New Thread Reply   
 
Thread Tools Display Modes
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
Visual77
Veteran Member
Join Date: Jan 2009
Old 07-15-2018 , 07:55   Re: [L4D2] VScript help
Reply With Quote #2

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.

Last edited by Visual77; 07-15-2018 at 07:55.
Visual77 is offline
alcybery
Member
Join Date: Apr 2016
Old 07-15-2018 , 19:48   Re: [L4D2] VScript help
Reply With Quote #3

Quote:
Originally Posted by Visual77 View Post
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
alcybery 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 11:31.


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