Jump to content
Haymaker

Trouble with AI triggering flare by eventhandler

Recommended Posts

 

Not sure why I can't seem to get this to work. I get the script error "Type array, expected object, location". This also occurred when I tried to use modelToWorld. However, the script works correctly when executed on the player via debug console. Any help is much appreciated! Thanks!

// Excerpted from another script of mine			

// Create the random unit on position of the recruitment station
_unit = _group createUnit [_unitType, _spawnPosition, [], 0, "FORM"];
_unit execVM "scripts\hm_talibanLoadoutGenerator.sqf";

// Create a flare soldier
if (random 1 < .5) then 
{							
     _unit addEventHandler ["firedNear", {_this execVM "scripts\flareSoldier.sqf";}];
};
// flareSoldier.sqf

if (!isServer) exitWith {};

_flares = ["F_40mm_red","F_40mm_green"];
_flare = selectRandom _flares;

if (daytime >= 18 || daytime < 6) then 
{
	_flareSpawn = _flare createVehicle position _this; 
};

Share this post


Link to post
Share on other sites

_unit addEventHandler ["firedNear", {(_this select 0) execVM "scripts\flareSoldier.sqf";}];

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

×