Jump to content
Sign in to follow this  
SSG-Kalle

AddWeapon with trigger for AI?

Recommended Posts

Im making a nightmission using UPSMON and want to give NVgoggles to the Takistani army soldiers to help them fight better in the dark. I only want to give it to the ai players that fight in a certain place on the map so i was thinking to do this by adding it by a trigger (activation: OPFOR / repeat). I cant get the rest to work thou, any suggestions on how to code this?

Share this post


Link to post
Share on other sites
{
if (side _x == EAST) then
{
	_x addWeapon "NvGoggles";
};
} forEach thisList;

Share this post


Link to post
Share on other sites

If you want it in a trigger, something:

{
if (!(_x hasWeapon "NVGoggles")) then {
	_x addWeapon "NVGoggles";
};
} forEach thisList;

would work but it wouldn't be very efficient since it's constantly looping when there's opfor in the trigger. If you're only spawning one or two groups at the same time you could set a countdown (to make sure that they've spawned) on the trigger and put it on once instead of repeat with the above code.

The best way would be to add the NVG's once the group has spawned. If you're using a script to spawn them you could do something like

if (((leader _group) distance (markerPos "aMarker")) < 300) then 
{
{
	if (!(_x hasWeapon "NVGoggles")) then {
		_x addWeapon "NVGoggles";
	};
}forEach units _group;
};

Edit:

{
if (side _x == EAST) then
{
	_x addWeapon "NvGoggles";
};
} forEach thisList;

You don't have to check the side if it's set to opfor :)

Edited by cuel

Share this post


Link to post
Share on other sites
if (((leader _group) distance (markerPos "aMarker")) < 300) then

{

{

if (!(_x hasWeapon "NVGoggles")) then {

_x addWeapon "NVGoggles";

};

}forEach units _group;

};

Where should i put this to get it to work with UPSMON?

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  

×