Jump to content
  • 0

AI Update marker


juandayz

Question

Hello, i need set up an inmortal AI who moves around the map whit a updated marker.

try calling in init at very bottom:

[] execVM "custom\updatedmarker.sqf";

and into updatedmarker.sqf this code:

Spoiler

if(isServer) then{
    [] spawn {
        While{not isNull <GUE_Worker2>; sleep 0.5} do{
            "inmortalAI" setMarkerPos getPos <GUE_Worker2>;
        };
    };
};

but dsnt work. any idea?

here is my unit code:

Spoiler

_unit_3 = objNull;
if (true) then
{
  _this = _group_1 createUnit ["GUE_Worker2", [10256.297, 3207.6804, 1.5258789e-005], [], 0, "CAN_COLLIDE"];
  _unit_3 = _this;
  _this setDir 107.50806;
  _this setVehicleVarName "inmortal";
  trader = _this;
  _this setVehicleInit "inmortal allowDamage false";
  _this setUnitAbility 0.60000002;
  if (true) then {_group_1 selectLeader _this;};
};

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Every "OBJECT" in arma is categorized as an "vehicle", also units. This means, isNull is the correct one in this case. If the unit wouldn´t exist, it would be a nullobject.

Assumed you created a marker before and named the marker "inmortalAI" you can try this:

if(isServer)then{
    [] spawn {
	waitUntil{!isNull "inmortal"};
        while{true}do{
		uiSleep .5;
		"inmortalAI" setMarkerPos (getPos "inmortal");
		if(isNull "inmortal")exitWith{}
	}
    };
};

cheers

Link to comment
Share on other sites

  • 0

I found this way to make it

Spoiler

_unit_11 = objNull;
if (true) then
{
  _this = _group_2 createUnit ["INS_Bardak_DZ", [2011.6644, 2244.1541, 2.8610229e-006], [], 0, "CAN_COLLIDE"];
  _unit_11 = _this;
  _this setVehicleVarName "myunit";
  myunit = _this;
  _this setVehicleInit "deleteopfor attachTo[myunit,[0,0,0]];";
  myunit addEventHandler ["handleDamage", {false}];
  _this setUnitAbility 0.60000002;
  if (false) then {_group_2 selectLeader _this;};
};

/////////////////////////////////////marker
_this = createMarker ["marker-follow-myunit", [2011.6644, 2244.1541, 2.8610229e-006]];
_this setMarkerText "bluemarker";
_this setMarkerShape "ELLIPSE";
_this setMarkerType "mil_box";
_this setMarkerColor "ColorBlue";
_this setMarkerBrush "Solid";
_this setMarkerSize [50, 50];
_marker_0 = _this;

///////////////////////////////trigger
_this = createTrigger ["EmptyDetector", [2011.6644, 2244.1541, 2.8610229e-006]];
_this setTriggerArea [5, 5, 0, false];
_this setTriggerActivation ["EAST", "PRESENT", true];
_this setTriggerTimeout [10, 10, 10, false];
_this setTriggerStatements ["this AND (getPosATL (vehicle player) select 2) < 3;", "{deleteVehicle _x} forEach thisList;", ""];
deleteopfor = _this;
_trigger_0 = _this;

Tnks a lot!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...