Jump to content
4-325Ranger

Help with making a Lobby Parameter to call a script or not

Recommended Posts

I'm trying to make a Lobby Parameter for a mission where the player can select to enable a script or not. It is set as disabled by default. The script is VCOMAI, I want the player/group to have the option of playing the mission on an easier vanilla setup and also be able to play the mission with a more challenging AI. I've tried a few things, but have not found anything definitive. I need to set up the parameter (class params?) and then set up the call for it (in the init.sqf?).

 

I came up with this, that I put in the description.ext:

class Params
{
    class VcomAI
    {
    //paramsArray[0]
        title="VcomAI";
        values[]={0,1};
        texts[]={"Disabled - meh","Enabled - Bring it on"};
        default=0;
    };
};

 

but couldn't figure out how to call it from the init.sqf. I'm sure the paramsArray[0] is wrong, but I was trying to follow an old older script - meh...

 

I also looked at a copy of Liberation, as they have several Lobby Parameters, however they are using some scripting that I don't quite follow with .hpp setups etc that are beyond me at this point.

 

Any suggestions?

 

Thanks!

Share this post


Link to post
Share on other sites
#define GVAR_PARAM(NUM)                          (paramsArray select NUM)
#define GVAR_ENABLEVCOM                          ([false,true] select GVAR_PARAM(0))

if (GVAR_ENABLEVCOM) then {0= [blah,blah] execVm "script"};

 

Share this post


Link to post
Share on other sites

Davidoss, thanks for checking in. I'm not 100% on what you posted.

 

So, keep this in the description.ext(?):

 

class Params
{
    class VcomAI
    {
           title="VcomAI";
        values[]={0,1};
        texts[]={"Disabled - meh","Enabled - Bring it on"};
        default=0;
    };
};

 

Then add:

#define GVAR_PARAM(NUM)                            (paramsArray select NUM)

#define GVAR_ENABLEVCOM                           ([false,true] select GVAR_PARAM(0))

 

What value is "NUM" in define GVAR_PARAM(NUM) and (paramsArray select NUM) ? are they both 0?

 

 

Place this in the init.sqf(?):
 

if (GVAR_ENABLEVCOM) then {0= [blah,blah] execVm "script"};

 

What is [blah,blah]? I would think I would want only the true version of the variable passed, but I really don't know?

 

Could you break (dumb) it down a bit more?

 

Thanks!

 

 

 

Share this post


Link to post
Share on other sites

 

9 hours ago, 4-325Ranger said:

I came up with this, that I put in the description.ext:

class Params
{
    class VcomAI
    {
    //paramsArray[0]
        title="VcomAI";
        values[]={0,1};
        texts[]={"Disabled - meh","Enabled - Bring it on"};
        default=0;
    };
};

 

but couldn't figure out how to call it from the init.sqf.

Just answered your question but nvm here you have a hand:

 

description.ext

class Params
{
    class VcomAI
    {	
	//GVAR_PARAM(0)
        title="VcomAI";
        values[]={0,1};
        texts[]={"Disabled - meh","Enabled - Bring it on"};
        default=0;
    };
}; 

 init.sqf

//define macros at begin the init.sqf    https://community.bistudio.com/wiki/PreProcessor_Commands 
#define GVAR_PARAM(NUM)                          (paramsArray select NUM)
#define GVAR_ENABLEVCOM                          ([false,true] select GVAR_PARAM(0))



//somewhere in init.sqf
if (GVAR_ENABLEVCOM) then {0 = [] execVM "VCOMAI\init.sqf"};

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×