Jump to content

ACE action from array difficulties.

Recommended Posts

Hello, I am currently trying to use the ace_interact_menu_fnc_addActionToObject command in one of my missions.


The issue I am running into is as follows:


It works fine in it's current state, that of using an array of possible hints to give to the player when they Interact with a vehicle to "Search" It, and it also is set up to give a random response.


What I need some help with is I would like to be able to go to a different vehicle down the road, and have a different response each time I move to a new vehicle, but still have the same response if I re-check the earlier vehicles that already were "Searched".


Here is the code I have so far that works one time only, on the initial use of the command. I am trying to run it on empty vehicles spawned from a separate script.

private "_veh";

_veh = _this select 0;
if (!local _veh) exitWith {};

_vehHintArray = [];

random1 = _vehHintArray select round random count _vehHintArray;

_action = ["Interactions", "Search Vehicle", "", {hint random1}, {true}, {}, [], [0,0,0], 5] call ace_interact_menu_fnc_createAction;
[_veh, 0, [], _action] call ace_interact_menu_fnc_addActionToObject;

Share this post

Link to post

// Register these variables in the preinit scope (global).
SearchResponses = ["Drugs", "No Drugs", "Nuke in the trunk", "No nuke in the trunk"];
SearchAction = ["Interactions", "Search Vehicle", "", {hint (SearchResponses select ((_this select 0) getVariable ["ResponseIndex", 0]))}, {alive (_this select 0)}, {}, [], [0,0,0], 5] call ace_interact_menu_fnc_createAction;

// Run this on every vehicles (server).
_randomIndex = (floor random (count SearchResponses));

_veh setVariable ["ResponseIndex", _randomIndex, true];
[_veh, 0, [], SearchAction] call ace_interact_menu_fnc_addActionToObject;

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.

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.

  • Create New...