Jump to content

Salty Bear

  • Content Count

  • Joined

  • Last visited

  • Medals

Community Reputation

2 Neutral

About Salty Bear

  • Rank
    Private First Class

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Salty Bear

    AI Helicopter search light

    It flickers because the helicopter's pilot is constantly turning the light off every time the while-do loop turns the light on. Since Arma 3 v1.92, there is a new disableAI command to work around this problem. Here's what I used: //helo is the name of my helicopter in the editor. driver helo disableAI "LIGHTS"; //Stops the driver from turning the searchlight/headlight off (or on, for that matter). helo setPilotLight true; //turns on the searchlight/headlight of the helo.
  2. Salty Bear

    Make AI pick up Backpack from ground

    I've been trying to get this working with addAction, and just can't figure it out. I added the following to a unit's INIT: this addAction ["<t color='#FF0000'>Put on Pack</t>","_this action ['AddBag', (nearestObject [_this, 'WeaponHolder']), typeOf firstBackpack (nearestObject [_this, 'WeaponHolder'])];","",10,true,true,"",""]; It gives me an error with nearestObject, saying Type Array, Expected Number.
  3. So, what seems to work is to set up a disableAI command on the helicopter pilots to keep them from taking off. Something like: waitUntil {helo getPosATL select 2 == 0}; //using isTouchingGround makes the helo hover low (but not low enough to get back in) instead of touch down - I haven't tested helo getPosATL select 2 == 0 to see if it works any better. _heloDrivers = [heloD, heloCD]; //I named the helo's pilot and copilot heloD and heloCD in the editor. {_x disableAI "ALL"} forEach _heloDrivers;
  4. Thanks, GOM. I guess I just need more players so someone can be a human pilot.
  5. I'm having the same problem. Also, once the helo lands so that my team and I can get out, instead of waiting on the ground for the Condition in its Land waypoint to be fulfilled, it immediately takes off and hovers dozens of meters above the ground - so there's no way for me to get back in later. Why doesn't the AI stay landed?
  6. Thanks HazJ. I use the "_x forEach" construction for a lot of things, but it didn't occur to me to use it there. Would it work if I did this?: _fgrp = units group flead; //includes flead, fmark, far, fmedic, and fuav. { _x setPosATL (_x modelToWorld [0, 0, 2500]); } forEach _fgrp;
  7. Okay, so I think I've found a workaround. The key was to use the "CARELESS" behaviour. The CARELESS behaviour does override the COMBAT behaviour, although COMBAT does try to reassert itself, so I used sleep to make sure that CARELESS was the last thing on the AI's mind. //Waypoint to rally point: _wp = _fgrp addWaypoint [getMarkerPos "rallyPointMarker",0]; _wp setWaypointType "MOVE"; _wp setWaypointSpeed "LIMITED"; _wp setWaypointBehaviour "CARELESS"; _wp setWaypointVisible false; //_fgrp setCurrentWaypoint [_fgrp, 1]; sleep 5; flead setBehaviour "CARELESS"; So they walk slowly to the waypoint with their weapons lowered.
  8. Tried it, no effect. I used the debug console to try to get the group leader (named flead) to stop being in "COMBAT" behaviour, but to no avail: behaviour flead; //returns "COMBAT" group flead setCurrentWaypoint [group flead, 1]; [group flead, 1] setWaypointBehaviour "SAFE"; //does not affect behaviour - still "COMBAT" currentwaypoint group flead setWaypointBehaviour "SAFE"; //does not affect behaviour - still "COMBAT" flead setBehaviour "SAFE"; //does not affect behaviour - still "COMBAT"
  9. Everyone starts up in the air with parachutes (units are named flead, fmark, far, fmedic, and fuav) : //Waaaaaay up in the sky: flead setPosATL (flead modelToWorld[0,0,2500]); fmark setPosATL (fmark modelToWorld[0,0,2500]); far setPosATL (far modelToWorld[0,0,2500]); fmedic setPosATL (fmedic modelToWorld[0,0,2500]); fuav setPosATL (fuav modelToWorld[0,0,2500]); They fall, and open their parachutes at default altitude. The next part of the script creates triggers to check each unit to see if it's a player, then opens the player's chute automatically too (I'm just posting fmark's trigger, but there are four - one for each playable unit (flead is not playable)): //Auto open parachute at 350 M: _fmarkChuteOpenTrig = createTrigger ["EmptyDetector", getMarkerPos "dropZoneMarker"]; _fmarkChuteOpenTrig setTriggerArea [2000, 2000, 0, false, 350]; _fmarkChuteOpenTrig setTriggerActivation ["WEST", "PRESENT", false]; _fmarkChuteOpenTrig setTriggerStatements ["(isPlayer fmark) and (fmark in thisList)", "fmark action ['openParachute']; deleteVehicle thisTrigger", ""]; Since the wind blows the AI all around, I have four more triggers to make sure the NPCs make it to their drop zone (again, only posting one of the triggers for you to see): //Make sure AI lands in the drop zone: _fleadDropZoneTrig = createTrigger ["EmptyDetector", getMarkerPos "dropZoneMarker"]; _fleadDropZoneTrig setTriggerArea [2000, 2000, 0, false, 80]; _fleadDropZoneTrig setTriggerActivation ["WEST", "PRESENT", false]; _fleadDropZoneTrig setTriggerStatements ["(!(isPlayer flead)) and (flead in thisList)", "flead setPosATL [getMarkerPos 'fleadDZMarker' select 0, getMarkerPos 'fleadDZMarker' select 1, getPosATL flead select 2]; deleteVehicle thisTrigger", ""]; Once the player is 100 meters from the ground, the script checks to see if all 5 units are still alive. If everyone survived the jump (even using allowDamage false does not keep the stupid AI from dying on parachute jumps), then as soon as they're all on the ground, they get a waypoint (the group _fgrp) was defined already, I just didn't include it): waitUntil {getPosATL player select 2 < 100}; //Go to the next script once everyone's on the ground: if ({alive _x} count units group player == 5) then { waitUntil { (isTouchingGround flead) and (isTouchingGround fmark) and (isTouchingGround far) and (isTouchingGround fmedic) and (isTouchingGround fuav) }; //Waypoint to rally point: _wp = _fgrp addWaypoint [getMarkerPos "rallyPointMarker",0]; _wp setWaypointType "MOVE"; _wp setWaypointSpeed "LIMITED"; _wp setWaypointBehaviour "SAFE"; _wp setWaypointVisible false; The problem: the AI do not treat this waypoint like a LIMITED, SAFE waypoint. They are running around with their flashlights on, and they act like they're trying to secure the area around the waypoint (they take FOREVER) before they finally reach the waypoint. Additionally, all of the successive waypoints (even though identical Speed and Behaviour) act like this. The only way I've found to fix this is to start the player on the ground. If the player doesn't join the rest of the group for the parachute jump, it all works just fine. I would greatly appreciate any help. Thank you in advance.
  10. Haven't tried your suggestions yet, but I just came across this: http://www.armaholic.com/forums.php?m=posts&q=11845 What if I did the following: switch (random floor(2)) do { case 0: { hostage setPosASL [7214.22,2217.43,6.52]; hostage setDir 260; "hostageLocationMarker" setMarkerPos [7214.22,2217.43]; "hostageLocationMarker" setMarkerAlpha 1; }; case 1: { hostage setPosASL [6905.65,2487.33,10.5]; hostage setDir 319; "hostageLocationMarker" setMarkerPos [6905.646,2487.333]; "hostageLocationMarker" setMarkerAlpha 1; }; };
  11. Thank you all so much for your feedback! I will try your suggestions as soon as I get the chance, and let you know how it works. I'm tempted to try sarogahtyp's suggestion first, because it's easier to wrap my brain around the params function. Although I can see that pierremgi's script does the same thing, all that select business - even though I understand how it's supposed to work - is just voodoo to me. I'm not familiar with params, but it looks like params is kind of a shortcut for the select function in this case. This is surprising to me, because I thought that setMarkerPos required [x,y] coordinates, while setPosASL required [x,y,z]. Nothing will explode if I feed setMarkerPos [x,y,z]? Yes, I know. That's what I always used to do, but I want the hostage to move to his location later in the scenario, because I want the player to have to listen in on a conversation the bad guys are having about the hostage's location before the player can go looking for the hostage, and I don't want the player to accidentally find the hostage before doing that. So when the scenario starts I'm placing the hostage someplace far, far away on the map, then trying to setPosASL him to one of several positions after activating a trigger. Also, I'm fascinated by scripting, and want to learn how to do things without the editor.
  12. So, I am trying to randomize the location of a hostage (named hostage) and a map marker. Here's one possibility: hostage setPosASL [7214.22,2217.43,6.52]; hostage setDir 260; "hostageLocationMarker" setMarkerPos [7214.22,2217.43]; "hostageLocationMarker" setMarkerAlpha 1; Here's another: hostage setPosASL [6905.65,2487.33,10.5]; hostage setDir 319; "hostageLocationMarker" setMarkerPos [6905.646,2487.333]; "hostageLocationMarker" setMarkerAlpha 1; I have a total of eleven of those. What I want to do is have the game randomly pick one and run it. I thought of trying to assign each possibility a variable, like this: _hostageSpawn = [hostage setPosASL [7214.22,2217.43,6.52]; hostage setDir 260; "hostageLocationMarker" setMarkerPos [7214.22,2217.43]; "hostageLocationMarker" setMarkerAlpha 1;]; and _hostageSpawn_1 = [hostage setPosASL [6905.65,2487.33,10.5]; hostage setDir 319; "hostageLocationMarker" setMarkerPos [6905.646,2487.333]; "hostageLocationMarker" setMarkerAlpha 1;]: but that doesn't work. I tried using {/*code*/} instead of [/*code*/], but to no avail. I think I even tried using ["/*code*/"]. I thought that if I could figure out how to do that, then I could call them with selectRandom like this: selectRandom [_hostageSpawn,_hostageSpawn_1]; But I'm not even sure that's the way to do it. Can anyone please help me? Thanks in advance.
  13. Salty Bear

    waitUntil Hangup

    Wow thanks so much! I didn't know that "fleeing" was a thing. I will give it a try.
  14. Salty Bear

    waitUntil Hangup

    Thank you! It works! Sometimes I run into the problem where the last ambusher runs away, and I can't kill him in order to advance the script. If you have any suggestions, I'd be very grateful.
  15. I am executing this code in a .sqf using execVM via a trigger, but waitUntil isn't working. That is, after _cnt == 0 (after I kill all the units in the _ambushers group), the script does not continue. However, if after killing _ambushers, if I reexecute the script via the debug console in-game, then it seems to work just fine - it skips the first titleText and goes right into the code below waitUntil {_cnt == 0}. But the whole point of waitUntil is to NOT have to reexecute anything. What gives? Is it a waitUntil issue, or a count issue? What am I doing wrong? _ambushers = group ambusher; _cnt = count units _ambushers; if (_cnt > 0) then { titleText ["CREWMAN: TOOK YOU LONG ENOUGH! SHOOT THEM!", "PLAIN DOWN", 4]; titleFadeOut 1; }; waitUntil {_cnt == 0}; sleep 2; if (alive crewman) then { toolkitbox addItemCargo ["Toolkit",1]; titleText ["CREWMAN: Whew! Thanks for your help, guys.", "PLAIN DOWN", 4]; titleFadeOut 1; sleep 6; titleText ["CREWMAN: There is a repair kit in my equipment box. Take it for your truck. Just in case.", "PLAIN DOWN", 4]; titleFadeOut 1; sleep 6; ["tsk03","SUCCEEDED"] call BIS_fnc_taskSetState; sleep 3; ["tsk02b","ASSIGNED"] call BIS_fnc_taskSetState; } else { titleText ["PLAYER: He's dead. Looks like we failed.", "PLAIN DOWN", 4]; titleFadeOut 1; sleep 6; ["tsk03","FAILED"] call BIS_fnc_taskSetState; sleep 3; ["tsk02b","ASSIGNED"] call BIS_fnc_taskSetState; };