Jump to content
Sign in to follow this  
JacobJ

Class Parameter help needed

Recommended Posts

Hello all

In my init.sqf I have this:

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

//Til vejret
switch (paramsarray select 1) 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 Pre time
switch (paramsarray select 2) do {
 case 1: { gatedown setTriggerTimeout [1, 1, 1, true] };
 case 2: { gatedown setTriggerTimeout [1200, 1200, 1200, true] };
 case 3: { gatedown setTriggerTimeout [1800, 1800, 1800, true] };
 case 4: { gatedown setTriggerTimeout [2400, 2400, 2400, true] };
};

//Til timelimit
switch (paramsarray select 3) do {
 case 1: { cntdown setTriggerTimeout [99999, 99999, 99999, true] };
 case 2: { cntdown setTriggerTimeout [1200, 1200, 1200, true] };
 case 3: { cntdown setTriggerTimeout [1800, 1800, 1800, true] };
 case 4: { cntdown setTriggerTimeout [2400, 2400, 2400, true] };
};

//Til Pointsystem
switch (paramsarray select 4) do {
 case 1: { [] execVM "point.sqs"};
 case 2: {};
};

And in my description.ext I have this:

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 Weather 	{

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

class prepar	{

	title = "Preparation time";
	values[] = {1,2,3,4};
	default = 2;
	texts[] = {"none", "20min", "30min", "40min"};
	};

class cntdown	{

	title = "Time limit after gamestart";
	values[] = {1,2,3,4};
	default = 1;
	texts[] = {"none", "30min", "45min", "60min"};
	};

class pntsystem	{

	title = "Point-system";
	values[] = {1,2};
	default = 2;
	texts[] = {"On", "Off"};
	};

};

As you can see I have both a preparation time and a timelimit on the map.

How can I subtract the preparation time with the timelimit, so I get the correct timelimit after the game has started?

/Jacob

Share this post


Link to post
Share on other sites

Put the seconds straight into the desc.ext. That way you don't need switch-case, because the variable returned will have the correct time. After that it's a simple subtraction.

Share this post


Link to post
Share on other sites

Okay, I may sound newbiezz but could you explain it a bit more or give me an example?

Share this post


Link to post
Share on other sites

class prepar {
 title = "Preparation time";
 values[] = {0,1200,1800,2400};
 default = 1200;
 texts[] = {"none", "20min", "30min", "40min"};
};

_prepTime = paramsarray select 2;
gatedown setTriggerTimeout [_prepTime, _prepTime, _prepTime, true];

Share this post


Link to post
Share on other sites

Okay now I have another problem with this. I can get it all to work as it should, but I have another script I would like to override the time limit, but that I cant do somehow.

Here is the script I would like to override the cntdown triggers timeout.

Startgame.sqf:

if (alive gate) then {

	gate setPos [(getPos gate select 0),(getPos gate select 1),-10];

	deleteMarker "respawn_west";
	deleteMarker "respawn_east";

	warlord globalChat "MISSION BEGINS!";

	stang removeAction flash;

	deleteVehicle gatedown;

	cnttime = paramsarray select 3;
	cntdown setTriggerTimeout [cnttime, cnttime, cnttime, true];

};

Here is what I have in the init.sqf:

//Til Pre time
_prepTime = paramsarray select 2;
gatedown setTriggerTimeout [_prepTime, _prepTime, _prepTime, true];


//Til timelimit
cnttime = paramsarray select 3;
cntdown setTriggerTimeout [(_prepTime + cnttime), (_prepTime + cnttime), (_prepTime + cnttime), true];

It just won't let me override that time it gives in the ( )'s.

What could be wrong?

---------- Post added at 19:25 ---------- Previous post was at 18:39 ----------

I also have the problem, that my ammocrates give some weird numbers back after ive put them through this code:

In init.sqf:

//Til våben
switch (paramsarray select 5) do {
 case 1: {ammoinbox1 = [mhq1_ammobox,"all","all",FALSE,15,50,15] execVM "crateFiller.sqf"; ammoinbox2 = [mhq1_ammobox1,"all","all",FALSE,15,50,15] execVM "crateFiller.sqf"};
 case 2: {ammoinbox1 = [mhq1_ammobox,"all","all",FALSE,5,12,10] execVM "crateFiller.sqf"; ammoinbox2 = [mhq1_ammobox1,"all","all",FALSE,5,12,10] execVM "crateFiller.sqf"};
 case 3: {ammoinbox1 = [mhq1_ammobox,"all","all",FALSE,1,12,5] execVM "crateFiller.sqf"; ammoinbox2 = [mhq1_ammobox1,"all","all",FALSE,1,12,5] execVM "crateFiller.sqf"};
 case 4: {ammoinbox1 = [mhq1_ammobox,"all","all",true,99,99,99] execVM "crateFiller.sqf"; ammoinbox2 = [mhq1_ammobox1,"all","all",true,99,99,99] execVM "crateFiller.sqf"};
};

In description.ext:

class weapons 	{

	title = "Number of Weapons/magazines/equiptment";
	values[] = {1,2,3,4};
	default = 1;
	texts[] = {"15/50/15", "5/12/10", "1/12/5", "99/99/99"};
	};

It differs if I get the right number of weapons in the crate or if my testing parter gets the right number. If it doesnt give the right number it gives the defaultnumber 15/50/15 added with the number that isnt default.

So if I choose 1/12/5 I get 16/62/20. Where could the problem be?

Share this post


Link to post
Share on other sites

If it doesn't work with setTriggerTimeout, then just use global variables to save the right time in and in the trigger's condition do: this && time > YourTimeVar

Share this post


Link to post
Share on other sites

Do you have any idea, what the last issue could be caused by?

Share this post


Link to post
Share on other sites

What if you make only the server run it and put global versions of the command (addWeaponCargoGlobal etc) into the cratefiller?

Share this post


Link to post
Share on other sites

Okay I think ive got it solved, but I am waiting for my testing partner to come online to check it out with me. Ill report back if it works. Thank you 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  

×