-
Content Count
204 -
Joined
-
Last visited
-
Medals
Everything posted by Luft08
-
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?
-
How can I tell if AI are running low on ammo?
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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. -
How can I tell if AI are running low on ammo?
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I could do that with a vectorAdd. Would that make the AI come closer? -
How can I tell if AI are running low on ammo?
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
-
How can I tell if AI are running low on ammo?
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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 -
passing a method name to be executed
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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. -
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? 🙂
-
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?
-
passing a method name to be executed
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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. -
passing a method name to be executed
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
-
passing a method name to be executed
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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. -
passing a method name to be executed
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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. -
Make individual Civ attack particular player
Luft08 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
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. -
How to make police units point their weapons but not shoot?
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thanks, I'll take a look. -
How to make police units point their weapons but not shoot?
Luft08 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
One of the scenarios I'm working on deals with civilian populations and AI police. I need the police to aim their weapons at the players and tell them to drop their weapons and get on the ground. Then if the players don't comply the police should open fire. I'm thinking that I can make the police and players enemies but set the players as being captured. That should prevent the police from shooting them but I don't know how to get them to point their weapons without shooting. Any Ideas? -
I'm writing a function that should return true or false depending on the visibility of an object by an observer. I worked out all of the vector math stuff (man, I learned that back in college and apparently have spent the last 50 years forgetting what I learned.) but am having a tough time getting meaningful information about object blocking the view. Here is what I have so far: if(!isServer) exitWith {}; params ["_observer", "_target", "_fieldOfView", "_maxDist"]; private _dist = _observer distance _target; if(_dist > _maxDist) exitWith {inView = false;}; private _dir = vectorDir _observer; private _targetPos = (position _target);// vectorAdd [0,0,5]; private _vector = vectorNormalized (_targetPos vectorDiff (position _observer)); private _dotProduct = _vector vectorDotProduct _dir; private _inView = _dotProduct > (cos _fieldOfView); if(_inView) then { intersectionsArray = lineIntersectsSurfaces [ eyePos _observer, _targetPos, _observer, _target, true, 1, "GEOM", "NONE" ]; private _data = intersectionsArray # 0; hint str _data; }; _inview I think I'm close but I don't know how to interpret the data I'm getting back from the lineIntersectsSurfaces function.
-
lineIntersectsSurfaces problem
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
For anyone who might find a "inView" function useful, the final (not well tested) code is: if(!isServer) exitWith {}; params ["_observer", "_target", "_fieldOfView", "_maxDist"]; private _inView = false; private _dist = _observer distance _target; if(_dist > _maxDist) exitWith {_inView}; private _dir = vectorDir _observer; private _targetPos = (getPosASL _target); private _vector = vectorNormalized (_targetPos vectorDiff (getPosASL _observer)); private _dotProduct = _vector vectorDotProduct _dir; _inView = _dotProduct > (cos _fieldOfView); private _intersectionsArray = []; if(_inView) then { _intersectionsArray = lineIntersectsSurfaces [ eyePos _observer, _targetPos, _observer, _target, true, 1, "GEOM", "NONE" ]; private _data = _intersectionsArray # 0; if(isNil "_data") then { _inView = true; }; }; _inView To use pass in the observer object, the target object, the maximum angle (field of view) and maximum distance visible. Example: (After compiling function) : inView = compileFinal preprocessfilelinenumbers "inView.sqf"; [soldier_1, player, 90, 150] call inView; If the function returns true the observer can see the target. -
lineIntersectsSurfaces problem
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
That was it! Thanks! It's the small details that get me every time. -
lineIntersectsSurfaces problem
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
In my code I trace from the observer's eyePos to the target. (Isn't that always going to be above ground?)I also tried raising the trace above the target in case the position of the target was under the ground. i.e. private _targetPos = (position _target) vectorAdd [0,0,5]; position _target should return a Position in AGLS format shouldn't it? I'm unclear about what I should change in my code? UPDATE: I just tried raising the position of the observer and target by a vectorAdd [0,0,3] and the function returned: [[6729,669.414,119.037],[-0.0528591,-0.998602,-0],1700230d600# 38092: gm_euro_house_08_w.p3d,1700230d600# 38092: gm_euro_house_08_w.p3d] So I lowered the observer position by one meter i.e. vectorAdd [0,0,2] and got the null objects again. I obviously do not have a handle on how the position and eyePos commands work. Do I need to determine the height above sea level of the ground and add it in? I though that is what the position and eyePos commands were doing by returning AGLS positons? Update 2 My testing is inconsistent. I moved the units and now I get objNull no matter what the vectorAdd value is. I'm officially lost... -
lineIntersectsSurfaces problem
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I do. What I would like is for the function to return a Nil or objNull when it does not see anything between the observer and the target. That way I know that the target is visible to the observer but if it returns any intersectObj other than that the view was blocked. -
lineIntersectsSurfaces problem
Luft08 replied to Luft08's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Correct but when the target is behind a building and within range the code returns: [[6755.84,712.766,118.435],[-0.000152588,-0.000210571,1],<NULL-object>,<NULL-object>] And when the target is standing directly in front of the observer the code returns: [[6755.65,712.701,118.435],[-0.000152588,-0.000210571,1],<NULL-object>,<NULL-object>] This does not seem right. -
At the beginning of my coop missions I like to have an officer explain the mission to the players. However, the playback volume is too low and I can't seem to find a way to make it louder. In my description.ext file I define the sounds that get played. For example: class CfgSounds { sounds[] = {PlanningAttack}; class planningAttack { name = "PlanAttack"; sound[] = {sounds\planningAttack.ogg,1,1}; titles[] = {0,""}; }; }; Then to broadcast it to all players I use remoteExec: [officer_1,["PlanningAttack",500, 1, true]] remoteExec["say3D"]; No matter what I do I can't seem to effect the volume. I have the distance set to 500 which is NOT ideal because the volume is still low it just that the low volume speech carries for 500 meters.
-
I think I tried that and it only works if I don't remoteExec it. I'll try it again to be sure. Thanks.
-
Thanks, I'll give Audacity a try. I don't know anything about "brickwall limiters" or "overs" but I'm sure they will become painfully obvious when I go to do this. I'm also going to look into playsound and playsound3d to see if they handle things a little better.
-
Should Guard waypoint and createGuardedPoint be avoided??
Luft08 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I was thinking about using createGuardedPoint with the guard waypoint but the docs say that it uses an objectMapID and I have read that objectIDs are not reliable and should not be used because they can change with a map update. Are the objectIDs that moricky was talking about the same as "objectMapID"s that the createGuardedPoint takes as one of it's parameters?