Jump to content
Sign in to follow this  
Trase

All tasks get marked as 'complete' in multiplayer game. See inside for details.

Recommended Posts

Same mission works in Singleplayer perfectly. It works in mutiplayer perfectly (if you're alone on the server). But as soon as someone else joins, all tasks (even the ones that are invisible for now) get unlocked (without onscreen notifications). Everything else including scripts work perfectly and you can play the mission. If you complete the task, it will be marked 'complete' again, this time with onscreen notification.

Share this post


Link to post
Share on other sites

apparently it's because the Set Task State modules are broken. some people are saying it's fixed on dev branch but there's been threads about this since august of last year. if it really is fixed on dev branch then that's pretty sad on bohemia's end. they work fine when you host in game but they're broken on dedicated.

Share this post


Link to post
Share on other sites
apparently it's because the Set Task State modules are broken. some people are saying it's fixed on dev branch but there's been threads about this since august of last year. if it really is fixed on dev branch then that's pretty sad on bohemia's end. they work fine when you host in game but they're broken on dedicated.

The tasks are also broken when you host a mission. I've created a mission and it's fine right up until someone joins, then all of the tasks complete. I've just downloaded the Development Build but I'm yet to try my mission out as I'm waiting for a friend to join and test it later. What are the downsides of the Dev Build if it fixes bugs? Already I've noticed a minor fix on a ladder climb that never worked with the stable version.

Share this post


Link to post
Share on other sites
The tasks are also broken when you host a mission. I've created a mission and it's fine right up until someone joins, then all of the tasks complete. I've just downloaded the Development Build but I'm yet to try my mission out as I'm waiting for a friend to join and test it later. What are the downsides of the Dev Build if it fixes bugs? Already I've noticed a minor fix on a ladder climb that never worked with the stable version.

Unlike the stable build, the dev build is unstable. That is, from time to time, it'll get updates that break some things, or even the entire game.

Share this post


Link to post
Share on other sites

Easy workaround to this is don't use the modules in the editor, but instead use the functions via script. Much easier in my opinion, and much more controllable. Allows for further creativity as it is exactly what the module uses, however you can customize it. And of course it can be used for JIP if you wrap it in BIS_fnc_MP.

You can find them in the editor under the Functions list. eg BIS_fnc_setTaskState (they're not on the wiki yet, but directions for use are found in the function itself)

Share this post


Link to post
Share on other sites
;2629460']Easy workaround to this is don't use the modules in the editor' date=' but instead use the functions via script. Much easier in my opinion, and much more controllable. Allows for further creativity as it is exactly what the module uses, however you can customize it. And of course it can be used for JIP if you wrap it in BIS_fnc_MP.

You can find them in the editor under the Functions list. eg BIS_fnc_setTaskState (they're not on the wiki yet, but directions for use are found in the function itself)[/quote']

is there loss in performance though?

Share this post


Link to post
Share on other sites

I don't see why, its literally the same thing. ALL modules in the game call upon the same functions you see in the Functions menu. Any module can be replicated via script. All they are are functions of functions which take their parameters from dialogs.

If there is a performance hit, it is not noticeable. I use it in all of my missions and have never had an issue. Like I said, its the exact same scripts as the module.

Share this post


Link to post
Share on other sites

If you use scripts, you basically "futureproof" your missions as well. I've heard so many complaints that a lot of peoples missions on the workshop are now broken, thanks to this 'bug'. Surely BIS could implement a hotfix to sort this shit out for everyone.

Share this post


Link to post
Share on other sites
If you use scripts, you basically "futureproof" your missions as well. I've heard so many complaints that a lot of peoples missions on the workshop are now broken, thanks to this 'bug'. Surely BIS could implement a hotfix to sort this shit out for everyone.

you'd think something that effectively breaks the editor and half the missions ever made with it would be high priority.

Share this post


Link to post
Share on other sites
you'd think something that effectively breaks the editor and half the missions ever made with it would be high priority.

What are they coding Arma with? C++? Is SQF coded with C++?

Share this post


Link to post
Share on other sites
What are they coding Arma with? C++? Is SQF coded with C++?

they're similar-ish languages but SQF isn't an extension or variant of C++.

Share this post


Link to post
Share on other sites

SQF is its own thing, but has obvious similarities to C# and C++, and of course logic of Javascript.

Agreed with the futureproof comment. I am yet to see a command be "removed". Change of function or addition of a parameter, perhaps, but not removed.

Share this post


Link to post
Share on other sites

I had this problem. After I made most of the content in SP editor and started using MP editor and loading it on a dedicated server, tasks were all messed up.

I ended up using FHQ Task Tracker. Did not take too long to change over, and really once I got used to it, I like it better than the modules because I don't have so much clutter and sync lines. The only down side is you have to use a marker or other object to get position on, or know the coordinates.

Briefing also became easier although I already had a script doing that for me.

Share this post


Link to post
Share on other sites

I ended up using FHQ Task Tracker. Did not take too long to change over, and really once I got used to it, I like it better than the modules because I don't have so much clutter and sync lines. The only down side is you have to use a marker or other object to get position on, or know the coordinates.

FHQ Task Tracker is obsolete by the way. It is made for ArmA 2, which is normally OK, but when the tasks system was completely revamped for A3 for ease of use, it makes a difference. Once again I point to the extremely user friendly functions.

Share this post


Link to post
Share on other sites
;2630118']FHQ Task Tracker is obsolete by the way. It is made for ArmA 2' date=' which is normally OK, but when the tasks system was completely revamped for A3 for ease of use, it makes a difference. Once again I point to the extremely user friendly functions.[/quote']

Are sure about that? From what I read its current for A3. It uses the functions you point out I believe. I'm just a babe still in the armaverse, so you may well be correct, but last update was in january, and its listed at armaholic as A3 script.

Share this post


Link to post
Share on other sites
Are sure about that? From what I read its current for A3. It uses the functions you point out I believe. I'm just a babe still in the armaverse, so you may well be correct, but last update was in january, and its listed at armaholic as A3 script.

It is considered an A3 script because it works in A3. It is just not as efficient as the BIS functions, which do the same thing but require less effort and are optimized.

Why fix it if it ain't broken? Yes it was relevant for A2, but it is just an unnecessary hassle for A3 when the content is already stock, and perfect. Yes the modules don't work, but as I said before, the modules are just a dialog format of the functions that you can call via script anyway.

Share this post


Link to post
Share on other sites

Hmm. One more thing I learned today. I will have to revisit this tonight and see what I might use. Thanks for the info!

---------- Post added at 12:59 ---------- Previous post was at 12:42 ----------

A quick lunch-time search gives not much for BIS_fnd_createTask or any of the other task related BIS_fnc commands I've seen in forum posts.

Where does one find documentation on this? I looked in A3 functions and TOH functions, found many of the BIS_fnc functions but not what is needed for tasks it seems.

Is there a recommended script example for a guy to learn from by chance?

Share this post


Link to post
Share on other sites

[/color]A quick lunch-time search gives not much for BIS_fnd_createTask or any of the other task related BIS_fnc commands I've seen in forum posts.

Where does one find documentation on this? I looked in A3 functions and TOH functions, found many of the BIS_fnc functions but not what is needed for tasks it seems.

Is there a recommended script example for a guy to learn from by chance?

Like I said, they are in there. Look for BIS_fnc_taskCreate and BIS_fnc_taskSetState. That's all I ever use since that is all I find necessary, but you'll see other ones adjacent to those. Those are handlers of return values related to tasks or specific things that you can do within taskCreate anyway.

Here's how I utilize them in one of my missions, feel free to pick around. As well, inside the function (click on it in the editor) you'll see an explanation of the params.

[west, "tsk1", ["Successfully and silently deploy on the northern beach.", "Insertion", "Insertion"], (getMarkerPos "insertion"), true] spawn BIS_fnc_taskCreate;  

sleep 10;

voice = [[true, insertboat, "Boat1", boatd, "Ok, this is the place. Once you guys move out, I'll take the crate back to the ship."], "G_fnc_Voice", true, false] call BIS_fnc_MP;
["tsk1","SUCCEEDED"] call BIS_fnc_taskSetState;
sleep 2;

[west, "tsk2", ["Infiltrate the enemy encampment and destroy the coastal defences.", "Destroy Coastal Defences", "Destroy Coastal Defences"], (getMarkerPos "obj1"), true] spawn BIS_fnc_taskCreate;  

waitUntil {
(isNil "arty1" || {!alive arty1}) && (isNil "arty2" || {!alive arty2}) && (isNil "arty3" || {!alive arty3})
};

sleep 2;

["tsk2","SUCCEEDED"] call BIS_fnc_taskSetState;

sleep 5;

[west, "tsk3", ["Infiltrate the Stratis Air Base and eliminate all enemies around the northeast beachhead.", "Secure the Beachhead", "Secure the Beachhead"], (getMarkerPos "obj2"), true] spawn BIS_fnc_taskCreate;  

waitUntil {triggerActivated obj2trg};
sleep 1;

["tsk3","SUCCEEDED"] call BIS_fnc_taskSetState;
sleep 1;
voice = [[false, nil, "Baseplate1", bp, "Renegade, this is Baseplate. Radio’s loud. Reinforcements are inbound from the north east. Keep the beachhead secure for their arrival. Baseplate, out."], "G_fnc_Voice", true, false] spawn BIS_fnc_MP;

sleep 4;

[west, "tsk4", ["Pull security at the beachhead until reinforcements arrive and the extraction helicopter is safely on the deck.", "Prepare for Extraction", "Prepare for Extraction"], (getMarkerPos "obj2"), true] spawn BIS_fnc_taskCreate;  

coatt = 1;

execVM "boat1.sqf";
execVM "boat2.sqf";
sleep 15;
execVM "truck1.sqf";
execVM "truck2.sqf";

sleep 2;
voice = [[false, nil, "Baseplate2", bp, "Renegade, Baseplate. Be advised that we are seeing enemy transports en route to your position from the south west. You must hold that beachhead. Baseplate, out."], "G_fnc_Voice", true, false] spawn BIS_fnc_MP;
sleep 6;

["tsk4","CANCELED",true] call BIS_fnc_taskSetState;
sleep 2;
[west, "tsk5", ["Defeat the counter-attack!", "Defeat Counter-Attack", "Defeat Counter-Attack"], (getMarkerPos "obj2"), true] spawn BIS_fnc_taskCreate;  

sleep 5;
voice = [[false, nil, "Swimmer", swim, "Renegade, this is Swimmer Actual. Be advised, we are 10 seconds from landing, check fire."], "G_fnc_Voice", true, false] spawn BIS_fnc_MP;

sleep 40;
coatt = 0;

waitUntil {triggerActivated obj3trg};
sleep 2;

["tsk5","SUCCEEDED"] call BIS_fnc_taskSetState;
sleep 2;
["tsk4","ASSIGNED"] call BIS_fnc_taskSetState;

_heli1mkr = getMarkerPos "heli1mkr";
_heli1crewmkr = getMarkerPos "heli1crewmkr";

[_heli1mkr, 30, "B_Heli_Transport_01_F", WEST] call bis_fnc_spawnVehicle;
_heli1 = nearestObject [_heli1mkr, "AIR"];
_heli1Driver = driver _heli1;
{[_x] join _heli1Driver} forEach crew _heli1;
_heli1crew = group _heli1Driver;

_heli1group = [_heli1crewmkr, WEST, ["B_officer_F"]] call BIS_fnc_spawnGroup;
_drasky = leader _heli1group;
_drasky setIdentity "Drasky";
_drasky allowDamage false;

{_x moveInCargo _heli1} forEach units _heli1group;
{_x assignAsCargo _heli1} forEach units _heli1group;

_heli1 allowDamage false;
_heli1 setCaptive true;

wp11h1 = _heli1crew addWaypoint [(getPos helipad), 0];
wp11h1 setWaypointType "TR UNLOAD";
wp11h1 setWaypointBehaviour "SAFE";
wp11h1 setWaypointCombatMode "BLUE";
wp11h1 setWaypointStatements  ["true","_heli1 land 'GET IN';"];

waitUntil {speed _heli1 > 10};
waitUntil {speed _heli1 < 2};
{unassignVehicle _x} forEach units _heli1group;

wp1o1 = _heli1group addWaypoint [(getmarkerpos "debrief"), 0];
wp1o1 setWaypointType "MOVE";
wp1o1 setWaypointBehaviour "SAFE";
wp1o1 setWaypointSpeed "LIMITED";
wp1o1 setWaypointCombatMode "BLUE";
wp1o1 setWaypointStatements  ["true",""];

sleep 15;

["tsk4","SUCCEEDED"] call BIS_fnc_taskSetState;
sleep 2;
[west, "tsk6", ["Debrief with Colonel Drasky", "Debrief", "Debrief"], (getMarkerPos "debrief"), true] spawn BIS_fnc_taskCreate;  

deb = 0;

waitUntil {triggerActivated bludebrief}; 
sleep 1;
["tsk6","SUCCEEDED"] call BIS_fnc_taskSetState;
sleep 2;

voice = [[true, _drasky, "Baseplate3", bpact, "Renegade Actual, Baseplate Actual at your service. I am Colonel Drasky, Commander of US Special Operations in Stratis. You and your team did well today, and proved your worth. I will be deploying you again soon. For now though, get on the bird and head to the ship."], "G_fnc_Voice", true, false] spawn BIS_fnc_MP;
sleep 15;
_grpleader = leader group player;
{
_drasky action ["salute", format["%1",_x]];
} forEach units group player;
sleep .5;
_grpleader action ["salute", _drasky];
sleep 1.5;

[west, "tsk7", ["Board the Helicopter for Extraction", "Board Helicopter", "Board Helicopter"], (getPos _heli1), true] spawn BIS_fnc_taskCreate;  

wp2o1 = _heli1group addWaypoint [(getmarkerpos "off"), 0];
wp2o1 setWaypointType "MOVE";
wp2o1 setWaypointBehaviour "SAFE";
wp2o1 setWaypointSpeed "LIMITED";
wp2o1 setWaypointCombatMode "BLUE";
wp2o1 setWaypointStatements  ["true",""];

waitUntil {
_num = count playableUnits;
(({_x in (crew _heli1)} count playableUnits) == _num);
};

["tsk7","SUCCEEDED"] call BIS_fnc_taskSetState;

wp2h1 = _heli1crew addWaypoint [(getMarkerPos "exit"), 0];
wp2h1 setWaypointType "MOVE";
wp2h1 setWaypointCompletionRadius 100;
wp2h1 setWaypointSpeed "FULL";
wp2h1 setWaypointBehaviour "SAFE";
wp2h1 setWaypointCombatMode "RED";
wp2h1 setWaypointStatements  ["true",""];

sleep 15;
["end1",true,true] call BIS_fnc_EndMission;

Share this post


Link to post
Share on other sites

so after many hours of trial and error I successfully converted my mission to task scripts as grimes suggested, and I figured my results and methods might be helpful to people who don't have much/any experience using scripts.

I created a directory in my mission folder called Tasks where I stored all the task scripts I made and kept the same triggers I had synced with the task modules and called the scripts in their init fields.

the mission I made had multiple objectives that had to be unlocked one after the other for the mission to work, this is how I did it:

1: create 7 create task scripts and 7 set task state scripts in the Tasks folder (this number would obviously change depending on how many objectives your mission has)

2: name them task1.sqf - task7.sqf and state1.sqf - state7.sqf

3: in each state.sqf:

_task = ["[b][u]YOURTASKID[/u][/b]", player] call BIS_fnc_taskReal; 
_task setTaskState "Succeeded";  
titleText ["hint: objective complete", "PLAIN"];

4: in every task.sqf:

/*
private [
"_logic",
"_units",
"_activated",
"_owner",
"_taskOwner",
"_ID",
"_title",
"_desc",
"_marker",
"_destination"
];

_logic = [_this, 0, [b][u]Game Logic Where Task Marker Will Be[/u][/b], [objNull]] call BIS_fnc_param;
_units = [_this, 1, [[b][u]Task Owne[/u]r[/b]], [[]]] call BIS_fnc_param;
_activated = [_this,2,true,[true]] call bis_fnc_param;

if (_activated) then {

_owner = _logic getVariable ["Owner", 0];
_ID = _logic getVariable ["ID", "[b][u]Task ID[/u][/b]"];
_logic setVariable ["Task", _ID];

_taskOwner = [[b][u]Task Owner[/u][/b]];
switch _owner do {
	case 0: {
		_taskOwner = _units;
	};
	case 1: {
		{
			_xGroup = group _x;
			if !(_xGroup in _taskOwner) then {_taskOwner set [count _taskOwner,_xGroup];};
		} foreach _units;
	};
	case 2: {
		{
			_xSide = side _x;
			if !(_xSide in _taskOwner) then {_taskOwner set [count _taskOwner,_xSide];};
		} foreach _units;
	};
	case 3: {
		_taskOwner = true
	};
};

_title = _logic getVariable ["Title", "[b][u]Title of Objective[/u][/b]"];
_desc = _logic getVariable ["Description", "[b][u]Description of Objective[/u][/b]"];
_marker = _logic getVariable ["Marker", ""];
_destination = _logic getVariable ["Destination", 1];
_state = _logic getVariable ["State", "CREATED"];

[
	_taskOwner,
	_ID,
	[
		_desc,
		_title,
		_marker
	],
	if (_destination > 0) then {getposatl _logic} else {nil},
	_state
] call BIS_fnc_taskCreate;
};

4: in the init/activation field of whatever you would have synced to a set task state module:

[-2, {nul = player execVM "[b][u]State.sqf that affects the current objective[/u][/b]"}] call CBA_fnc_globalExecute; [-2, {nul = player execVM "[b][u]Next Objective to Be Unlocked[/u][/b]"}] call CBA_fnc_globalExecute

(if you don't have CBA you'll have to use an alternate method of executing the script globally)

Share this post


Link to post
Share on other sites

Nice. I shall dive in and see what gives.

I didn't understand why you said "they are in there" until you mentioned "inside the function (click on it in the editor)" and thats when I realized you meant to look at the "functions viewer". I kept wondering what you were talking about as I could not find any official page on these functions. I've come across that before where I will see a function but could not find the documentation.

Now I know, look at the functions viewer in the game. I've spent so much time in the wiki and forums that I forgot they would be in the game. Duh.

---------- Post added at 17:56 ---------- Previous post was at 17:21 ----------

A few questions then.

First, when using BIS_fnc_(assorted task functions), are they MP compatible? Right now, as I understand it if I were to do it myself, I would have to say create a trigger that would watch for some condition. Then upon that condition I could set a "servervariable" or a "publicvariable". This then lets me decide what to do with another trigger. For example I have an addAction on an object, and when anyone performs the action, the action sets a servervariable. A trigger then with condition isServer && var==true will do things that are mission related, as well as removing the object or just removing the addaction so it does not get activated again.

In the case of tasks, using the BIS_fnc methods, does the server alone perform them and any clients are "broadcasted" the task states? And what of JIP? Are current states set when JIP joins? Because if you start the init.sqf with the first taskcreate, but it has been achieved, what logic must you use, if any, to get/set the state properly. Hoping these BIS functions take care of it as I have not yet progressed to the fnc_MP that so many seem to be using.

@Grimes

I really like the way you handle multiple things in one script. I've been using triggers myself but coding everything using no syncs nor general "this" conditions really. This teaches one to construct code for sure lol. But, what is the difference between a waitUntil and a trigger waiting? I understand triggers test the condition every 500ms, and doesn't waitUntil test every frame (that is, server frame), would would be 50 times a second? Just wondering, in general for efficiency and specifically for dedicated servers whether those waitUntils might have a detrimental effect? I don't have a problem making trigger code that is more difficult if its more efficient.

And by efficient I mean to keep the server from bogging down so clients can enjoy the game at the max fps possible. Thats the downfall of this game, so many missions are sluggish. So I try to use no loops at all if I can help it, except triggers really. And so far, works really well with about 40 ai shooting at me and bounding around for cover etc.

Thanks for sharing this. Your example gives me some ideas on how to make my event scripting more modular :)

Share this post


Link to post
Share on other sites

Glad you both got it going. Like it said, it truly is the way to go!

BIS_fnc_taskrelatedthingshere are all MP compatible on their own, without wrapping them in BIS_fnc_MP. What you do is have it so ONLY the server executes the file involving the tasks (for instance, the file I pasted is all server executed only, no clients involved in order to avoid duplicates). The way the functions are setup, they broadcast to all machines AND are JIP compatible. Like I said, just execute via server only. Even as you change the status of a task only on the server, that change is broadcasted and the special hint is displayed on all machines, along with the change in tasks on the map screen.

For your trigger, you'd need to use a global variable, define it, then broadcast that via publicVariable, then reference that global variable from wherever. For instance, have globalvar = 0 on all clients, then when one client uses an action that was addAction'd (is local), globalvar = 1 will be included in that script, along with publicVariable "globalvar". Meanwhile, you'll have a waitUntil waiting for globalvar to == 1.

I very rarely use triggers unless I specifically need to, which I rarely do. Scripts are just much easier and a more organized way to control what is going on. Makes debugging easier as well. You are correct, a waitUntil checks every frame, however you can add a sleep to it since it reads left to right/up to down like any other block in a scope.

Edit: And the reason I wasn't using a sleep in my waitUntil's specifically for that script is (1) didn't think of it and (2) since that is all on 1 machine AND those are the only waitUntil's AND there is only 1 active at a time, I'm not worried about a performance issue. Its when you have 40 while {true} loops representing each player in a PvP game in a poor revive script that you have those problems.

Share this post


Link to post
Share on other sites

I've another question as I am drawn now like a fly to honey to BIS_fnc's lol.

Suppose I had a marker, which had alpha set so it would not show on player map. A trigger would normally onAct set this marker to visible using alpha, and delete prior marker. Maybe it would also createNext task and setState of current to "succeeded".

Now, how I currently do it is to have a trigger (or an addAction) that sets a variable, like svVAR=true and pvVAR=true. I would then have a trigger with a condition of isServer && svVAR. If svVAR is true and isServer, then I prepare the next events that are server side only. Another trigger uses on condition simply pvVar. If pvVAR returns true, then, assuming for all clients (and server I suppose) the task is updated and the markers hidden/shown.

Now I had assumed the logic that (on a dedicated server mind you) connected clients would obviously see these transistions as "thier" copies of the triggers would see the "publicVariabled" variables as true, and the onAct of "thier" copies of the triggers would handle what needed to happen on the client machines. I also assumed that because I was "publicVariable"-ing these variables, when a JIP joined in, they would get the same set of triggers as everyone else, and since the server "should" pass along any "publicVariables", the JIP clients triggers would do the same onAct that the connected clients recieved realtime (so to speak).

Now I begin to understand, with scheduled environments, there is no guarantee which trigger will fire first, so the potential is there at in my case, if my assumption is correct, the order of events may not hold true and thus marker1 may stay present and marker2 may stay present, or both be hidden, all depending on what fired first.

So, how does one find out or determine if a given BIS_fnc is going to broadcast to clients and JIP clients or not?

Share this post


Link to post
Share on other sites

BIS_fncs are the way to go if they exist (and there are a TON of new ones in the latest Dev Builds).

Functions vary on whether or not they do any public broadcasting. However, all of them can be wrapped by BIS_fnc_MP.

Specifically with setMarkerAlpha, that is a public/extra global command, where the result is broadcasted. IE, run it on server and the effects will be seen by all machines.

On the note of triggers, for that reason I suggest you avoid the use of triggers as much as possible and instead rely on script. So instead of having a trigger waiting for a variable to == something, have a script that is only executed server-side doing a waitUntil the variable == something.

Share this post


Link to post
Share on other sites

I noticed this task problem too, but I thought it was always me, never considered that it could be a problem on BI's end.

Share this post


Link to post
Share on other sites
;2630647']BIS_fncs are the way to go if they exist (and there are a TON of new ones in the latest Dev Builds).

Functions vary on whether or not they do any public broadcasting. However' date=' all of them can be wrapped by BIS_fnc_MP.

Specifically with setMarkerAlpha, that is a public/extra global command, where the result is broadcasted. IE, run it on server and the effects will be seen by all machines.

On the note of triggers, for that reason I suggest you avoid the use of triggers as much as possible and instead rely on script. So instead of having a trigger waiting for a variable to == something, have a script that is only executed server-side doing a waitUntil the variable == something.

Ah! Would it be safe to say then that any command found in the wiki that has a corresponding "local" command means there is one command for server side which broadcasts and another for local which does not?

And here I was letting every client do that on a trigger. Which begs the question, if a client runs that command, is it local only to the client? So the server must run it for it to be broadcast? Or, is it a command that no matter who runs it, it is broadcast?

I am wondering one more thing. Last night I started building up a script that would basically act like your example does, in that it sets tasks and waits for certain things to happen before setting new task or whatever. But it occurred to me that sometimes there is no specific order in which some things may happen.

Now, I am all about keeping server related functions/triggers/objects/etc on the server. Keeps the load where it needs to be. But, with many of the loops having the propensity to cause issues, and without my favorite "else if" statement, I am a bit lost as to how to "properly" develop a script that has the logic to watch for triggers/events that may happen at unknown times.

Examples are always best:

1 trigger to spawn ai patrol when approaching from the LZ. 1 target beyond the trigger. 2nd target further away, but unknown until some objective achieved at first target.

In a trigger environment, I could put a trigger near the second target that says in effect "if first target/task unmet or ai patrol not spawned etc, hint to player they missed something". Now this trigger would be in an odd order if it happened first, but knowing people I know it would happen lol.

In a trigger environment, it matters not which trigger is created first, only if its condition is met. In a scripted environment like you have shown, you go "in order" as it were. Now I know you don't have to, but what would the "best" way to approach this be, and I mean that from a pure code performance perspective. I would have, in other languages done something like this

(create first task)
while {a < b} do {
if x == 1 then
 (set task state/create new task)
elseif x==2 then
 (set some var/do some thing)
elseif (trigger xyz activated)
 (give some hint)
endif
}

In this manner one could watch for things of course. I know it can be done in arma scripting. But what would the best way be to go about doing it. Using case/switch or just nested if statements, or build an array of public/global variables and for/in them? Oh, I am sure I could hack my way through it, but before I do that and make non-optimal logic, may as well ask and try to do it right the first time.

But I really like the idea of any and all "loops" (which is what a trigger is basically) off the clients entirely. Right now my server on my mission is running 48-50fps while some clients can drop to visual fps of 30's in some cases. The less non-client centric loops/code they need to run, the more cycles they can devote to smooth performance. And that is after all the goal I have, to be able to play this game as smoothly as possible.

Thanks for feeding the infos this way!

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  

×