Jump to content
Sign in to follow this  
JacobJ

Lobby parameters - help needed

Recommended Posts

Hey all

I have some scripts in my init.sqf that runs when the game is startet. Those scripts are started like this: [10, _markers] execVM "cars.sqf";

Lets say I want to be able to change that first variable, from 10 to lets say 20 in the lobby parameters (don't know what it is called correctly, but you know when you start up a multiplayer game and then select what time you want the mission to run at). How can I do that? It would make the mission a lot more user friendly, because they could change the number of cars, enemies and stuff like that.

In my init.sqf I already have these parameters:

//LOBBY PARAMETERS

waitUntil {!(isNil "Paramsarray")};

//Til tiden
skiptime (((paramsarray select 0) - daytime + 24) % 24);

//Til vejret
switch (paramsarray select 2) do {
 case 1: { 0 setOvercast 0; 0 setRain 0; 0 setFog 0 };
 case 2: { 0 setOvercast 1; 0 setRain 1; 0 setFog 0.2 };
 case 3: { 0 setOvercast 0.7; 0 setRain 0; 0 setFog 0 };
 case 4: { 0 setOvercast 0.7; 0 setRain 1; 0 setFog 0.7 };
};

//Til PMC captive
switch (paramsarray select 3) do {
 case 1: {[] execVM "PMCcaptive.sqf"};
 case 2: {};
};

And acordingly in my description.ext:

class Params {

class TimeOfDay {
	title = "Time of day:";
	values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
	default = 12; 
	texts[] = {"00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"};
	};

class Revive
       {
	// paramsArray[1]
               title = "Number of Revives:";
               values[] = {2000,1000,20,10,7,5};
               texts[] = {"No Revive","Infinite - Cadet","20 - Easy ","10 - Normal","7  - Hard","5  - Extreme"};
               default = 10;
       };

class Weather 	{

	title = "Weather";
	values[] = {1,2,3,4};
	default = 1;
	texts[] = {"Clear", "Stormy", "Cloudy", "Foggy"};
	};

class Captive 	{

	title = "Captive inside PMC";
	values[] = {1,2};
	default = 1;
	texts[] = {"Yes", "No"};
	};


};

/Jacob

Share this post


Link to post
Share on other sites

I don't really get what you mean. You ask how to implement params in a multiplayer mission, but at the same time you answer your own question by posting how it is done.

So add a new Params class in description.ext, and read it using paramsArray in init.sqf.

description.ext:

class Cars
       {
	// paramsArray[4]
               title = "Number of cars:";
               values[] = {10,20};
               texts[] = {"Ten cars","Twenty cars"};
               default = 10;
       };

init.sqf:

[paramsArray select 4, _markers] execVM "cars.sqf";

Share this post


Link to post
Share on other sites

Okay cool. I surely don't understand all of scripting and thats why I posted this. Didnt know that it could be done so easily. I will try this out and see how it works. Thank you for your help so far.

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
Sign in to follow this  

×