Jump to content

Recommended Posts

Hi guys,

Today I come to a query to know if I could make my first Script correctly,

 

//init.sqf
bluNums = west countSide allPlayers;

while {true} do {
	{

	if (!alive player) then {
		bluNums = bluNums - 1;

		if (bluNums <= 6 && _downAllies) exitWith {
			detenerTiempo = true; "EVERYONELOST" remoteExecCall ["BIS_fnc_endMissionServer", 0, true];
			_downAllies = false;
		};
	};

} forEach allPlayers;
};

 

This script was written to indicate to the system that when they have killed a number of blufor soldiers the game ends as lost, since there are 16 blufor but I wanted the counter to subtract to the global variable -1 and to reach 6 finish the mission, because I put a player counter.

 

The script is fine? or do you see any failure or improvement?

 

thank you very much

Share this post


Link to post
Share on other sites

1. undefined variable _downAllies in line 9
2. Lazy evaluation
3. init.sqf is executing on every client (no need to remoteexec)
4. use eventhandlers instead loops
5. MP incompatible

Share this post


Link to post
Share on other sites
6 minutes ago, davidoss said:

1. undefined variable _downAllies in line 9
2. Lazy evaluation
3. init.sqf is executing on every client (no need to remoteexec)
4. use eventhandlers instead loops
5. MP incompatible

 

 

thanks for the information, I will try to make eventhandler of this to see what happens.

Share this post


Link to post
Share on other sites

As I said in the other thread. There is no need to use remoteExec for BIS_fnc_endMissionServer as it makes no sense since the function ends it for all players anyway.

Share this post


Link to post
Share on other sites
6 minutes ago, HazJ said:

As I said in the other thread. There is no need to use remoteExec for BIS_fnc_endMissionServer as it makes no sense since the function ends it for all players anyway.

 

I had twice error with execVM and running BIS_fnc_endMissionServer, since I started using it with remoteExecCall I do not have that finalization problem anymore, that's why I've been using it.

Share this post


Link to post
Share on other sites

lol? First off... Just because something doesn't work doesn't mean it is acceptable or logical to do something just because that way doesn't error. Secondly you don't execVM a function. Lastly, if you even read the Wiki that I linked to you in your other thread then you would of saw the exact syntax and usage example.

https://community.bistudio.com/wiki/BIS_fnc_endMissionServer

Quote

Syntax:

endType call BIS_fnc_endMissionServer

Parameters:

endType: String - class name of ending defined in CfgDebriefing.
Can be custom or one of dynamically calculated ones:

"EveryoneWon" - show "MISSION COMPLETED" to everyone

"EveryoneLost" - show "MISSION FAILED" to everyone

"SideScore" - show "YOUR SIDE WON" to side with largest score

"GroupScore" - show "YOUR GROUP WON" to group with largest score

"PlayerScore" - show "YOU WON" to player with largest score

"END1" call BIS_fnc_endMissionServer;

 

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

×