Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Coding_Camel

Walk up to AI, gives action

Recommended Posts

Hi everyone, after searching for a while I couldn't find what I was looking for so I thought i'd post here. If there's already a post about this i'm sorry, I couldn't find it. I want to be able to walk up to an AI/object and have it give an action to my player. I tried doing this with a trigger but it gave the action to everyone on the server.

Share this post


Link to post
Share on other sites

Just add the action to the unit itself. So instead of adding it to the player, add it to the unit.

Share this post


Link to post
Share on other sites

Thanks guys, so I put in the AI that I want to walk up to, in his init line "this addAction ["Action","action.sqf"];"

Share this post


Link to post
Share on other sites

Here's some examples of addactions, 2 with conditions inside the action array.And how to add the action to the player, 3 units named wr1,wr2,wr3, and a destroyed vehicle.

//adds an action to a fuel tank that's only available when standing in front of the tank.
fTank addAction ["<t color='#A6C42'>[ Fill Up Fuel Can ]</t>","fuelcan.sqf",0, 100, true, true, "","[color=#ff0000](player distance (_target modelToWorld [-4,0,0]) < 3)[/color]"];

//adds an action to 3 named objects
{_x addAction ["<t color='#A6C42'>[ Scavenge For Spare parts ]</t>", "parts.sqf"]} forEach [color=#00ff00][wr1,wr2,wr3][/color];

//adds an action to destroyed vehicles
{_x addAction ["<t color='#A6C42'>[ Scavenge For Spare parts ]</t>", "parts.sqf", [], 1, false, true, "", "[color=#0000ff](!alive _target) && (side _this) == WEST  AND (vehicle _this) == _this[/color]"]} forEach vehicles;

Edited by Iceman77

Share this post


Link to post
Share on other sites

Hey ice, thanks for the help but when I use;

{_x addAction ["<t color='#A6C42'>[ Scavenge For Spare parts ]</t>", "parts.sqf"]} forEach [wr1,wr2,wr3];

on 3 objects waned wr1, wr2, and wr3 no action shows up.

Share this post


Link to post
Share on other sites

Thanks, i'll give it a go.

---------- Post added at 13:49 ---------- Previous post was at 13:47 ----------

Just realized it does work. Thanks for your help!

Share this post


Link to post
Share on other sites
Sign in to follow this  

×