Jump to content
Sign in to follow this  
Whiplash

AddAction: general questions for MP // VKing's APP-64 markers not showing

Recommended Posts

While working on some missions two separate problems came up and I decided I will just post them all in one thread. If you can only comment on one of the problems, feel free to do so anyway and skip the other.
 

AddAction command (BIS)
 
As I worked on some kind of Tactical Operation Center, I started to use BIS's "AddAction" command to allow the player to be able to access a variety of different options while looking at a object. Although this works out pretty well in SP, I would like to consult some of the more experienced scripters/ mission makers about its usefulness/ usage in an MP environment.
 
[A.1] Generally speaking: Is the usage of AddAction possible in MP and what does one have to take into account when doing so? As far as I can see, the effect of the command is local. Sadly I have very little knowledge regarding locality in the arma-verse (one of the reasons I usually try to avoid making any scripts myself) and do not know what that means. In particular, what happens in these two cases:

  • Player A activates a AddAction command. For him, after he activated that action he has access to two more AddAction commands. This was due to the condition of the AddAction being activated by altering a variable status set on the object.
    [A.2] Will Player B still see the original AddAction option or can he too now see the additional commands?
  • Player A activates a AddAction command. This fires a script that will change the texture of a monitor object in front of him (using "setObjectTextureGlobal").
    [A.3] Will Player B see this texture being applied to the monitor object or will he still see a "black" screen?

I do not know if there are any alternatives to AddAction. Even with a later addition of the ACE interaction interface, controlling different objects with that feature might not be as "clean" looking as with the scroll wheel action menu.
 
[A.4] Also, is there a limit on how many AddAction commands can be added to a object or in total to a mission? Last thing I want is to cause performance issues because of too many options. While testing in the editor I noticed that sometimes some of the AddAction commands did not show up on the object even though they did before and I have not touched that particular piece of code, nor does any other code interfere with it.
 
 
VKing's APP-64 markers
 
Another problem I ran across was the correct usage of VKing's APP-64 markers. I tried to stick to the documentation available in the forums, yet not everything seems to work out for me.
 
Following code works perfectly fine:

// Static markers
["vk_marker_blu_fpbE_hq",getPos fobE_tent_toc,west,["hq","inf","motor","inst","reduced","B"],0,2,west,"292/D",false] call vk_fnc_addMarker;
["vk_marker_blu_fpbW_hq",getPos fobW_container_toc,west,["hq","armor","arty","inst","reduced","Z"],4,2,west,"ADD",false] call vk_fnc_addMarker;

"fobE_tent_toc" and "fobW_container_toc" are placed objects and the markers show up perfectly on the objects position. Small problem though:

[V.1] What value would I have to enter if I do not wanna set a "group size" for one of the markers? For instance if I want to remove the "0" from the first marker above (5th parameter).
 
Now, when I tried to implement a Blue Force Tracker enabled marker attached to a unit or an empty vehicle, I got nothing. No script error and no marker in game. Following code was used:

// BFT markers (Attached to Units)
["vk_marker_blu_test",tester_1,west,["hq","inf","motor","reduced"],4,1,west,"292/D",true] call vk_fnc_addMarker;
["vk_marker_blu_fennek_1",fennek_1,west,["armor","recon","wheeled","E"],0,1,west,"5./292/D",true] call vk_fnc_addMarker;
 
// BFT enabled vehicles and units
fennek_1 setVariable ["vk_mods_markers_bft",[true,false,false,false,false],true];

The two markers in this example will not be shown on the map. Nor the one attached to "tester_1" or the one attached to "fennek_1". Both objects are played and named in the editor, one is a playable unit (BLUFOR) and one is an empty vehicle (Fennek, INSURGENTS).

That is basically all the code I got so far and only the two markers from the first example show up. [V.2] Is there anything wrong with the code or the implementation?
 
[V.3] How would I correctly initialize the markers for the desired effect? Do I have to run the script server side or client side? Again, locality is not something I am well-versed in.
 
 
I would really appreciate any help received. If you need more information, let me know and I will post it here. I intentionally did not paste in all the code from all the scripts related to the AddAction problem as it would be too much and as far as I can tell has no relevance to the question at hand.
 
Thanks in advance!
-Whiplash

Share this post


Link to post

A1: It's possible in MP. It's local in effect. If you want it to have some kind of global effect, you'll need to have it run global commands (createVehicle, setPos, etc; anything that in the wiki has the "EG" (Effect Global) icon).

A2: Player B will only see the original action. If you want to have different branches of actions to be global, you'll need to have the main action change a public variable.

A3: All players should see the new texture, because setObjectTextureGlobal is a global command. Commands that aren't global will only have effect on player A's computer.

A4: Lots. Hundreds? I've never checked. You should be concerned with performance, as each addAction runs a condition loop that iterates frequently. If the loop is attached to a non-player object, it starts looping when the player is near the obect (can't remember the distance), and if it's attached to the player, it will always loop. They can eat up performance fast.

Edited by voiper

Share this post


Link to post

[...]

A2: Player B will only see the original action. If you want to have different branches of actions to be global, you'll need to have the main action change a public variable.

A3: All players should see the new texture, because setObjectTextureGlobal is a global command. Commands that aren't global will only have effect on player A's computer.

[...]

 

[A.2] So, if the variable I have stored in the object is initialized via

fobE_toc_keyboard_1 setVariable ["terminalOn", false, true];

and if I use the same piece of code inside the script that is activated to change the condition of the variable to 'true', does that mean that the variable is globally changed? That's how I would interpret the wiki entry about 'setVariable' from BI.

[A.3] I have also checked all the scripts I am calling using AddAction and all the commands seem to have a global effect. So I guess that should be fine then.

 

[...]

A4: Lots. Hundreds? I've never checked. You should be concerned with performance, as each addAction runs a condition loop that iterates frequently. If the loop is attached to a non-player object, it starts looping when the player is near the obect (can't remember the distance), and if it's attached to the player, it will always loop. They can eat up performance fast.

 

[A.4] Not directly addressed at you, you have already been of great help, but does anyone have any rough idea how many AddAction commands can be used in a mission without having too much of an performance decrease? So far I guess I will end up with around 50 total (if all the required variables are set, thus the number is way lower if the TOC terminals are not used). And by mission design so far some players will always be in range of those objects.

I just don't know if we are talking about 100+ when performance issues may occur or if 10 is already the limit. Before progressing with the mission I will then probably sacrifice some functionality for better performance if that number is already critical. Or I might look into adding ACE interaction commands later if that would help with performance. Might just make the usage of the features more complicated.

 

Thanks for the quick answer!

Share this post


Link to post

[A.2] So, if the variable I have stored in the object is initialized via

fobE_toc_keyboard_1 setVariable ["terminalOn", false, true];

and if I use the same piece of code inside the script that is activated to change the condition of the variable to 'true', does that mean that the variable is globally changed? That's how I would interpret the wiki entry about 'setVariable' from BI.

[...]

 

[A.2] Syntax: objectName setVariable [name, value, public]

public (Optional): Boolean - Only available for Object types and (since Arma 1.48) for missionNamespace. If public is true then the value is broadcast to all computers.

 

So yes, the public Boolean tells the variable whether it's public or not. Setting it as public will change the value globally for all players and server. But it doesn't change dynamically, you always have to request the current value manually via getVariable. 

Another option is "publicVariabe" which works differently and broadcasts the variable to all machines on the Server without the need to request the current value. Using publicVariable too frequently in a given period of time can cause other parts of the game to experience bandwidth problems. I don't know if the same applies to getVariable/setVariable.

Edited by AndyKrause

Share this post


Link to post

[A.2] Syntax: objectName setVariable [name, value, public]

public (Optional): Boolean - Only available for Object types and (since Arma 1.48) for missionNamespace. If public is true then the value is broadcast to all computers.

 

So yes, the public Boolean tells the variable whether it's public or not. Setting it as public will change the value globally for all players and server. But it doesn't change dynamically, you always have to request the current value manually via getVariable. 

Another option is "publicVariabe" which works differently and broadcasts the variable to all machines on the Server without the need to request the current value. Using publicVariable too frequently in a given period of time can cause other parts of the game to experience bandwidth problems. I don't know if the same applies to getVariable/setVariable.

 

[A.2] I don't really understand that. If the variable I set is changed globally by activating the script, why do I have to use other commands again to acquire the current status. Might be just my non existing understanding, but when its effect is global, then isn't that the desired effect? Player B will see the additional AddAction commands because Player A activated the script that set the variable (globally) to true which is the condition needed for the other two AddActions to show up.

If someone activates the script again the variable will again be switched to false (globally) thus removing those commands for Player A and Player B. Why do I have to bother with an additional getVariable command then?

 

If you can elaborate the "But it doesn't change dynamically..." part. No clue what that is supposed to mean.

Edited by Whiplash

Share this post


Link to post

It's hard to explain as I am not sure if I understand it fully myself, but you must "update" the variable on every client via "getVariable" everytime you want to use it. It does not update itself "dynamically", you always have to ask the current status via "getVariable". I believe setVariable is more usefull for more complicated things like strings and similar. If it's just a true/false thing you might also try to use publicVariable as it updates the Variable dynamically on all clients at the same time. You don't have to update manually with another command.

 

As the name of the command already tells you "setVariable" is setting a variable inside of an object, a keyboard in your example. Every time you want to use the latest value of this variable you have to retrieve it from said object via getVariable. The "publicBoolean" just decides wether this value can be retrieved globally from all machines on the server or if it is just local to the machine that used the setVariable command.

Edited by AndyKrause

Share this post


Link to post

Anyone any idea why the APP-64 markers won't show up in my example above [V.1-V.3]? I know that the markers are more or less frequently used in missions so I was hoping that at least some here would know how to correctly use them and thus being able to see where I made a mistake.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...