Jump to content
Sign in to follow this  
azams

[ASK] End by score - TDM

Recommended Posts

Hi all,

I got some problem here when making TDM mission.

I tested the score and it works fine by :

hint format["Score : %1", _scoreWest];

but when i tried to end it by using this code :

if ( _scoreWest >= _limitScore ) then {
  endMission "END1";
}

it doesnt work like the logic.

is there something missing on my code?

here is my parameter in description.ext :

class Params
{
class _limitScore
{
	title = "Score limit:";
	values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 250, 300, 400, 500};
	texts[] = {"Unlimited", "1 point", "2 points", "3 points", "4 points", "5 points", "6 points", "7 points", "8 points", "9 points", "10 points", "15 points", "20 points", "25 points", "30 points", "40 points", "50 points", "60 points", "70 points", "80 points", "90 points", "100 points", "150 points", "200 points", "250 points", "300 points", "400 points", "500 points"};
	default = 10;
};
};

I already tried using trigger and it doesnt work.

Any help would be great.

Thank you.

Share this post


Link to post
Share on other sites

You should check out the BIKI for endMission in MP:

To end mission properly so that everyone goes to debriefing at the same time, this command should be executed on every machine.

The arguments and effect is local, so you will need to use publicVariable or BIS_fnc_MP to send the mission status to all players in order to end the mission.

I don't really understand the correct way to do this (as I have little experience in MP scripting thus far), but it's likely to be one of the two (PV/BIS_fnc_MP) as they are the primary ways of sharing information between server and clients.

Share this post


Link to post
Share on other sites

Something like this, using the new BIS_fnc_endMission function..

if (_scoreWest >= _limitScore ) then {
//west won, show end1 with closing shot, called on all west players via BIS_fnc_MP
[["end1",true,true],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
//east failed, show end2 fade to black, called on all east players via BIS_fnc_MP
[["end2",true,5],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
};
if (_scoreEast >= _limitScore ) then {
//east won, show end1 with closing shot, called on all east players via BIS_fnc_MP
[["end1",true,true],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
//west failed, show end2 fade to black, called on all west players via BIS_fnc_MP
[["end2",true,5],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
};

And an example debriefing for description.ext...

class CfgDebriefing
{  
class End1
{
	title = "You Won!";
	subtitle = "";
	description = "You successfully defeated the opposing team.";
};
class End2
{
	title = "You Lost!";
	subtitle = "";
	description = "You where defeated by the opposing team.";
};
};

Untested but looks about right

Share this post


Link to post
Share on other sites

Here's how I end a mission via score. Hope it helps. Assuming the score is the only parameter defined in the description.ext (paramsArray select 0).

If ((_scoreWest >= (paramsArray select 0)) || (_scoreEast >= (paramsArray select 0))) Then {

   If (_scoreWest >= (paramsArray select 0)) Then {
      W_Wins=true;
      PublicVariable "W_Wins";
    // -- Broadcast message with bis_fnc_mp (WEST WINS!!!! etc etc) -- //
   } Else {
      E_Wins=True;
      PublicVariable "E_Wins";
   // -- Broadcast message with bis_fnc_mp (EAST WINS!!!! etc etc) -- //
   }; 

};

trigger;

timeout: 5

End#1

condition: W_Wins || E_Wins

Activation: ForceEnd

---------- Post added at 18:35 ---------- Previous post was at 18:15 ----------

Edited typo in condition. added _scoreEast instead of having 2 _scoreWest's. :p

Edited by Iceman77

Share this post


Link to post
Share on other sites
You should check out the BIKI for endMission in MP:

The arguments and effect is local, so you will need to use publicVariable or BIS_fnc_MP to send the mission status to all players in order to end the mission.

I don't really understand the correct way to do this (as I have little experience in MP scripting thus far), but it's likely to be one of the two (PV/BIS_fnc_MP) as they are the primary ways of sharing information between server and clients.

I thought endMission can be used both in MP and SP. Thank you, Das Attorney & Larrow.

---------- Post added at 11:37 ---------- Previous post was at 11:35 ----------

Here's how I end a mission via score. Hope it helps. Assuming the score is the only parameter defined in the description.ext (paramsArray select 0).

If ((_scoreWest >= (paramsArray select 0)) || (_scoreEast >= (paramsArray select 0))) Then {

   If (_scoreWest >= (paramsArray select 0)) Then {
      W_Wins=true;
      PublicVariable "W_Wins";
    // -- Broadcast message with bis_fnc_mp (WEST WINS!!!! etc etc) -- //
   } Else {
      E_Wins=True;
      PublicVariable "E_Wins";
   // -- Broadcast message with bis_fnc_mp (EAST WINS!!!! etc etc) -- //
   }; 

};

trigger;

timeout: 5

End#1

condition: W_Wins || E_Wins

Activation: ForceEnd

---------- Post added at 18:35 ---------- Previous post was at 18:15 ----------

Edited typo in condition. added _scoreEast instead of having 2 _scoreWest's. :p

WOW!! you solved my problem Iceman77. didnt realize that params will be come as array.

Thank you. You're the man!

Share this post


Link to post
Share on other sites
WOW!! you solved my problem Iceman77. didnt realize that params will be come as array.

Thank you. You're the man!

Glad I could help. I would combine paramsArray with Larrow's method. I still do things the old way(s), but Larrow's example is much more streamlined.

Share this post


Link to post
Share on other sites

I need help !

I'm doing a TDM in ARMA 3. but it does not work the php code. the mission does not end.

IN description.etc

class Params
{
class _limitScore
{
	title = "Score limit:";
	values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 250, 300, 400, 500};
	texts[] = {"Unlimited", "1 point", "2 points", "3 points", "4 points", "5 points", "6 points", "7 points", "8 points", "9 points", "10 points", "15 points", "20 points", "25 points", "30 points", "40 points", "50 points", "60 points", "70 points", "80 points", "90 points", "100 points", "150 points", "200 points", "250 points", "300 points", "400 points", "500 points"};
	default = 1;
};
};


class CfgDebriefing
{  
   class End1
   {
       title = "You Won!";
       subtitle = "";
       description = "You successfully defeated the opposing team.";
   };
   class End2
   {
       title = "You Lost!";
       subtitle = "";
       description = "You where defeated by the opposing team.";
   };
};  




In init.sqf :

this code dont work:

if (_scoreWest >= (paramsArray select 0)) then {
   //west won, show end1 with closing shot, called on all west players via BIS_fnc_MP
   [["end1",true,true],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
   //east failed, show end2 fade to black, called on all east players via BIS_fnc_MP
   [["end2",true,5],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
};
if (_scoreEast >= (paramsArray select 0)) then {
   //east won, show end1 with closing shot, called on all east players via BIS_fnc_MP
   [["end1",true,true],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
   //west failed, show end2 fade to black, called on all west players via BIS_fnc_MP
   [["end2",true,5],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
};  

code for Iceman77 not understand how to configure the trigger and how triggers should I have?

---------- Post added at 04:20 ---------- Previous post was at 02:42 ----------

this code works when the mission ends says mission complete, if you win but if I lose the game does not tell me, I need to say it help me?

_endmission = false;
while {NOT _endmission} do {
{
	if ((scoreSide WEST >= (paramsArray select 0)) || (scoreSide EAST >= (paramsArray select 0))) then {
		_endmission = true;
	};
} forEach allUnits;
};

"END1" call BIS_fnc_endMission;

Share this post


Link to post
Share on other sites
I need help !

I'm doing a TDM in ARMA 3. but it does not work the php code. the mission does not end.

IN description.etc

class Params
{
class _limitScore
{
	title = "Score limit:";
	values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 250, 300, 400, 500};
	texts[] = {"Unlimited", "1 point", "2 points", "3 points", "4 points", "5 points", "6 points", "7 points", "8 points", "9 points", "10 points", "15 points", "20 points", "25 points", "30 points", "40 points", "50 points", "60 points", "70 points", "80 points", "90 points", "100 points", "150 points", "200 points", "250 points", "300 points", "400 points", "500 points"};
	default = 1;
};
};


class CfgDebriefing
{  
   class End1
   {
       title = "You Won!";
       subtitle = "";
       description = "You successfully defeated the opposing team.";
   };
   class End2
   {
       title = "You Lost!";
       subtitle = "";
       description = "You where defeated by the opposing team.";
   };
};  




In init.sqf :

this code dont work:

if (_scoreWest >= (paramsArray select 0)) then {
   //west won, show end1 with closing shot, called on all west players via BIS_fnc_MP
   [["end1",true,true],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
   //east failed, show end2 fade to black, called on all east players via BIS_fnc_MP
   [["end2",true,5],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
};
if (_scoreEast >= (paramsArray select 0)) then {
   //east won, show end1 with closing shot, called on all east players via BIS_fnc_MP
   [["end1",true,true],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
   //west failed, show end2 fade to black, called on all west players via BIS_fnc_MP
   [["end2",true,5],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
};  

code for Iceman77 not understand how to configure the trigger and how triggers should I have?

---------- Post added at 04:20 ---------- Previous post was at 02:42 ----------

this code works when the mission ends says mission complete, if you win but if I lose the game does not tell me, I need to say it help me?

_endmission = false;
while {NOT _endmission} do {
{
	if ((scoreSide WEST >= (paramsArray select 0)) || (scoreSide EAST >= (paramsArray select 0))) then {
		_endmission = true;
	};
} forEach allUnits;
};

"END1" call BIS_fnc_endMission;

here is my description.ext :

class CfgDebriefing
{
 class End1
 {
   title = "ALL BEHAVE";
   subtitle = "WE GOT THE WINNER";
   //description = "end1 description";
   //picture = "b_inf";
   pictureColor[] = {0.0,0.3,0.6,1};
 };
 class End2: End1
 {
   title = "TERRORIST WIN";
   description = "Well done!";
 };
 class End3: End1
 {
   title = "COUNTER TERRORIST WIN";
   description = "Hooraahh!";
 };
};

and im using 2 trigger.

1st trigger :

type : End #2
Act : None
Once
Condition : red_point >= paramsArray select 0
On Act : forceEnd

2nd trigger :

type : End #3
Act : None
Once
Condition : blue_point >= paramsArray select 0
On Act : forceEnd

Share this post


Link to post
Share on other sites
I need help !

I'm doing a TDM in ARMA 3. but it does not work the php code. the mission does not end.

IN description.etc

class Params
{
   class _limitScore
   {
       title = "Score limit:";
       values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 250, 300, 400, 500};
       texts[] = {"Unlimited", "1 point", "2 points", "3 points", "4 points", "5 points", "6 points", "7 points", "8 points", "9 points", "10 points", "15 points", "20 points", "25 points", "30 points", "40 points", "50 points", "60 points", "70 points", "80 points", "90 points", "100 points", "150 points", "200 points", "250 points", "300 points", "400 points", "500 points"};
       default = 1;
   };
};


class CfgDebriefing
{  
   class End1
   {
       title = "You Won!";
       subtitle = "";
       description = "You successfully defeated the opposing team.";
   };
   class End2
   {
       title = "You Lost!";
       subtitle = "";
       description = "You where defeated by the opposing team.";
   };
};  




In init.sqf :

this code dont work:

if (_scoreWest >= (paramsArray select 0)) then {
   //west won, show end1 with closing shot, called on all west players via BIS_fnc_MP
   [["end1",true,true],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
   //east failed, show end2 fade to black, called on all east players via BIS_fnc_MP
   [["end2",true,5],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
};
if (_scoreEast >= (paramsArray select 0)) then {
   //east won, show end1 with closing shot, called on all east players via BIS_fnc_MP
   [["end1",true,true],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
   //west failed, show end2 fade to black, called on all west players via BIS_fnc_MP
   [["end2",true,5],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
};  

code for Iceman77 not understand how to configure the trigger and how triggers should I have?

---------- Post added at 04:20 ---------- Previous post was at 02:42 ----------

this code works when the mission ends says mission complete, if you win but if I lose the game does not tell me, I need to say it help me?

_endmission = false;
while {NOT _endmission} do {
   {
       if ((scoreSide WEST >= (paramsArray select 0)) || (scoreSide EAST >= (paramsArray select 0))) then {
           _endmission = true;
       };
   } forEach allUnits;
};

"END1" call BIS_fnc_endMission;

In init.sqf :

this code dont work:

if (_scoreWest >= (paramsArray select 0)) then {
   //west won, show end1 with closing shot, called on all west players via BIS_fnc_MP
   [["end1",true,true],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
   //east failed, show end2 fade to black, called on all east players via BIS_fnc_MP
   [["end2",true,5],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
};
if (_scoreEast >= (paramsArray select 0)) then {
   //east won, show end1 with closing shot, called on all east players via BIS_fnc_MP
   [["end1",true,true],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
   //west failed, show end2 fade to black, called on all west players via BIS_fnc_MP
   [["end2",true,5],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
};  

code for Iceman77 not understand how to configure the trigger and how triggers should I have?

---------- Post added at 04:20 ---------- Previous post was at 02:42 ----------

this code works when the mission ends says mission complete, if you win but if I lose the game does not tell me, I need to say it help me?

_endmission = false;
while {NOT _endmission} do {
   {
       if ((scoreSide WEST >= (paramsArray select 0)) || (scoreSide EAST >= (paramsArray select 0))) then {
           _endmission = true;
       };
   } forEach allUnits;
};

"END1" call BIS_fnc_endMission;

Where is _scoreWest & _scoreEast defined? Those are local variables that should be monitored and updated throughout the mission. Also, using scoreSide method #2, you forgot the additional "if" statement check within the if statement to broadcast text of winners and losers. That way all knows who won

While {true} do {
If ((scoreSide West >= (paramsArray select 0)) || (scoreSide East >= (paramsArray select 0))) Then {

  [color=#FF0000] If ([/color][color=#ff0000]scoreSide West[/color][color=#FF0000] >= (paramsArray select 0)) Then {
      W_Wins=true;
      PublicVariable "W_Wins";
    // -- Broadcast message with bis_fnc_mp (WEST WINS!!!! etc etc) -- //
   } Else {
      E_Wins=True;
      PublicVariable "E_Wins";
   // -- Broadcast message with bis_fnc_mp (EAST WINS!!!! etc etc) -- //
   }; [/color]
 };

sleep 1;

};

/* -------------------------------------------
[color=#0000ff]only 1 Trigger needed if using simple method. If defining end#1 & end#2 in the description then two triggers are needed.

1 Trigger method:
timeout: 5 
end#1
condition: W_Wins || E_Wins
Activation: ForceEnd[/color]

[color=#0000ff]2 Trigger method:
timeout: 5 
end#1
condition: W_Wins 
Activation: ForceEnd[/color]

[color=#0000ff]timeout: 5 
end#2
condition: E_Wins 
Activation: ForceEnd[/color]
------------------------------------------ */

Edited by Iceman77

Share this post


Link to post
Share on other sites
Where is _scoreWest & _scoreEast defined? Those are local variables that should be monitored and updated throughout the mission. Also, using scoreSide method #2, you forgot the additional "if" statement check within the if statement to broadcast text of winners and losers. That way all knows who won

While {true} do {
If ((scoreSide West >= (paramsArray select 0)) || (scoreSide East >= (paramsArray select 0))) Then {

  [color=#FF0000] If ([/color][color=#ff0000]scoreSide West[/color][color=#FF0000] >= (paramsArray select 0)) Then {
      W_Wins=true;
      PublicVariable "W_Wins";
    // -- Broadcast message with bis_fnc_mp (WEST WINS!!!! etc etc) -- //
   } Else {
      E_Wins=True;
      PublicVariable "E_Wins";
   // -- Broadcast message with bis_fnc_mp (EAST WINS!!!! etc etc) -- //
   }; [/color]
 };

sleep 1;

};

/* -------------------------------------------
[color=#0000ff]only 1 Trigger needed if using simple method. If defining end#1 & end#2 in the description then two triggers are needed.

1 Trigger method:
timeout: 5 
end#1
condition: W_Wins || E_Wins
Activation: ForceEnd[/color]

[color=#0000ff]2 Trigger method:
timeout: 5 
end#1
condition: W_Wins 
Activation: ForceEnd[/color]

[color=#0000ff]timeout: 5 
end#2
condition: E_Wins 
Activation: ForceEnd[/color]
------------------------------------------ */

Now use two triggers:

2 Trigger method:

timeout: 5

end#1

condition: W_Wins

Activation: ForceEnd

timeout: 5

end#2

condition: E_Wins

Activation: ForceEnd

It worked but only if I win the game, nothing happens if I lose.

I'm testing against the AI​​.

When I lose I need you to tell me, "You lose"

--

This method I like more as the game ends because it has this: "END1" call BIS_fnc_endMission ... and works without trigger

but I need to add another "END2" BIS_fnc_endMission false call to tell me when I lose the game

_endmission = false;

while {NOT _endmission} do {

{

if ((scoreSide WEST >= (paramsArray select 0)) || (scoreSide EAST >= (paramsArray select 0))) then {

_endmission = true;

};

} forEach allUnits;

};

"END1" call BIS_fnc_endMission;

[code]

my new description.etc:

[code]class CfgDebriefing

//--- endings // blue side first

{

class End1

{ //West winner

title = "Mission Complete";

subtitle = "";

description = "Your team has won the battle.";

pictureBackground = "";

picture = "b_inf";

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

};

class End2

{ //East loser

title = "Mission Failed";

subtitle = "";

description = "Your team has lost the battle.";

pictureBackground = "";

picture = "b_inf";

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

};

class End3

{ //West loser

title = "Mission Failed";

subtitle = "";

description = "Your team has lost the battle.";

pictureBackground = "";

picture = "b_inf";

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

};

class End4

{ //East winner

title = "Mission Complete";

subtitle = "";

description = "Your team has won the battle.";

pictureBackground = "";

picture = "b_inf";

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

};

};[code]

Edited by exevankeko

Share this post


Link to post
Share on other sites

to tell me to get lost in the mission,.

have to change something in the file descripcion.etc or init.sqf? or both?

Share this post


Link to post
Share on other sites

It worked but only if I win the game, nothing happens if I lose.

I'm testing against the AI​​.

When I lose I need you to tell me, "You lose"

Then broadcast a message to the losing side?

While {true} do {
If ((scoreSide West >= (paramsArray select 0)) || (scoreSide East >= (paramsArray select 0))) Then {

   If (scoreSide West >= (paramsArray select 0)) Then {
      W_Wins=true;
      PublicVariable "W_Wins";
   [color=#0000ff] // -- Broadcast message to west units with bis_fnc_mp (WEST WINS!!!! etc etc) -- //[/color]
   } Else {
      E_Wins=True;
      PublicVariable "E_Wins";
   [color=#0000ff]// -- Broadcast message to east units with bis_fnc_mp (EAST WINS!!!! etc etc) -- //[/color]
   }; 
 };

sleep 1;
};

Share this post


Link to post
Share on other sites
Then broadcast a message to the losing side?

While {true} do {
If ((scoreSide West >= (paramsArray select 0)) || (scoreSide East >= (paramsArray select 0))) Then {

   If (scoreSide West >= (paramsArray select 0)) Then {
      W_Wins=true;
      PublicVariable "W_Wins";
   [color=#0000ff] // -- Broadcast message to west units with bis_fnc_mp (WEST WINS!!!! etc etc) -- //[/color]
   } Else {
      E_Wins=True;
      PublicVariable "E_Wins";
   [color=#0000ff]// -- Broadcast message to east units with bis_fnc_mp (EAST WINS!!!! etc etc) -- //[/color]
   }; 
 };

sleep 1;
};

yes, I need to also say when you lose

the code works when you play the side that wins. says that you win, but when you play the losing side does not tell me anything.

Edited by exevankeko

Share this post


Link to post
Share on other sites

As I said, you need to broadcast a message to the losing side aswell with Bis_Fnc_Mp.

Variant #1

[size=2]
[color=#0000ff]//store win and lose messages within global variables[/color]
[color=#ff0000]Tag_FNC_Winner = {hint "Your team has won";};
Tag_FNC_loser = {hint "Your team has lost";};[/color][/size][color=#ff0000]
[/color]
[color=#0000ff]//server will monitor the score & broadcast the messages to all clients when the score limit is reached or surpassed by either side.[/color] 
if (isServer) then {
while {true} do {
if ((scoreSide West >= (paramsArray select 0)) || (scoreSide East >= (paramsArray select 0))) Then {

 if (scoreSide West >= (paramsArray select 0)) Then {
      W_Wins=true;
      PublicVariable "W_Wins";     
     [color=#ff0000] [[], "TAG_FNC_Winner", west, false] spawn BIS_fnc_MP; 
      [[], "TAG_FNC_loser", east, false] spawn BIS_fnc_MP;[/color]
   } else {
      E_Wins=True;
      publicVariable "E_Wins";
     [color=#ff0000] [[], "TAG_FNC_Winner", east, false] spawn BIS_fnc_MP; 
      [[], "TAG_FNC_loser", west, false] spawn BIS_fnc_MP;[/color] 
   }; 
 };
   sleep 1;
};

};


/* -------------------------------------------
[color=#0000ff]only 1 Trigger needed if using simple method. [/color][color=#ff0000]
[/color][color=#0000ff]
1 Trigger method:
timeout: 5 
end#1
condition: W_Wins || E_Wins
Activation: ForceEnd[/color]


[color=#ff0000]If defining end#1 & end#2 in the description then two triggers are needed.
[/color]
[color=#ff0000]2 Trigger method:
timeout: 5 
end#1
condition: W_Wins 
Activation: ForceEnd

timeout: 5 
end#2
condition: E_Wins 
Activation: ForceEnd[/color]
------------------------------------------ */

variant #2

[size=2]
[color=#0000ff]//store win and lose messages within global variables[/color] [color=#ff0000]
Tag_FNC_Winner = {hint "Your team has won";}; 
Tag_FNC_loser = {hint "Your team has lost";};[/color][/size] [color=#0000ff]

//server will wait until the score limit is reached or surpassed by either side & broadcasts the messages to all clients [/color]
if (isServer) then {  
waituntil {(scoreSide West >= (paramsArray select 0)) || (scoreSide East >= (paramsArray select 0))}; 

 if (scoreSide West >= (paramsArray select 0)) Then { 
     W_Wins=true;     
     PublicVariable "W_Wins"; 
     [color=#ff0000][[], "TAG_FNC_Winner", west, false] spawn BIS_fnc_MP;
     [[], "TAG_FNC_loser", east, false] spawn BIS_fnc_MP;[/color] 
 } else {     
     E_Wins=True;     
     publicVariable "E_Wins"; 
     [color=#ff0000][[], "TAG_FNC_Winner", east, false] spawn BIS_fnc_MP; 
     [[], "TAG_FNC_loser", west, false] spawn BIS_fnc_MP;[/color]   
 };           
};   


/* -------------------------------------------
[color=#0000ff]only 1 Trigger needed if using simple method. [/color][color=#ff0000]
[/color][color=#0000ff]
1 Trigger method:
timeout: 5 
end#1
condition: W_Wins || E_Wins
Activation: ForceEnd[/color]


[color=#ff0000]If defining end#1 & end#2 in the description then two triggers are needed.
[/color]
[color=#ff0000]2 Trigger method:
timeout: 5 
end#1
condition: W_Wins 
Activation: ForceEnd

timeout: 5 
end#2
condition: E_Wins 
Activation: ForceEnd[/color]
------------------------------------------ */

Edited by Iceman77

Share this post


Link to post
Share on other sites
//store win and lose messages within global variables 

Tag_FNC_Winner = {hint "Your team has won";};

Tag_FNC_loser = {hint "Your team has lost";};

//server will wait until the score limit is reached or surpassed by either side & broadcasts the messages to all clients

if (isServer) then {

waituntil {(scoreSide West >= (paramsArray select 0)) || (scoreSide East >= (paramsArray select 0))};

if (scoreSide West >= (paramsArray select 0)) Then {

W_Wins=true;

PublicVariable "W_Wins";

[[], "TAG_FNC_Winner", west, false] spawn BIS_fnc_MP;

[[], "TAG_FNC_loser", east, false] spawn BIS_fnc_MP;

} else {

E_Wins=True;

publicVariable "E_Wins";

[[], "TAG_FNC_Winner", east, false] spawn BIS_fnc_MP;

[[], "TAG_FNC_loser", west, false] spawn BIS_fnc_MP;

};

};

/* -------------------------------------------

only 1 Trigger needed if using simple method.

1 Trigger method:

timeout: 5

end#1

condition: W_Wins || E_Wins

Activation: ForceEnd

If defining end#1 & end#2 in the description then two triggers are needed.

2 Trigger method:

timeout: 5

end#1

condition: W_Wins

Activation: ForceEnd

timeout: 5

end#2

condition: E_Wins

Activation: ForceEnd[code]

now it works thank you very much, I just like to change one thing .. as I can do?

when you finish the game, as I can add this command: "END1" call BIS_fnc_endMission;

ending with full-screen effects.

Edited by exevankeko

Share this post


Link to post
Share on other sites

I've never fiddled with that function. I can try to help you the best I can. Maybe something like this.

Variant #1

[size=2]
[/size][size=2][color=#0000ff]//store win and lose messages within global variables[/color] [color=#ff0000] 
Tag_FNC_Winner = {[/color][/size][color=#0000ff]["end1",True,5] call BIS_fnc_endMission;[/color][size=2][color=#ff0000]}; 
Tag_FNC_loser = {[/color][/size][color=#0000ff]["end2",false,5] call BIS_fnc_endMission;[/color][size=2][color=#ff0000]};[/color][/size][color=#ff0000]
[/color]
[color=#0000ff]//server will monitor the score & broadcast  the messages to all clients when the score limit is reached or surpassed  by either side.[/color] 
if (isServer) then {
while {true} do {
if ((scoreSide West >= (paramsArray select 0)) || (scoreSide East >= (paramsArray select 0))) Then {

 if (scoreSide West >= (paramsArray select 0)) Then {    
     [color=#ff0000] [[], "TAG_FNC_Winner", west, false] spawn BIS_fnc_MP; 
      [[], "TAG_FNC_loser", east, false] spawn BIS_fnc_MP;[/color]
   } else {
     [color=#ff0000] [[], "TAG_FNC_Winner", east, false] spawn BIS_fnc_MP; 
      [[], "TAG_FNC_loser", west, false] spawn BIS_fnc_MP;[/color] 
   }; 
 };
   sleep 1;
};

};

variant #2

[size=2]
[color=#0000ff]//store win and lose messages within global variables[/color] [color=#ff0000] 
Tag_FNC_Winner = {[/color][/size][color=#0000ff]["end1",True,5] call BIS_fnc_endMission;[/color][size=2][color=#ff0000]}; 
Tag_FNC_loser = {[/color][/size][color=#0000ff]["end2",false,5] call BIS_fnc_endMission;[/color][size=2][color=#ff0000]};[/color][/size] 

[color=#0000ff]  //server will wait until the score limit is reached or surpassed by either side & broadcasts the messages to all clients [/color] 
if (isServer) then {   
waituntil {(scoreSide West >= (paramsArray select 0)) || (scoreSide East >= (paramsArray select 0))}; 

  if (scoreSide West >= (paramsArray select 0)) Then {           [color=#ff0000]
  [[], "TAG_FNC_Winner", west, false] spawn BIS_fnc_MP; 
  [[], "TAG_FNC_loser", east, false] spawn BIS_fnc_MP;[/color] 
 } else {      [color=#ff0000]
  [[], "TAG_FNC_Winner", east, false] spawn BIS_fnc_MP; 
  [[], "TAG_FNC_loser", west, false] spawn BIS_fnc_MP;[/color]      
 };            
}; 

description.ext

class CfgDebriefing
{  
   class End1
   {
       title = "Your Team Has Won";
       subtitle = "";
       description = "Your team beat the snot out of the opposition";
       pictureBackground = "";
       picture = "";
       pictureColor[] = {1,1,1,1};
   };

       class End2
   {
       title = "Your team has lost";
       subtitle = "";
       description = "Your team got their asses kicked";
       pictureBackground = "";
       picture = "";
       pictureColor[] = {1,1,1,1};
   };
};

Edited by Iceman77

Share this post


Link to post
Share on other sites

if (isServer) then {

GameFinished = false;

while {!(GameFinished)} do {
	if ( (scoreSide west >= (paramsArray select 0)) || (scoreSide east >= (paramsArray select 0)) ) then {
		if ( scoreSide west > scoreSide east ) then {
			//west won, show end1 with closing shot, called on all west players via BIS_fnc_MP
			[["end1",true,true],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
			//east failed, show end2 fade to black, called on all east players via BIS_fnc_MP
			[["end2",true,5],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
		}else{
			//east won, show end1 with closing shot, called on all east players via BIS_fnc_MP
			[["end1",true,true],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
			//west failed, show end2 fade to black, called on all west players via BIS_fnc_MP
			[["end2",true,5],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
		};

		GameFinished = true;
	};

	sleep 1;
};
};

EXAMPLE MISSION

Share this post


Link to post
Share on other sites
I've never fiddled with that function. I can try to help you the best I can. Maybe something like this.

Variant #1

[size=2]
[/size][size=2][color=#0000ff]//store win and lose messages within global variables[/color] [color=#ff0000] 
Tag_FNC_Winner = {[/color][/size][color=#0000ff]["end1",True,5] call BIS_fnc_endMission;[/color][size=2][color=#ff0000]}; 
Tag_FNC_loser = {[/color][/size][color=#0000ff]["end2",false,5] call BIS_fnc_endMission;[/color][size=2][color=#ff0000]};[/color][/size][color=#ff0000]
[/color]
[color=#0000ff]//server will monitor the score & broadcast  the messages to all clients when the score limit is reached or surpassed  by either side.[/color] 
if (isServer) then {
while {true} do {
if ((scoreSide West >= (paramsArray select 0)) || (scoreSide East >= (paramsArray select 0))) Then {

 if (scoreSide West >= (paramsArray select 0)) Then {    
     [color=#ff0000] [[], "TAG_FNC_Winner", west, false] spawn BIS_fnc_MP; 
      [[], "TAG_FNC_loser", east, false] spawn BIS_fnc_MP;[/color]
   } else {
     [color=#ff0000] [[], "TAG_FNC_Winner", east, false] spawn BIS_fnc_MP; 
      [[], "TAG_FNC_loser", west, false] spawn BIS_fnc_MP;[/color] 
   }; 
 };
   sleep 1;
};

};

variant #2

[size=2]
[color=#0000ff]//store win and lose messages within global variables[/color] [color=#ff0000] 
Tag_FNC_Winner = {[/color][/size][color=#0000ff]["end1",True,5] call BIS_fnc_endMission;[/color][size=2][color=#ff0000]}; 
Tag_FNC_loser = {[/color][/size][color=#0000ff]["end2",false,5] call BIS_fnc_endMission;[/color][size=2][color=#ff0000]};[/color][/size] 

[color=#0000ff]  //server will wait until the score limit is reached or surpassed by either side & broadcasts the messages to all clients [/color] 
if (isServer) then {   
waituntil {(scoreSide West >= (paramsArray select 0)) || (scoreSide East >= (paramsArray select 0))}; 

  if (scoreSide West >= (paramsArray select 0)) Then {           [color=#ff0000]
  [[], "TAG_FNC_Winner", west, false] spawn BIS_fnc_MP; 
  [[], "TAG_FNC_loser", east, false] spawn BIS_fnc_MP;[/color] 
 } else {      [color=#ff0000]
  [[], "TAG_FNC_Winner", east, false] spawn BIS_fnc_MP; 
  [[], "TAG_FNC_loser", west, false] spawn BIS_fnc_MP;[/color]      
 };            
}; 

description.ext

class CfgDebriefing
{  
   class End1
   {
       title = "Your Team Has Won";
       subtitle = "";
       description = "Your team beat the snot out of the opposition";
       pictureBackground = "";
       picture = "";
       pictureColor[] = {1,1,1,1};
   };

       class End2
   {
       title = "Your team has lost";
       subtitle = "";
       description = "Your team got their asses kicked";
       pictureBackground = "";
       picture = "";
       pictureColor[] = {1,1,1,1};
   };
};

did not work. says the code works perfect when you win or lose.

not call "End1", "BIS_fnc_endMission

we will have to put in the trigger in any way? or init.sqf?

Share this post


Link to post
Share on other sites
did not work. says the code works perfect when you win or lose.

not call "End1", "BIS_fnc_endMission

we will have to put in the trigger in any way? or init.sqf?

I'm sorry, you'll have to be a little more specific and explain the problem more clearly. Please post your mission file/folder and your rpt.

Share this post


Link to post
Share on other sites
if (isServer) then {

GameFinished = false;

while {!(GameFinished)} do {
	if ( (scoreSide west >= (paramsArray select 0)) || (scoreSide east >= (paramsArray select 0)) ) then {
		if ( scoreSide west > scoreSide east ) then {
			//west won, show end1 with closing shot, called on all west players via BIS_fnc_MP
			[["end1",true,true],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
			//east failed, show end2 fade to black, called on all east players via BIS_fnc_MP
			[["end2",true,5],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
		}else{
			//east won, show end1 with closing shot, called on all east players via BIS_fnc_MP
			[["end1",true,true],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;
			//west failed, show end2 fade to black, called on all west players via BIS_fnc_MP
			[["end2",true,5],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;
		};

		GameFinished = true;
	};

	sleep 1;
};
};

EXAMPLE MISSION

larrow thanks, this code works pretty well.

*** when you win the game BIS_fnc_endMission function calls;

but when I lose BIS_fnc_endMission function does not work;

---------- Post added at 19:46 ---------- Previous post was at 19:38 ----------

I'm sorry, you'll have to be a little more specific and explain the problem more clearly. Please post your mission file/folder and your rpt.

here it is: http://uptobox.com/ovpgb1illyew

the code is fine, what I want is to use the function BIS_fnc_endMission when the game ends.

Edited by exevankeko

Share this post


Link to post
Share on other sites
but when I lose BIS_fnc_endMission function does not work;
Works perfectly fine i tested it before posting just to make sure (see example mission in last post).

Share this post


Link to post
Share on other sites

Well I've did exactly what i suggested earlier and it works flawlessly. Larrow's works great too.

description.ext

aikills = 1; //because i'm testing alone and needed to addscore to an ai unit to test

class Params
{
     class Score
     { // param 0
       title = "Score To Win:";
       values[] = {500,1000};
       texts[] = {"500","1000"};
       default = 500;
     };

};

class CfgDebriefing
{  
   class End1
   {
       title = "Your Team Has Won";
       subtitle = "";
       description = "Your team beat the snot out of the opposition";
       pictureBackground = "";
       picture = "";
       pictureColor[] = {1,1,1,1};
   };

       class End2
   {
       title = "Your team has lost";
       subtitle = "";
       description = "Your team got their asses kicked";
       pictureBackground = "";
       picture = "";
       pictureColor[] = {1,1,1,1};
   };
};

sqf file (can be init.sqf)

Tag_FNC_Winner = {["end1",True,5] call BIS_fnc_endMission;hint "your team won";}; 
Tag_FNC_loser = {["end2",false,5] call BIS_fnc_endMission;hint "your team lost";}; 

if (isServer) then {   
waituntil {(scoreSide West >= (paramsArray select 0)) || (scoreSide East >= (paramsArray select 0))}; 

  if (scoreSide West >= (paramsArray select 0)) Then {           
  [[], "TAG_FNC_Winner", west, false] spawn BIS_fnc_MP; 
  [[], "TAG_FNC_loser", east, false] spawn BIS_fnc_MP; 
 } else {      
  [[], "TAG_FNC_Winner", east, false] spawn BIS_fnc_MP; 
  [[], "TAG_FNC_loser", west, false] spawn BIS_fnc_MP;      
 };            
};

Here's the proof. Check the mission example out. Simply use either of the radio triggers to give the winning score to either side.

Share this post


Link to post
Share on other sites
Works perfectly fine i tested it before posting just to make sure (see example mission in last post).

when I win appears like this (is perfect!): y5qd.jpg

when I lose appears like this: 3udu.jpg

as seen when I lose not use the function BIS_fnc_endMission

that I have wrong? here is my mission: http://uptobox.com/ovpgb1illyew

Share this post


Link to post
Share on other sites

That is how mine is ment to look, read the comments in the script.

//west won, show end1 with closing shot, called on all west players via BIS_fnc_MP

[["end1",true,true],"BIS_fnc_endMission", west, false] call BIS_fnc_MP;

//east failed, show end2 fade to black, called on all east players via BIS_fnc_MP

[["end2",true,5],"BIS_fnc_endMission", east, false] call BIS_fnc_MP;

See WIKI for command parameters BIS_fnc_endMission

Edited by Larrow

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  

×