Jump to content

id_steacie

Member
  • Content Count

    8
  • Joined

  • Last visited

  • Medals

Everything posted by id_steacie

  1. Sorry for reviving an old thread but this was exactly the question I had and was hoping maybe something had been changed since. If not it there some way to adjust this globally? Since apparently the tasks complete in the wrong order because of the priority they have been assigned is it possible to change this priority across the board. It just seems kinda stupid the way it is now. I can't think of a single situation where I would want tasks to be ordered where the new one gets assigned before the initial one states its completed. I've been resorting to just making a copy of the completion trigger with a 2 second delay but it seems like a pretty inefficient system to need 4 modules and 4 triggers just to make one task.
  2. id_steacie

    Help with setting array

    So small update. I've had some success by changing the way the player is detected from setCaptive to AI behaviour. IE rather than the player being set captive then not set captive when they enter the vision cone the AI is set to careless then changed to combat when the player is in the vision zone. I also realized why it seemed like the script applied to all units was because setcaptive is linked to the player not the AI so by having the script set the player captive meant that no unit would shoot him. I think. Now It's just the usual issues of trying to get the AI out of combat mode back to safe or careless.
  3. I am trying to get a function to spawn from the init box of a logic unit that is created in front of about a dozen select enemy soldiers in a base. The idea is that the logic unit has a virtual box around it that set the players captive status from true to false to simulate an AI vision cone. The issue I am having is that the way the script is written is such that once it is called it spawns this logic unit for all units assigned to a given side. This isn't ideal because the stealth segment is only one objective in the whole mission and calling the stealth script has the effect of permanently handicapping all OPFOR in the entire operation. Since I haven't been able to figure out how to get the code to delete the logic units properly and return the AI to full "intelligence" I was hoping to just assign the function to certain units. I just can't seem to figure out how to get the array to work properly. The original code is: _enemyArray = []; _i = 0; {if (side _x == east) then {_enemyArray set [_i, _x]; _i = _i + 1};} forEach allUnits; _center = createCenter sideLogic; _group = createGroup _center; player setCaptive true; for "_j" from 0 to (count _enemyArray) - 1 step 1 do { "Logic" createUnit [position (_enemyArray select _j), _group, "this AttachTo [(_enemyArray select _j), [0,25,0.5]]; _anythi = [_enemyArray select _j, this] spawn _fex_fnc_patrol;"]; sleep 0.1; }; As you can see all the units on side == east are assigned an index in the array and then all of those index's have a logic unit spawned at a specific offset which then calls the function from it's init box. I figured that simply removing lines 2 and 3, which index all units from the opfor side in the array, then change the code to this: _enemyArray = [patrol1, patrol2, patrol3, patrol4, patrol5, patrol6, sentry1, sentry2, sentry3]; _center = createCenter sideLogic; _group = createGroup _center; for "_j" from 0 to 9 do {player setCaptive true; "Logic" createUnit [position (_enemyArray select _j), _group, "this AttachTo [(_enemyArray select _j), [0,14,0.5]]; _anythi = [_enemyArray select _j, this] spawn _fex_fnc_patrol;"]; sleep 0.1; }; would work. Unfortunately what seems to happen is that either the logic unit does not spawn at all which results in the player being permanently set to captive of the code throws an error that the "Logic" createUnit command requires 3 elements and I provided 0. Im super confused, can anyone help??
  4. id_steacie

    Help with setting array

    Sorry I didnt include the whole script as its rather long i only included the part that selects the units on which to call the function _fex_fnc_patrol. The whole script reads like this: _fex_fnc_patrol = { _soldier = _this select 0; _logic = _this select 1; while {!alarm && triggeractivated stealth} do { _posx = position _logic select 0; _posy = position _logic select 1; _areadir = getDir _soldier + 45; _position = position player; _areax = 10; _areay = 10; _difx = (_position select 0)- _posx; _dify = (_position select 1) - _posy; _dir = aTan (_difx / _dify); if (_dify < 0) then {_dir = _dir + 180;}; _relativedir = _areadir - _dir; _adis = abs(_areax / cos (90 - _relativedir)); _bdis = abs (_areay / cos _relativedir); _borderdis = _adis Min _bdis; _positiondis = _position distance _logic; if (_positiondis < _borderdis) then { _ins = lineIntersectsSurfaces [ eyePos player, eyePos _soldier, player, _soldier, true, 1, "GEOM", "NONE" ]; if (isNil {_ins select 0}) then { alarm = true; player setCaptive false; hint "He's inside the area."; {if (side _x == east) then { _px = ((position player select 0) + (Random (15)) - 30); _py = ((position player select 1) + (Random (15)) - 30); _x move [_px, _py,0];}} forEach AllUnits; {if (side _x == sideLogic) then {deleteVehicle _x}} forEach AllUnits; sleep 40; if (alarm) exitWith {alarm = false; _again = [] execVm "stealthscript.sqf";}; } else { hint "He's inside, but hidden"; }; } else { hint "He's outside."; }; sleep 0.5; }; }; _enemyArray = [patrol1, patrol2, patrol3, patrol4, patrol5, patrol6, sentry1, sentry2, sentry3]; _center = createCenter sideLogic; _group = createGroup _center; for "_j" from 0 to 9 do {player setCaptive true; "Logic" createUnit [position (_enemyArray select _j), _group, "this AttachTo [(_enemyArray select _j), [0,14,0.5]]; _anythi = [_enemyArray select _j, this] spawn _fex_fnc_patrol;"]; sleep 0.1; }; I found it in a sample mission from a youtube video and am trying to adapt it to my use. Unfortunately, since i didnt write it myself I dont fully understand exactly how to manipulate it. Essentially whats supposed to happen is a square logic unit is spawned in front of each enemy within which the players set captive status is set to true. Outside the square the players capture status is set to false to represent a cone of vision. Its not ideal but should work in certain highly specific circumstances. I'm just having trouble getting it to apply only to specific units at a specific time. IE only the units in a certain base and only at night when the player is present.
  5. Please! If anyone could help that would be awesome.This is the only bit I can't figure out for my mission to be ready.
  6. I am having a similar problem getting a repeating AI script to end. Built into my mission is a stealth section where the player has to infiltrate a base and do something. Normally Arma's godlike AI just notices you instantly and this would be impossible so i wrote, well mostly copied, this script from Feuerex youtube channel: _fex_fnc_patrol = { _soldier = _this select 0; _logic = _this select 1; while {!alarm} do { _posx = position _logic select 0; _posy = position _logic select 1; _areadir = getDir _soldier + 45; _position = position player; _areax = 10; _areay = 10; _difx = (_position select 0)- _posx; _dify = (_position select 1) - _posy; _dir = aTan (_difx / _dify); if (_dify < 0) then {_dir = _dir + 180;}; _relativedir = _areadir - _dir; _adis = abs(_areax / cos (90 - _relativedir)); _bdis = abs (_areay / cos _relativedir); _borderdis = _adis Min _bdis; _positiondis = _position distance _logic; if (_positiondis < _borderdis) then { _ins = lineIntersectsSurfaces [ eyePos player, eyePos _soldier, player, _soldier, true, 1, "GEOM", "NONE" ]; if (isNil {_ins select 0}) then { alarm = true; player setCaptive false; hint "He's inside the area."; {if (side _x == east) then { _px = ((position player select 0) + (Random (15)) - 30); _py = ((position player select 1) + (Random (15)) - 30); _x move [_px, _py,0];}} forEach AllUnits; {if (side _x == sideLogic) then {deleteVehicle _x}} forEach AllUnits; sleep 40; player setCaptive true; {if (side _x == east) then { _x move position iCenter;}} forEach AllUnits; if (true) exitWith {alarm = false; _again = [] execVm "stealthscript.sqf";}; } else { hint "He's inside, but hidden"; }; } else { hint "He's outside."; }; sleep 0.5; }; }; _enemyArray = []; _i = 0; {if (side _x == east) then {_enemyArray set [_i, _x]; _i = _i + 1};} forEach allUnits; _center = createCenter sideLogic; _group = createGroup _center; player setCaptive true; for "_j" from 0 to (count _enemyArray) - 1 step 1 do { "Logic" createUnit [position (_enemyArray select _j), _group, "this AttachTo [(_enemyArray select _j), [0,14,0.5]]; _anythi = [_enemyArray select _j, this] spawn _fex_fnc_patrol;"]; sleep 0.1; }; Basically all I've been able to do with it is remove the alarm trigger related lines because the script won't work with them and adjusted the size and location of the vision cone. The hints are simply there to debug and will be removed once i get it working fully. What I need help with is getting the script to end once its started. Because my mission involves the whole island and this stealth section is only an objective within it I need to be able to deactivate the code so that all of the units don't follow it all the time. It's saved as "stealthscript.sqf" which is ExecVM'ed from a trigger when the player is within a given radius of the objective and it is within a certain time of day (night time). Unfortunately I have been able to neither stop the script entirely once its activated, which would be ideal for performance reasons, or manage to get it to only run for certain units. So far I've tried making the while {} do {} loop at the start trigger and alarm activated, removing _again = [] execVm "stealthscript.sqf" and replacing it with a terminate command, calling terminate stealthscript from another trigger, calling terminate.sqf from a trigger with: if (not isNil {stealthscript} and {not scriptDone stealthscript}) then { terminate stealthscript}; As well as putting in waitUntil {triggeractivated whatevertrigger}; lines in where I could think and nothing seems to work. Putting a trigger in the while {} do {} loop at the start to while {!alarm && triggeractivated whatevertrigger} seems to stop the script but it results in the AI being permanently unable to detect the player as it seems they are set to captive true. I'm starting to get really frustrated with this and would love some help, thanks, Ian
  7. Hey, sorry to bring up an old post but Ive been hunting around and can't seem to find anything more relevant and since I'm not allowed to post yet... I'm working on a mission with the Ravage mod where the player activates an object (a satphone) which results in the player being told they need to survive for 3 days until they get rescued. So far I've made this: // May 10, 2008 14:00 [2008,04,10,14,00] _start = date; _Extractday = (_start select 2) + 3; _start set [2, _Extractday]; hint Format ["Date of Extraction May %1th At %2:00 Hundred Hours", (_start select 2), (_start select 3)]; This allows the player to get an extraction date that is 3 days after whatever date or time they activated the object. The part I'm struggling with Is how to allow the player to check how long they have until they get extracted. I've tried some things like: player addaction ["Time To Extraction", {["Time left until Extraction %1 Days %2 Hours %3 Minutes", ((_start select 2) - (date select 2)), ((_start select 3) - (date select 3)), ((_start select 4) - (date select 4))]}]; As well as assigning a global variable to the date of rescue then calling the formula from another script but nothing works. It always returns an undefined variable _start {["Time left until Extraction %1 Days %2 Hours %3 Minutes", ((#_start select 2) - (date select 2)) error. Im really pulling my hair out at this point. If anyone can give me a hand that would be awesome. Thanks, Ian
  8. So I'm trying to make an extraction where a helo flys in throught the trees, fires off a couple missles then swoops around to land, everyone hops in, and the helo flies away to end the mission. I have the flight path recorded, scripted to call from a trigger, wait until everyone is in then take off when everyone is on board. Unfortunately, I am having no luck at all with making the helo shoot the missiles. I record the firing data with rec = [vehicle player,200,20,true] spawn BIS_fnc_UnitCapture; called from a trigger then past it into my script as: _firingdata = [[45.113,"missiles_DAR"],[45.199,"missiles_DAR"],[45.284,"missiles_DAR"],[45.37,"missiles_DAR"],[45.458,"missiles_DAR"]]; then call it with: [extract_helo, _firingdata] spawn BIS_fnc_UnitPlayFiring; But no matter what I do the helo will just not fire. I managed to get it to work once with a little bird but it would only shoot once and subsequent missiles had to be spawned in from an eventhandler emebedded in the script which doesn't really work and looks really stupid. So far I have rerecorded firing data and from all armed vanilla helos, all armed RHS US and Russian helos and the Bundeswehr EC-635 BW pack. From what I can see only guided missiles will fire, and only once per playback. Miniguns and cannons will not fire, nor will unguided missiles, flares, or bombs. I've seen people using this with success in other missions and videos but I'm just not having any luck. Any help would be greatly appreciated. My script looks like this: _movementdata = <data> _firingdata = <data> [extract_helo, _movementdata] spawn BIS_fnc_UnitPlay; [extract_helo, _firingdata] spawn BIS_fnc_UnitPlayFiring; extract_helo flyInHeight 0; waitUntil {triggerActivated Leave}; movementdata1 = <data> [extract_helo, _movementdata1] spawn BIS_fnc_UnitPlay; extract_helo flyInHeight 0;
×