Jump to content
Sign in to follow this  
falconx1

End mission variants for west and east depending on outcome?

Recommended Posts

I'm trying to figure out how i can have multiple mission ends based on the outcome. I don't know how to do it, but im gonna post how i think it works,I'm hoping someone can offer input. if im sorta doing it right etc

here goes...

should i config Description.ext with a few End classes?

Description.ext


///////////////////////////////////////////////////////////
class CfgDebriefing

{  
class End1
{
	title = "Mission Completed";
	subtitle = "";
	description = "Objective Secured.";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.0,0.3,0.6,1};
};



class End2
{
	title = "Mission Completed";
	subtitle = "";
	description = "All enemies have been killed.";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.0,0.3,0.6,1};
};
};
///////////////////////////////////////////////////////////

then call end1. and run checks on player sides sorta like this?

End1.sqf


if ((side player) == west)then {

hint "you lose";
//execute win function/screen etc?
};

if ((side player) == east)then {

hint "you win";
//execute lose function/screen etc?
};

Share this post


Link to post
Share on other sites

Little confused by what you're trying to do. If blufor wins that's kind of assumed that opfor lost, right?

Btw, you might wanna change the color in those so it reflect who won.

Blufor:

pictureColor[] = {0.0,0.3,0.6,1};

Opfor:

pictureColor[] = {0.5,0.0,0.0,1};

Share this post


Link to post
Share on other sites

but if blue wins and i show "end1" does the game auto make Opfor have a lose screen? or i have to code two different popup screens?

Share this post


Link to post
Share on other sites

Umm.. no, I guess not. Never considered a "you specifically lose" ending, but I never do much TvT. :)

if ((side player) == west)then {

hint "you lose";
//execute win function/screen etc?
["epicFail",false,true] call BIS_fnc_endMission;
};

if ((side player) == east)then {

hint "you win";
//execute lose function/screen etc?
["epicwin",true,true] call BIS_fnc_endMission;
};  

Then just declare epicwin and epicfail in your description.ext as you have end1 and end2

Share this post


Link to post
Share on other sites

does this look about right?

///////////////////////////////////////////////////////////
class CfgDebriefing

{  
class End1
{ //---blue first
	title = "Mission Complete";
	subtitle = "";
	description = "";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.0,0.3,0.6,1};
};

	class End2
{
	title = "Mission Failed";
	subtitle = "";
	description = "";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.0,0.3,0.6,1};
};

		class End3
{
	title = "Mission Complete";
	subtitle = "";
	description = "";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.5,0.0,0.0,1};
};

		class End4
{
	title = "Mission Failed";
	subtitle = "";
	description = "";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.5,0.0,0.0,1};
};

};
///////////////////////////////////////////////////////////



//--EndMission.sqf



//--End mission for all players when East Team is all dead

//--Declare East is Living
EastAlive = true;

while {EastAlive} do {
waitUntil {({(side _x) == east} count allUnits) == 0};

if ((side player) == West)then {

["End1",true,true] call BIS_fnc_endMission;

};

if ((side player) == east)then {

["End3",false,true] call BIS_fnc_endMission;

};

//--Declare East is Dead
EastAlive = false;

sleep 10;

};



Share this post


Link to post
Share on other sites

Funny I was wondering if the same thing was possible today, and I also thought about using the side player check, but things that use player seem to not work nicely on servers.

Share this post


Link to post
Share on other sites

i think it will work regarding player aspect it just might not be in sync with other players, but im thinking there is a better way to do it. just aint thought of it yet lol

i still don't know for certain if i just use this:

["End1",true,true] call BIS_fnc_endMission; //for West

if east gets a losing screen cuzz west won. and cant find documentation stating so

Edited by falconx1

Share this post


Link to post
Share on other sites

You need to use the BIS_fnc_endMission on each client. That's why I used different versions of it in my example above. :)

Share this post


Link to post
Share on other sites

Using BIS_fnc_MP, you can broadcast a function to players of specific side. Execute the following on server:

["EpicWin","BIS_fnc_endMission",west] call BIS_fnc_MP;
["EpicFail","BIS_fnc_endMission",east] call BIS_fnc_MP;

All BLUFOR players will receive "EpicWin" ending, while all OPFOR player will get "EpicFail". Modify sides and and ending names to fit your situation.

Share this post


Link to post
Share on other sites

I still can't get it to work on dedicated server here is how im calling it.

in a crates Init field on have this to add an action


this allowDamage false; this addAction [("<t color=""#FFFF66"">" + ("Secure Objective") + "</t>"),"SecureObjective2.sqf",[],1,false,true,"","_this distance _target < 2"];  

that action executes the script below

SecureObjective2.sqf

if (isServer) then {

//West wins. Objective Secure
["End6","BIS_fnc_endMission",east] call BIS_fnc_MP;
["End5","BIS_fnc_endMission",west] call BIS_fnc_MP;


};

Share this post


Link to post
Share on other sites

Your problem there is that addAction is local, meaning the SecureObjective2.sqf is run local to you, not the server. So you run it and see the isServer and you're not the server so it never runs.

What you'd wanna do is have the addAction set a variable and publicize it that say a trigger is looking for and have the trigger run the script.

Share this post


Link to post
Share on other sites

Just ran a test on the code below and it appears to work on preview, server, dedicated. I made no change to the crates Init field either.

I changed it to this, although it's not the best way because Opfor should not have the add action available to them to begin with lol

so i might start a early alpha tomorrow unless something else comes up.

what do you think i can do to resolve Opfor getting the add action?

crates Init field

this allowDamage false; this addAction [("<t color=""#FFFF66"">" + ("Secure Objective") + "</t>"),"SecureObjective.sqf",[],1,false,true,"","_this distance _target < 2"];

SecureObjective.sqf

//---------------------------------------------------

if ((side player) == west)then {

hint "Securing Objective...";
sleep 3;

hint "Objective Secure";

//---West wins. Objective Secure

["End6","BIS_fnc_endMission",east] call BIS_fnc_MP;
["End5","BIS_fnc_endMission",west] call BIS_fnc_MP;


};


  if ((side player) == east)then {

hint "you cant do that";

};



Edited by falconx1

Share this post


Link to post
Share on other sites
Just ran a test on the code below and it appears to work on preview, server, dedicated. I made no change to the crates Init field either.

I changed it to this, although it's not the best way because Opfor should not have the add action available to them to begin with lol

so i might start a early alpha tomorrow unless something else comes up.

what do you think i can do to resolve Opfor getting the add action?

crates Init field

SecureObjective.sqf

//---------------------------------------------------

if ((side player) == west)then {

hint "Securing Objective...";
sleep 3;

hint "Objective Secure";

//---West wins. Objective Secure

["End6","BIS_fnc_endMission",east] call BIS_fnc_MP;
["End5","BIS_fnc_endMission",west] call BIS_fnc_MP;


};


  if ((side player) == east)then {

hint "you cant do that";

};



You could create a trigger on the crate that checks for blufor present, say a 5m radius or less, and then wait until that trigger is activated before adding the action.

So how is this:

["End6","BIS_fnc_endMission",east] call BIS_fnc_MP;

linked to that actual ending information (whether its accomplished or failed etc.)?

Share this post


Link to post
Share on other sites

How have you got it set up to link the different mission endings to the BIS_fnc_MP calls falcon?

Share this post


Link to post
Share on other sites

in the objectives Init field in the editor is this:

this allowDamage false; this addAction [("<t color=""#FFFF66"">" + ("Secure Objective") + "</t>"),"SecureObjective.sqf",[],1,false,true,"","_this distance _target < 2"];  

description.ext

///////////////////////////////////////////////////////////
class CfgDebriefing
//--- Casualties endings // blue first
{  
class End1
{ 
	title = "Mission Complete";
	subtitle = "";
	description = "OPFOR have all been Eliminated.";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.0,0.3,0.6,1};
};

	class End2
{
	title = "Mission Failed";
	subtitle = "";
	description = "Your team has been Eliminated.";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.0,0.3,0.6,1};
};

	class End3
{
	title = "Mission Complete";
	subtitle = "";
	description = "BLUFOR have all been Eliminated.";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.5,0.0,0.0,1};
};

	class End4
{
	title = "Mission Failed";
	subtitle = "";
	description = "Your team has been Eliminated.";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.5,0.0,0.0,1};
};
//--- Objective endings // blue first

	class End5
{
	title = "Mission Complete";
	subtitle = "";
	description = "Objective Secured.";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.0,0.3,0.6,1};
};

	class End6
{
	title = "Mission Failed";
	subtitle = "";
	description = "BLUFOR has secured the objective.";
	pictureBackground = "";
	picture = "b_inf";
	pictureColor[] = {0.5,0.0,0.0,1};
};
};
///////////////////////////////////////////////////////////

SecureObjective.sqf


//---------------------------------------------------

if ((side player) == west)then {

hint "Securing Objective...";
sleep 3;

hint "Objective Secure";

//---West wins. Objective Secure

["End6","BIS_fnc_endMission",east] call BIS_fnc_MP;
["End5","BIS_fnc_endMission",west] call BIS_fnc_MP;


};


  if ((side player) == east)then {

hint "you cant do that"; ///was thinkbout adding code here to remove the action sice its executed on east only lol

};

---------- Post added at 05:37 AM ---------- Previous post was at 05:31 AM ----------

so far it all works as intended on server , preview and dedicated. the only bug i know of is East players gets the "secure objective" action added too. West is only supposed to be able to secure it

Share this post


Link to post
Share on other sites

I have managed to get this to work for East side but not for the Independent Side. It completely ignores what i have below.

I just did another test with changing GUER to west and placing a Blufor unit to kill the POW which triggers the

said script, that works fine too. So both East and West works, but GUER is ignored?!? Looks like I'm going to have to change all the Independent units over to Blufor now.

if ((side player) == GUER)then {

hint "You lose";

//execute win function/screen etc?

["EpicFail","BIS_fnc_endMission",GUER] call BIS_fnc_MP;

};

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  

×