Comrades in Arms Discussion Board

Full Version: selectable option/Addaction Help!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Allright, now I'm determined to finish this mission and I started from the very basics and I won't even try to use anything too fancy.

But only thing I would like to use in my mission, is a selectable option that will come to the side of the screen where the options of changing weapon and saying hi are.

How is it made so that the option comes when you are inside the trigger area and then you can select it? And then the trigger will be activated. (and then something happens, of course, but synchronization I understand already)
It's called Actions and can be enabeled by a trigger (e.g. if a player is close to the trigger) or be enabeled always.

Zandhaas

Hi,

You are looking for addAction. An explanation is provided on the BIKI.

BIS Wiki: addAction

Some very useful resources, although made for OFP and Armed Assault a lot is still relevant for Arma II.

Mr Murray editing guide for Armed Assault

Ueber Editor Tutorial

Regards,

Sander
Thanks, I just couldn't figure out the command despite spending some time on the BIWIki!

And thanks for the tutorials, I've looked at the PClipses video tutorials but they are quite limited on the "teaching" side. Already downloaded another of those two!
Another thing, but not about the same thing.

For some reason, when I put guns and ammo into a vehicle, allmost all of the ammo and weapons spawn outside the vehicle! I thought there was no limit in capacity of boxes and vehicles? Or has it been added?

Allright, I guess it was the limit, since a MTVR was able to take a lot more than a Stryker, problem solved!

Zandhaas

There have always been limits on the number of weapons and magazines that can be stowed in vehicles from OFP on. It is dependent on the (inheritance of) settings in the config. Luckily the Strykers in Arrowhead can carry some ammunition at all, those in Armed Assault were truely handicapped as they had zero capacity. Some vehicles have carrying capacity to spare beyond that defined as their default load, but the Strykers have not for an obscure reason. One would expect them to have the stowage capacity to sustain a squad for 72 hours, and the room in the config to stow several times the basic load of the 9 man squad of dismounts.

Regards,

Sander
Yea I noticed. And I were amazed how low capacity a MTVR has! Maybe a Ammo/unit capacity limit should be made. Like if you have too much of equipment, then you can't use all of the seats in the vehicle.

But can the "addaction" be used without an external script? I'm not too fond on using them yet! Tongue
I have made huge progress in learning missions making in few days, but variables and scripts other than very simple ones in init lines still go way over my head!

If not, then I'm in serious need of help! I can't figure out any other reasonable way to do the thing I have in my mission.

Zandhaas, can you give me a name of one of your missions where you use the "addaction". That might help a bit.

Ps. The murray's guide is quite low on information about this command.
Hola,

don´t mess with the Forums, buddy!

please remember the Netiquette: For each topic a thread. This will allow to find other users the solution for their questions!

Cheers

  Tony
The following IS about addAction tony  Big Grin
You can create your own addons which you invoke by addAction too. In OFP there is a Ammobug cleaner which works that way. Sadly enoug; this is also how most of the hacks works, so server admins ain't too found of them...
The "addaction" is what I need for "selectable option". So I believe that this is still very much on the topic of this thread.

And I changed the name of the topic to a more suitable one, Before you posted! Tongue

AND OVERLORD, please don't give me any harder solutions since I do not even understand the basics! Tongue
Hola,

the name of the Topic was fine, now its even better, but the ammo bug is another topic (if you want to discuss further), thats all. No harm done, just a reminder!

Greets

  Tony
hi,

addAction is very tricky in MP.

Don't forget that addAction is always local to the machine who's calling it, so be sure to use publicVariable to share the info throu every connected computers or it will not work in MP. You must also pay attention about JIP players but it's another topic (I don't want to piss off Tony  ;D)

example:

init.sqf
Code:
if ((!isServer) && (player != player)) then
{
  waitUntil {player == player};
};
nik_freehostage=false;
[hostage1,WestGrp1] execVM "free_hostage.sqf";
onPlayerConnected "[_id, _name, _uid] execVM ""playerConnected.sqf""";
player setVariable ["BIS_noCoreConversations", true];

if (true) exitWith {};

in the initfield of the hostage put:
Code:
this setCaptive true; nik_ac_free=this addAction ["Free Hostage", "action_free.sqf"]

Broadcast the variable nik_freehostage) throu the network like that clients and server know that the variable changed his state
action_free.sqf (this script is very important for MP)
Code:
/*
=========================================
Hostage Script for ArmA2 by Nikiler v0.9b
Broadcast the variable throu the network
contact: nikillerofp@hotmail.fr
=========================================
*/
nik_freehostage=true; publicVariable "nik_freehostage";
if (true) exitWith {};

This script makes the hostage join player group but you can also change the script for anything else like disable radio tower.
free_hostage.sqf
Code:
/*
======================================================
Hostage Script for ArmA2 by Nikiler v0.9b
Make the hostage join the player group
contact: nikillerofp@hotmail.fr
[hostageName, playerGrpName] execVM "free_hostage.sqf"
======================================================
*/
waitUntil {sleep 1; nik_freehostage};
_u=_this select 0
_grp=_this select 1;

sleep .5;
_u removeAction nik_ac_free;;
if (isServer) then {[_u] join _grp; doStop _u; _u setCaptive false};

if (true) exitWith {};

And now the variable update for JIP players (very important for MP):
playerConnected.sqf
Code:
/*
======================================================================
playerConnected Script for ArmA2 by Nikiler v0.9b
Update variables for JIP players
contact: nikillerofp@hotmail.fr
onPlayerConnected "[_id, _name, _uid] execVM ""playerConnected.sqf"""
======================================================================
*/
publicVariable "nik_freehostage";

if (true) exitWith {};

I made a demo to show you how it works

DEMO LINK

Hope it helps.

cya.

Nikiller.
hi,

addAction is very tricky in MP.

Don't forget that addAction is always local to the machine who's calling it, so be sure to use publicVariable to share the info throu every connected computers or it will not work in MP. You must also pay attention about JIP players.

example:

init.sqf
Code:
if ((!isServer) && (player != player)) then
{
  waitUntil {player == player};
};
nik_freehostage=false;
[hostage1,WestGrp1] execVM "free_hostage.sqf";
onPlayerConnected "[_id, _name, _uid] execVM ""playerConnected.sqf""";
player setVariable ["BIS_noCoreConversations", true];

if (true) exitWith {};

in the initfield of the hostage put:
Code:
this setCaptive true; nik_ac_free=this addAction ["Free Hostage", "action_free.sqf"]

Broadcast the variable nik_freehostage) throu the network like that clients and server know that the variable changed his state
action_free.sqf (this script is very important for MP)
Code:
/*
=========================================
Hostage Script for ArmA2 by Nikiler v0.9b
Broadcast the variable throu the network
contact: nikillerofp@hotmail.fr
=========================================
*/
nik_freehostage=true; publicVariable "nik_freehostage";
if (true) exitWith {};

This script makes the hostage join player group but you can also change the script for anything else like disable radio tower.
free_hostage.sqf
Code:
/*
======================================================
Hostage Script for ArmA2 by Nikiler v0.9b
Make the hostage join the player group
contact: nikillerofp@hotmail.fr
[hostageName, playerGrpName] execVM "free_hostage.sqf"
======================================================
*/
waitUntil {sleep 1; nik_freehostage};
_u=_this select 0
_grp=_this select 1;

sleep .5;
_u removeAction nik_ac_free;;
if (isServer) then {[_u] join _grp; doStop _u; _u setCaptive false};

if (true) exitWith {};

And now the variable update for JIP players (very important for MP):
playerConnected.sqf
Code:
/*
======================================================================
playerConnected Script for ArmA2 by Nikiler v0.9b
Update variables for JIP players
contact: nikillerofp@hotmail.fr
onPlayerConnected "[_id, _name, _uid] execVM ""playerConnected.sqf"""
======================================================================
*/
publicVariable "nik_freehostage";

if (true) exitWith {};

I made a demo to show you how it works

DEMO LINK

Hope it helps.

cya.

Nikiller.
hi,

addAction is very tricky in MP.

Don't forget that addAction is always local to the machine who's calling it, so be sure to use publicVariable to share the info throu every connected computers or it will not work in MP. You must also pay attention about JIP players but it's another topic (I don't want to piss off Tony  ;D)

example:

init.sqf
Code:
if ((!isServer) && (player != player)) then
{
 waitUntil {player == player};
};
nik_freehostage=false;
[hostage1,WestGrp1] execVM "free_hostage.sqf";
onPlayerConnected "[_id, _name, _uid] execVM ""playerConnected.sqf""";
player setVariable ["BIS_noCoreConversations", true];

if (true) exitWith {};

in the initfield of the hostage put:
Code:
this setCaptive true; nik_ac_free=this addAction ["Free Hostage", "action_free.sqf"]

Broadcast the variable nik_freehostage) throu the network like that clients and server know that the variable changed his state
action_free.sqf (this script is very important for MP)
Code:
/*
=========================================
Hostage Script for ArmA2 by Nikiler v0.9b
Broadcast the variable throu the network
contact: nikillerofp@hotmail.fr
=========================================
*/
nik_freehostage=true; publicVariable "nik_freehostage";
if (true) exitWith {};

This script makes the hostage join player group but you can also change the script for anything else like disable radio tower.
free_hostage.sqf
Code:
/*
======================================================
Hostage Script for ArmA2 by Nikiler v0.9b
Make the hostage join the player group
contact: nikillerofp@hotmail.fr
[hostageName, playerGrpName] execVM "free_hostage.sqf"
======================================================
*/
waitUntil {sleep 1; nik_freehostage};
_u=_this select 0;
_grp=_this select 1;

sleep .5;
_u removeAction nik_ac_free;
if (isServer) then {[_u] join _grp; doStop _u; _u setCaptive false};

if (true) exitWith {};

And now the variable update for JIP players (very important for MP):
playerConnected.sqf
Code:
/*
======================================================================
playerConnected Script for ArmA2 by Nikiler v0.9b
Update variables for JIP players
contact: nikillerofp@hotmail.fr
onPlayerConnected "[_id, _name, _uid] execVM ""playerConnected.sqf"""
======================================================================
*/
publicVariable "nik_freehostage";

if (true) exitWith {};

I made a demo to show you how it works.

http://www.multiupload.com/FOZICY4EI6

Hope it helps.

cya.

Nikiller.