Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
ange1u5

Question on mission start parameters and how to set it to enable/disable things...

Recommended Posts

So for my Highway Race mission (http://steamcommunity.com/sharedfiles/filedetails/?id=179806293) - which I hope some of you have played - there is civilian traffic I put all along the route. These are just simple vehicles I've plopped down in the editor and given them a series of waypoints along the road which they start driving to after players hit the appropriate triggers as they progress along the route.

So I'm wondering, can I set a startup parameter in the lobby to enable/disable all the civilian traffic I put in by putting in the appropriate code on the units, or does this require restructuring the entire traffic system I put in?

Any and all help appreciated :)

Share this post


Link to post
Share on other sites

What I would do is set all these vehicles with names and then after create a parameter for the mission like you want after this we would then go into description.ext and place

class Params
{
class CivTraffic
{
	title = "Civilian Traffic";
	values[] = {1,0};
	texts[] = {"On","Off"};
	default = 1;
};
};

and then in init.sqf

if (PARAM_CivTraffic == 0) then {
{ deleteVehicle _x; } forEach [Civ1,Civ2,Civ3]; //Assuming that Civ1 is a vehicle same goes for Civ2 and Civ3
};

Share this post


Link to post
Share on other sites

Sweet, I'll give this a shot and see how it goes. Many thanks for your help :)

---------- Post added at 13:00 ---------- Previous post was at 12:47 ----------

Hmm getting a crash each time I try to load my mission now. I do have other params here so its possible the code needs to be tweaked. This is why my description.ext current looks like:

I do have other params here so its possible the code needs to be tweaked. This is why my description.ext current looks like:

allowFunctionsRecompile = 1;

class Header
{
gameType = RC;
minPlayers = 2;
maxPlayers = 14;
};
respawnTemplates[] = {"MenuPosition"};
respawn = "BASE";
respawnDelay = 8;

class Params
{
       // paramsArray[0]
      class initialWeatherParam {
         title = "Starting Weather";
         values[] = {0,1,2,3,4};
         texts[] = {"Clear","Overcast","Rain","Fog","Random"};
         default = 4;
      };

 //paramsArray[0]
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};
texts[] = {"0000","0100","0200","0300","0400","0500","0600", "0700","0800","0900","1000","1100","1200","1300"," 1400","1500","1600","1700","1800","1900","2000","2100","2200","2300"};
default = 10;
};

};

Edited by ange1u5

Share this post


Link to post
Share on other sites

Got the crash to go away, but I can't get the parameter to show up :(

Share this post


Link to post
Share on other sites
Got the crash to go away, but I can't get the parameter to show up :(

Is it alright if you could send me a copy of the mission?

Also just discovered that the drivers don't get deleted so I would also add

{ deleteVehicle _x; } forEach [driver Civ1,Civ1,driver Civ2,Civ2,driver Civ3,Civ3];

Edited by Lala14

Share this post


Link to post
Share on other sites

Anyway found out the problem, your description.ext was poorly set-up, here is where the errors w

class Params
{
       // paramsArray[0]
      class initialWeatherParam {
         title = "Starting Weather";
         values[] = {0,1,2,3,4};
         texts[] = {"Clear","Overcast","Rain","Fog","Random"};
         default = 4;
      };

 //paramsArray[0]
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};
texts[] = {"0000","0100","0200","0300","0400","0500","0600", "0700","0800","0900","1000","1100","1200","1300"," 1400","1500","1600","1700","1800","1900","2000","2100","2200","2300"};
default = 10;
};

[color="#FF0000"]class Params 
{ [/color]
   class CivTraffic 
   { 
       title = "Civilian Traffic"; 
       values[] = {1,0}; 
       texts[] = {"On","Off"}; 
       default = 1; 
   }; 
};  

changes done

class Params
{
       // paramsArray[0]
      class initialWeatherParam {
         title = "Starting Weather";
         values[] = {0,1,2,3,4};
         texts[] = {"Clear","Overcast","Rain","Fog","Random"};
         default = 4;
      };

	//paramsArray[1]
	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};
		texts[] = {"0000","0100","0200","0300","0400","0500","0600", "0700","0800","0900","1000","1100","1200","1300"," 1400","1500","1600","1700","1800","1900","2000","2100","2200","2300"};
		default = 10;
	};

	//paramsArray[2]
	class CivTraffic 
	{ 
		title = "Civilian Traffic"; 
		values[] = {1,0}; 
		texts[] = {"On","Off"}; 
		default = 1; 
	}; 
};  

I also changed the init.sqf

[] execVM "player_markers.sqf";  
//waitUntil{scriptDone _h};
//[] execVM "timeskipaction.sqf";
[] execVM "checkpoints.sqf";
execVM "randomWeather2.sqf";

//Time of Day
skiptime (((paramsarray select 1) - daytime + 24) % 24);

//Civ Traffic
if ((paramsarray select 1) == 0) then { 
{ deleteVehicle _x; } forEach [driver Civ1,Civ1,driver Civ2,Civ2]; //changed to also delete the drivers so we dont have random civs running along the road
};  

EDIT FOR INIT.SQF

[] execVM "player_markers.sqf";  
//waitUntil{scriptDone _h};
//[] execVM "timeskipaction.sqf";
[] execVM "checkpoints.sqf";
execVM "randomWeather2.sqf";

//Time of Day
skiptime (((paramsarray select 1) - daytime + 24) % 24);

//Civ Traffic
if ((paramsarray select 2) == 0) then { 
{ 	deleteVehicle (driver _x);
	deleteVehicle _x; } forEach [Civ1,Civ2]; //changed to also auto delete the drivers so we dont have random civs running along the road
};  

Edited by Lala14

Share this post


Link to post
Share on other sites

Thats what happens when you have no effing idea what you're doing with code and just trying to piece it together from other peoples questions and attempts to do things :D

Your help is much appreciated. I'll implement this later and see how it goes :)

Share this post


Link to post
Share on other sites
Thats what happens when you have no effing idea what you're doing with code and just trying to piece it together from other peoples questions and attempts to do things :D

Your help is much appreciated. I'll implement this later and see how it goes :)

I was also thinking because of that repair since the default game only repairs you to about 50% I could create a script to allow it to go to 100% as long as you have a repair kit and there is a damaged vehicle nearby. I'll do that now actually, also about the respawn thing I was going to suggest for you to delete the players backpack because your backpack will just get dropped and not disappear.

EDIT in RespawnLoadout.sqf

add to just below removeallassigneditems _target;

add removeBackpack _target;

now to work on that repair thing

---------- Post added at 23:26 ---------- Previous post was at 22:23 ----------

that repair.sqf thing

RespawnLoadout.sqf

Repair.sqf is pretty neat currently, took me about 10 minutes to make

---------- Post added at 00:11 ---------- Previous post was at 23:26 ----------

Also another thing that I might suggest is locking the civ cars so that if there vehicle does get broken they do not get out and start roaming unless you would like that.

Edited by Lala14

Share this post


Link to post
Share on other sites

//Civ Traffic
if ((paramsarray select 1) == 0) then { 
{ deleteVehicle _x; } forEach [driver Civ1,Civ1,driver Civ2,Civ2]; //changed to also delete the drivers so we dont have random civs running along the road
};

If I might jump in on that with a little tipp:

Instead of putting the ((paramsarray select XY) == ABC) you should create one file for all your params (let's call it param_variables.sqf for now, that should be called first in the init.sqf/initPlayerLocal.sqf) that connects the params with global variables like that:

if ((paramsarray select 1) == 0) then {variable1 = false;};
if ((paramsarray select 1) == 1) then {variable1 = true;};

if ((paramsarray select 2) == 0) then {variable2 = 0;};
if ((paramsarray select 2) == 1) then {variable2 = 1;}
if ((paramsarray select 2) == 2) then {variable2 = 2;}

that way you can use the variables in your scripts instead of the whole ((paramsarray select XYZ) == ABC) which can become very annoying if you have to change the order of your params. With that you only have to change the order in the param_variables.sqf and are able to refer to the variables in the scripts like that:

if (variable1) then 
     {
         //execute your code for variable1 = true, eg. what would happen if (paramsarray select 1) == 1
     };
//or
if (variable2 == 2) then 
     {
         //execute your code for variable2 = 2, eg. what would happen if (paramsarray select 2) == 2
         //alternatively you can use the value of variable2 in your script.
     };

that little trick may spare you a lot of work later. ;)

Share this post


Link to post
Share on other sites

I'm curious, do you think that editing the loadout will stop this awful monster bug?

http://uploadpie.com/UvTa2

It seems to only happen when you have 2 or more players, some players will end up spawning with default loadout (including gun) but end up with these disturbing 'Thing' like character models :P Once you respawn, it switches to the basic loadout I put in place.

I appreciate the repair script, however I would prefer the cars stay somewhat damaged after a repair as I feel it adds to the dynamics of the race. I always did feel though the performance drop in the cars was TOO much once they were damaged, so maybe an in-between number say 75-80% repaired. Still puts them over 240km/h or more but loses out in the long straights.

I did think about locking civ cars, but I wanted as few restrictions as possible to facilitate emergent gameplay behaviour. Especially if other players decide to trash cars at checkpoints, getting into a civ car may be your only hope of staying in the race :D

Edited by ange1u5

Share this post


Link to post
Share on other sites
Sign in to follow this  

×