Jump to content
Sign in to follow this  
dub_r_totalwar

How to create custom action for mouse scroll menu

Recommended Posts

Alright, I have read a few threads about this but none matched what i was after.

I want to create an objective complete when it is triggered from an action from the mouse scroll wheel, for example.

The objective is to locate an enemy radio and disable it. I want to know how to add "disable" on my mouse wheel action menu when i am by the radio and when this action is complete it triggers the objective to be complete.

If anyone could help me it would be much appreciated!

Share this post


Link to post
Share on other sites

What I am trying to say is link above is a manual how to script a custom action to be added if conditions are met. To archive this in you mission file you will have to add a script with your code to make this work.

- in notepad create my_addaction_script.txt, rename it to my_addaction_script.sqf [ignore windows notifications] you will have a blank sqf file, ARMA native script format

- place my_addaction_script.sqf in your mission folder [...\Documents\Arma 3 - Other Profiles\Your Profile name\missions\your mission name\]

- in your units [the one in your mission who will have this action] initialization field add

my_custom_action = [this] execVM "my_addaction_script.sqf";

- create a trigger in game editor and in its conditions field type

RADIO_FOUND

- in same triggers onactivation field type for example

hint "Task accomplished, radio has been faund";

so now we have a blank script file, unit that will run this script and trigger that will do something [hint will be displayed in this case] on activation of our user action

last thing to add is code to my_addaction_script

so open that my_addaction_script.sqf file with notepad and add

//soldier that will have this useraction added

_soldier = _this select 0;

//defineing the condition variable [false since radio not jet faund by player]

RADIO_FOUND = false;

//adding new action to unit

_my_new_action = _soldier addAction ["Report radio faund!", "RADIO_FOUND = true;"];

//loop to check if the action has been used by user and then removed if so

while {true} do

{

If (RADIO_FOUND) Then {_soldier removeAction _my_new_action};

If (!alive _soldier) ExitWith {};

sleep 1.0;

};

run the mission and test it, also you can change the action conditions or how its displayed [look at the link I posted before, that will give you all details] and trigger can be customized to start any other action you wish.

does this makes it easier?

Share this post


Link to post
Share on other sites

Ah that worked ! Thank you !

Just one more question. How would i make it so that when me or a friendly was close to the radio that the Found radio action from the scroll menu would be activated for use so it eliminates some one at the start of the mission just doing it strait away with out finding the radio?

Share this post


Link to post
Share on other sites

Ok, to get that working you will need to add onother trigger with a small radius like 3 m for instance right where the actual item radio is located.

In that triggers settings make sure its activated by Anyone present, and in its condition field add

player in thislist;

and in same triggers on activation field add

SOLDIER_NEAR_RADIO = true; hint "Faund It";

what will happen a unit/player will activate this trigger once in its radius and set a condition to true, condition latter will be used by script to add custom user action so player can report what he faund.

Alter your my_addaction_script.sqf to look like this

//soldier that will have this useraction added

_soldier = _this select 0;

//defineing the condition variable [false since radio not jet faund by player]

RADIO_FOUND = false;

SOLDIER_NEAR_RADIO = false;

//adding new action to unit

//SOLDIER_NEAR_RADIO is a condition when to display the radio [triger will set this to true]

_my_new_action = _soldier addAction ["Report radio faund!", "RADIO_FOUND = true;", [], 5, false, true, "", "SOLDIER_NEAR_RADIO"];

//loop to check if the action has been used by user and then removed if so

while {true} do

{

If (RADIO_FOUND) Then {_soldier removeAction _my_new_action};

If ((!alive _soldier) or (RADIO_FOUND)) ExitWith {};

sleep 1.0;

};

give it a try

  • Like 1

Share this post


Link to post
Share on other sites

Awesome it worked fully !

I'm used to the little minor scripts and stuff, Just thought i'd step things up abit and get a hang of the more difficult ones.

Thanks for your time dude ! You helped out alot and put up with my stupidity haha

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  

×