Jump to content

Luft08

Member
  • Content Count

    180
  • Joined

  • Last visited

  • Medals

Community Reputation

25 Excellent

About Luft08

  • Rank
    Sergeant

Recent Profile Visitors

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

  1. Thanks, I'll do more testing. Just thinking here... Maybe I need to check to see if the AI is within 5 m or so of the cache and then attach him to the supply crate somehow? That would probably stop any animation but maybe I could detach him without moving him. I'll play around with it. It may not even be possible.
  2. The wiki says that an endDestination of "0" will make the stalker return to original group waypoints after the endCondistion becomes true. Does anyone know if the waypointStatements are restored?
  3. I could do that with a vectorAdd. Would that make the AI come closer?
  4. Thanks, I went with: if(!isServer) exitWith {}; { private _index = soldiersResuppling find _x; if(_index == -1) then { if(alive _x) then { private _result = [_x] call isPrimaryAmmoLow; if(_result) then { // soldier has low ammo. soldiersResuppling pushBack _x; [_x] call goForAmmo; }; }; }; } forEach troopArray; isPrimaryAmmoLow: if(!isServer) exitWith {}; params["_AIUnit"]; private _primaryAmmoLow = false; private _allMags = magazines _AIUnit; private _consolidatedWepArray = _allMags call BIS_fnc_consolidateArray; private _wepMagTypeArray = primaryWeaponMagazine _AIUnit; private _wepMagType = _wepMagTypeArray # 0; private _magCount = 0; { private _magType = _x # 0; if(_magType == _wepMagType) exitWith { _magCount = _x # 1};; } forEach _consolidatedWepArray; // Should always be only 1 entry for primary weapon? Maybe better not to use forEach? if (_magCount == 0) then {_primaryAmmoLow = true;}; // Does not count the mag that is loaded. _primaryAmmoLow
  5. I have a mission where opfor has taken control of a town. I have various weapon caches scattered throughout the town. When an AI unit gets low on ammo I want to set a waypoint to the nearest cache and when he arrives fill up his ammo. The problem is that I don't know how to test to see if he is low on ammo. (Not completely out, just low). Is there a function or event handler that can help me do this? Thanks.
  6. I guess "overuse" is subjective. The mission that I would like to release soon randomizes aspects that requires data from all buildings etc. So I spawn the function that does that as it's not critical that it complete prior to other things running.
  7. I don't think I follow. So if I have a scheduled method called scheduledFoo and I want to run an unscheduled function called unscheduledFoo from within scheduledFoo normally I would just [] call unscheduledFoo; or _returnValue = [] call unscheduledFoo; I don't understand where NIL would come into play.
  8. Sorry if this is the wrong place for this question: After working on missions for some time I have one mission that my group really likes playing and it is close to being ready for release. Is there a tutorial on publishing/sharing Arma missions?
  9. I compile the code and pass it into a method that gets executed via a call to BIS_fnc_loop. if(!isServer) exitWith {}; params ["_newActiveAreas", "_civArray", "_soldierArray", "_vehicleArray", "_vehCode", "_civcode", "_soldierCode"]; if(_newActiveAreas isEqualTo []) exitWith {}; { // forEach _newActiveAreas _handle = [_x, _vehicleArray, _vehCode] spawn activateVehicles; waitUntil{scriptDone _handle}; private _handle = [_x, _civArray, _civCode] spawn activateCivs; waitUntil{scriptDone _handle}; _handle = [_x, _soldierArray, _soldierCode] spawn activateSoldiers; waitUntil{scriptDone _handle}; } forEach _newActiveAreas; There's a lot of supporting code and arrays not shown but hopefully you get the idea.
  10. Sure, I'm still experimenting with it but so far it appears that you can create a function in a separate sqf file and then just pass it in as a parameter. For example, I'm working with the new DLC Western Sierra and a mod called maxwomen that has Muslim women with burkas. I want the civilians to act more naturally depending on their type. Muslim women have restrictions in many areas of the world that I wish to model. Much of the code should be generic if written properly but some code must be specific to the scenario. So, I write the main code but allow some code to be passed in as a parameter. I have one function called activateCivs that takes such a parameter: if(!isServer) exitWith {}; params["_areaRecord", "_civArray", "_spawnCode"]; private _areaName = _areaRecord # 0; private _areaCenter = _areaRecord # 1; private _areaRadius = _areaRecord # 2; // Get a list of houses in area. private _houseList = [_areaCenter, _areaRadius] call getBuildingList; // Get odds that house will have civs. private _civOdds = 100; { if((_x find _areaName) != -1) exitWith {_civOdds = _x # 1;}; } forEach civOdds; if(_civOdds > 0) then { // forEach house spawn civs and assign ACT_IDLE if odds are met. //private _time = daytime; // time of day/night will affect civ action choice. { // forEach _houseList private _die = floor random 100; if(_die < _civOdds) then { private _civilianArray = [_x] call _spawnCode; // Code to spawn civs. { private _actionArray = [ACT_IDLE,[]]; private _civRecord = [_x, _actionArray]; _civArray pushBack _civRecord; } forEach _civilianArray; }; } forEach _houseList; }; Notice it takes a _spawnCode parameter. This is a function that gets executed when a WS civ is spawned: _spawnCode for WS: if(!isServer) exitWith {}; params["_bldg"]; private _returnArray = []; private _bldgPositions = [_bldg] call BIS_fnc_buildingPositions; private _group = createGroup[civilian, true]; private _civType = selectRandom civMenTypeArray; private _malePos = selectRandom _bldgPositions; private _unit = _group createUnit [_civType, _malePos, [], 0, "FORM"]; _returnArray pushBack _unit; private _wifeCount = floor random 3; for "_c" from 1 to _wifeCount do { private _civType = selectRandom civWomenTypeArray; private _wifePos = selectRandom _bldgPositions; private _unit = _group createUnit [_civType, _wifePos, [], 0, "FORM"]; doStop _unit; _returnArray pushBack _unit; }; _group setFormation "FILE"; _group setBehaviour "SAFE"; _group setSpeedMode "LIMITED"; _returnArray Note that the code spawns a male (Husband) then spawns 0, 1 or 2 females (Wifes). The code to spawn western civilians would be quite different but hopefully the main part will be the same. Like I said, I'm still experimenting.
  11. I'm writing some generic code and as one of the parameters I wish to pass in a function name to be called. Is it possible to put a function name into a string variable, pass that variable and then call that function? So for example let's say I wish to spawn civilians and then assign those civilians actions. I don't want my framework to have to define every conceivable action that the programmer may wish to implement so I wish to have the programmer write the action function him/her self and pass it in. My code would then spawn the civilian and pass it to the programmer's function to assign whatever action he/she has decided to implement. Never mind. It appears I can just do it. who would have thought it would be this easy? 🙂
  12. Is it possible to make a specific Civ AI unit attack a specific player unit? I have spawned civ units and put them into an east group but I can't get them not to be docile. if(!isServer) exitWith {}; params["_spawnPos", "_civTypes"]; private _group = grpNull; _group = createGroup[east, true]; private _unit = _group createUnit [(selectRandom _civTypes), _spawnPos, [], 0, "FORM"]; _unit setCombatMode "RED"; _unit setBehaviour "AWARE"; _unit I have also tried civilian setFriend [west, 0]; (although I don't want the civilians to attack any player, just the ones I specify. I have also tried spawning an opfor military unit and removing all of his gear and cloths and redressing him in civ clothing but the civ uniforms are not allowed on the military models. (Again, if this would have worked the opfor units would be hostile toward all players.) The scenario is that anarchy has broken out with two civilian factions. One faction is more or less friendly, one faction is hostile while other civilians are just running for their lives.
×