Jump to content
Zenophon

Zenophon's ArmA 3 Co-op Mission Making Framework

Recommended Posts

I have a question about the 'Zen_OrderInfantryPatrol'. If I give a squad this order, and then after an armoured unit that they are protecting is destroyed, I want to give them a 'Zen_OrderInfantryPatrolBuilding' order, will the previous order be cancelled, or only when all the squad is dead?

Thanks,

Any function/script executed with spawn/execVM returns a pointer to the thread, a script handle. You can end that thread with terminate to stop all its effects. As a general example:

_patrolThread = [_units, ...] spawn Zen_OrderInfantryPatrol;
// ... wait for something ...
terminate _patrolThread;
0 = [_units, ...] spawn Zen_OrderInfantryPatrolBuilding

This is discussed in much more detail in the Zen_MultiThreadManagement demonstration; it also appears in the Zen_MiscDemo demonstration.

Aaaaaand of course it doesn't work. The problem for me lies in the 62 line of code in Zen_SpawnVehicle.sqf:

_vehicle = createVehicle [_class, _pos, [], 0, _special];

Because its using "createVehicle", and that vehicle is a truck - it always spawns on the ground before being moved to the air, and because that code is not run in an instant, those could be few frames in-between - giving time for collision detection to trigger. I had such trouble creating a base camp, where things being spawned, moved and rotated created collisions.

For now I modified that line of code to be:

_vehicle = createVehicle [_class, [0,0,0], [], 0, _special];

So it will spawn those trucks in the origin point, and then move to _pos. Works like a charm.

I think I misunderstood what was colliding. You mean that there's already an object on the ground at the exact point of spawning. When Zen_SpawnVehicle forces the position to be exact at ground level, it causes a collision. So, this is the situation:

_start = [player, "b_mrap_01_f", 0] call Zen_SpawnVehicle;
for "_i" from 1 to 2 do{
   _truck = [_start,"b_mrap_01_f", 50*_i + 50, 135] call Zen_SpawnVehicle;
   0 = [_truck, "SmokeShellOrange"]spawn Zen_SpawnParachute;
};

In the release version that should reproduce a collision. Try testing your mission with this code replacing lines 49-64 (approximately) of Zen_SpawnVehicle:

_special = "NONE";
if (_height > 2) then {
   if (count _this < 5) then {
       _collide = true;
   };

   if (_class isKindOf "AIR") then {
       _special = "FLY";
       if (_class isKindOf "Plane") then {
           _speed = 100;
       };
   };
};

_pos set [2, 0];
_vehicle = createVehicle [_class, _pos, [], 0, _special];

This should guarantee that there is no collision on the ground (_special == "NONE") and that the vehicle is placed at the exact correct position in the air (_collide == true). It also allows the fifth argument to control _collide even if the vehicle is in the air. If you do not give 'false' as the fifth argument, this can still produce collisions in the air for vehicles at the exact same height.

Share this post


Link to post
Share on other sites

Hey zen

thanks for the help on the intell objective it really adds to the mission

i have a slight problem with the captive objective

the freindly units that are being held captive are spawning in with weapons causing them to either kill the current gaurds around them or being killed them selfs

i will run the objective on its own later and see if it continues

_captivePos = ["Captive"] call Zen_FindGroundPosition;
_captiveObjective = [_captivePos, (group X11), west, "custom", "rescue", ["B_Soldier_F", "B_Soldier_F"]] call Zen_CreateObjective;

_CaptiveGroup = ["Captive", ["I_soldier_F", "I_Soldier_GL_F"]] call Zen_SpawnGroup;

also i have hit a brick wall with setting the formation to groups

_Roadgroup setFormation ["STAG COLUMN"];

this seems to get ignored

i see the similar method is used in your infantry showcase mission using

_charlieGroup setGroupId ["Charlie"];
_charlieGroup setBehaviour "combat";
_charlieGroup setCombatMode "blue";

allthough setFormation is not used here you can see set commands should work

Here is what i have in my init.sqf so far

http://pastebin.com/rhvKVScK#

any help and tips on improving are welcome from any one :D

thanks in advanced zen really appreciate alll the help

Share this post


Link to post
Share on other sites
Hey zen

thanks for the help on the intell objective it really adds to the mission

i have a slight problem with the captive objective

the freindly units that are being held captive are spawning in with weapons causing them to either kill the current gaurds around them or being killed them selfs

i will run the objective on its own later and see if it continues

_captivePos = ["Captive"] call Zen_FindGroundPosition;
_captiveObjective = [_captivePos, (group X11), west, "custom", "rescue", ["B_Soldier_F", "B_Soldier_F"]] call Zen_CreateObjective;

_CaptiveGroup = ["Captive", ["I_soldier_F", "I_Soldier_GL_F"]] call Zen_SpawnGroup;

also i have hit a brick wall with setting the formation to groups

_Roadgroup setFormation ["STAG COLUMN"];

this seems to get ignored

i see the similar method is used in your infantry showcase mission using

_charlieGroup setGroupId ["Charlie"];
_charlieGroup setBehaviour "combat";
_charlieGroup setCombatMode "blue";

allthough setFormation is not used here you can see set commands should work

Here is what i have in my init.sqf so far

http://pastebin.com/rhvKVScK#

any help and tips on improving are welcome from any one :D

thanks in advanced zen really appreciate alll the help

I forgot to add some code to actually make those units captive:

{
   _x setCaptive _x;
   _x disableAI "move";
   removeAllWeapons _x;
   removeBackpack _x;
   removeGoggles _x;
   removeHeadgear _x;
} forEach (_captiveObjective select 0);

Zen_CreateObjective (or really Zen_TriggerAreRescued) will set them not captive and allow them to move once they're rescued. If you want to give them weapons, you can save the player the headache of micromanaging the AI and set up a custom loadout for them:

_captiveLoadout = [[
   ["weapons", ["arifle_Katiba_F"]],
   ["magazines", [["30Rnd_65x39_caseless_green", 5]]]
]] call Zen_CreateLoadout;

// ...

waitUntil {
   sleep 2;
   ([(_captiveObjective select 1)] call Zen_AreTasksComplete)
};

0 = [(_captiveObjective select 0), _captiveLoadout, "additive"] call Zen_GiveLoadoutCustom;

I'm not sure about setFormation; Zen_OrderInfantryPatrol is not setting a new formation, so there shouldn't be any interference. There's nothing on the wiki indicating that the command has some special consideration. You could try setFormDir.

Share this post


Link to post
Share on other sites

I love this framework it's taking so much of the troubleshooting out of mission making.

I'm running a random reinforcement script, might be paratroops, might be enemy CAS called in etc. I'm having a problem with paratroopers, is there any plans to include a function?

Right now I'm having bother getting troopers to spawn, in the air. I've tried using the findNearHeight using the chopper as an object but I think you have the findGroundPosition in the code for calling SpawnInfantry.

Anyone any ideas on how I would spawn in infantry using the chopper spawn below as a spawn point?

_bluforHeliArray = ["B_Heli_Light_01_armed_F","B_Heli_Attack_01_F"];

_bluforHeliSpawn = [_bluforReinforcementPatrolArea,600,600,8,0,150,0] call BIS_fnc_findsafePos;

_bluforRHeli = [_bluforHeliSpawn, _bluforHeliArray] call Zen_spawnHelicopter;

[_bluforRHeli, _bluforReinforcementPatrolArea,[],0,"normal"] spawn Zen_OrderAircraftPatrol;

Share this post


Link to post
Share on other sites
I love this framework it's taking so much of the troubleshooting out of mission making.

I'm running a random reinforcement script, might be paratroops, might be enemy CAS called in etc. I'm having a problem with paratroopers, is there any plans to include a function?

Right now I'm having bother getting troopers to spawn, in the air. I've tried using the findNearHeight using the chopper as an object but I think you have the findGroundPosition in the code for calling SpawnInfantry.

Anyone any ideas on how I would spawn in infantry using the chopper spawn below as a spawn point?

_bluforHeliArray = ["B_Heli_Light_01_armed_F","B_Heli_Attack_01_F"];

_bluforHeliSpawn = [_bluforReinforcementPatrolArea,600,600,8,0,150,0] call BIS_fnc_findsafePos;

_bluforRHeli = [_bluforHeliSpawn, _bluforHeliArray] call Zen_spawnHelicopter;

[_bluforRHeli, _bluforReinforcementPatrolArea,[],0,"normal"] spawn Zen_OrderAircraftPatrol;

Zen_SpawnGroup (and thus Zen_SpawnInfantry) will place the group at the height of the given position. This will give you instant parachuting:

_pos = [player, [10, 200]] call Zen_FindGroundPosition;
_group = [_pos vectorAdd [0, 0, 300], west, "infantry", 4] call Zen_SpawnInfantry;

_dir = random 360;
{
   _x setPosATL ([_pos, 40 * _forEachIndex, _dir, "trig", 300] call Zen_ExtendPosition);
   removeBackpack _x;
   _x addBackpack "b_parachute";
   _x action ["openParachute", _x];
} forEach units _group;

And here's a typical parachute insertion from the start of a mission:

// _groupPlayer is the group of the units parachuting
// "mkInsertion" is the area they should drop on

_heliSpawn = [getMarkerPos "mkInsertion", [2000, 2500], [], 0, 0, [135, 225]] call Zen_FindGroundPosition;
_insertionHeli = [_heliSpawn, "b_heli_transport_01_f", 500] call Zen_SpawnHelicopter;
0 = [_groupPlayer, _insertionHeli] call Zen_MoveInVehicle;

_flyOverPos = [_insertionHeli, "mkInsertion", 1000] call Zen_ExtendRay;
_h_flyOver = [_insertionHeli, _flyOverPos, "full", 500] spawn Zen_OrderVehicleMove;
_insertionHeli lock 2;

waitUntil {
   sleep 0.25;
   ([X, "mkInsertion"] call Zen_AreInArea)
};

_insertionHeli animateDoor ["door_r", 1];
sleep 2;
_insertionHeli lock 0;

{
   removeBackpack _x;
   _x addBackpack "b_parachute";
   _x action ["eject", _insertionHeli];
   _x leaveVehicle _insertionHeli;
   unassignVehicle _x;
   sleep 1;
} forEach (units _groupPlayer);

terminate _h_flyOver;
_flyOverPos = [_insertionHeli, _heliSpawn, 1000] call Zen_ExtendRay;
_h_flyOver = [_insertionHeli, _flyOverPos, "full", 200] spawn Zen_OrderVehicleMove;

As for making that a function, I'll have to think about how it will fit in with Zen_OrderInsertion. There's also a possible combination with Zen_OrderVehicleDrop. It depends a lot on how many parameter are needed to cover every possible desirable combination. I might also make the 10 lines for ejecting and opening the parachute a macro.

Share this post


Link to post
Share on other sites

I just noticed something. Both versions of the Kajman (Opfor attack Chopper) seem to ignore the fly height parameter of the heli patrol function while the Orca's follow the setting. Has anyone else noticed this?

Share this post


Link to post
Share on other sites
Perfect, thanks very much Zen ;)

Glad that's what you were looking for.

I just noticed something. Both versions of the Kajman (Opfor attack Chopper) seem to ignore the fly height parameter of the heli patrol function while the Orca's follow the setting. Has anyone else noticed this?

Zen_OrderAircraftPatrol doesn't look at the vehicle's type. I've tried this:

{
   _spawnPos = [player, [200, 500]] call Zen_FindGroundPosition;
   _heli = [_spawnPos, _x] call Zen_SpawnHelicopter;
   0 = [_heli, _spawnPos, 500, 0, "normal", 500] spawn Zen_OrderAircraftPatrol;
} forEach ["O_Heli_Light_02_F", "O_Heli_Attack_02_F"];

However, it doesn't reproduce the bug; I even tried the advanced flight model on/off. If you want, send me the code that caused the bug, and I'll test with different height, helicopter types, etc.

Share this post


Link to post
Share on other sites
Zen_OrderAircraftPatrol doesn't look at the vehicle's type. I've tried this:

{
   _spawnPos = [player, [200, 500]] call Zen_FindGroundPosition;
   _heli = [_spawnPos, _x] call Zen_SpawnHelicopter;
   0 = [_heli, _spawnPos, 500, 0, "normal", 500] spawn Zen_OrderAircraftPatrol;
} forEach ["O_Heli_Light_02_F", "O_Heli_Attack_02_F"];

However, it doesn't reproduce the bug; I even tried the advanced flight model on/off. If you want, send me the code that caused the bug, and I'll test with different height, helicopter types, etc.

This is the code I'm using

_helipatrolPos1 = ["NO_CQB"] call Zen_FindGroundPosition;
_helipatrol1 = [_helipatrolPos1, ["O_Heli_Attack_02_black_F","O_Heli_Attack_02_F","O_mas_afr_MI24","O_Heli_Light_02_F"], 75] Call Zen_SpawnHelicopter;
0 = [_helipatrol1, "NO_CQB", [], 0, "normal", 50] Spawn Zen_OrderAircraftPatrol;

Now both the Orca and the MI24 from Massi's vehicle pack follows the 50m fly height but the Kajmans don't. Also the marker No_CQB covers most of Altis so the patrol waypoints are often a long way apart. And it seems the farther they fly the higher they go.

I wouldn't be surprised that this is a BIS problem and not a problem with your framework!

Share this post


Link to post
Share on other sites

Hi Zen. Could you also check on the Zen_OrderFastRope function is still working or if someone else can confirm it. I'm not able to get it to work!

I spawn the infantry and chopper. I set the insertion point and have it set to hover when it gets there. It opens the doors and drops the rope but the infantry won't disembark!

Share this post


Link to post
Share on other sites
This is the code I'm using

_helipatrolPos1 = ["NO_CQB"] call Zen_FindGroundPosition;
_helipatrol1 = [_helipatrolPos1, ["O_Heli_Attack_02_black_F","O_Heli_Attack_02_F","O_mas_afr_MI24","O_Heli_Light_02_F"], 75] Call Zen_SpawnHelicopter;
0 = [_helipatrol1, "NO_CQB", [], 0, "normal", 50] Spawn Zen_OrderAircraftPatrol;

Now both the Orca and the MI24 from Massi's vehicle pack follows the 50m fly height but the Kajmans don't. Also the marker No_CQB covers most of Altis so the patrol waypoints are often a long way apart. And it seems the farther they fly the higher they go.

I wouldn't be surprised that this is a BIS problem and not a problem with your framework!

First, it's important to remove any interference (like other units the pilot can see). This is the only thing in the mission I'm testing:

_helipatrolPos1 = [player, [200, 500]] call Zen_FindGroundPosition;
_helipatrol1 = [_helipatrolPos1, ["O_Heli_Attack_02_black_F","O_Heli_Attack_02_F","O_Heli_Light_02_F"], 75] call Zen_SpawnHelicopter;
0 = [_helipatrol1, player, 1000, 0, "normal", 50] spawn Zen_OrderAircraftPatrol;

while {true} do {
   player sidechat str ZEN_STD_OBJ_ATLPositionZ(_helipatrol1);
   sleep 5;
};

They all behave as expected. It's most likely an issue with BIS AI code or a mod.

Hi Zen. Could you also check on the Zen_OrderFastRope function is still working or if someone else can confirm it. I'm not able to get it to work!

I spawn the infantry and chopper. I set the insertion point and have it set to hover when it gets there. It opens the doors and drops the rope but the infantry won't disembark!

It does fail to force the units out of the helicopter and thus enters an infinite loop. This code will demonstrate it:

_group = [player, west, "infantry", 4] call Zen_SpawnInfantry;
_heli = [(getPosATL player) vectorAdd [200, 200, 0], "b_heli_transport_01_f"] call Zen_SpawnHelicopter;
0 = [_group, _heli] call Zen_MoveInVehicle;
0 = [_heli, [player], _group, "normal", 40, true] spawn Zen_OrderInsertion;

The eject code (_x action ["eject", _heli]) isn't working for the AI with the latest BIS patch (1.40 Stable). It works for the player, but not the AI group. This shows the difference:

// after previous code
0 = [player, _heli] call Zen_MoveInVehicle;
sleep 2;
((leader _group) action ["eject", _heli]);
(player action ["eject", _heli]);

It seems the last fail-safe way of forcing a unit out of a vehicle is:

_unit setPosATL [0,0,0];
// ... attachTo rope ... etc.

Thus, Zen_OrderFastRope (and thus Zen_OrderInsertion) should be working next release (which luckily is tomorrow).

Share this post


Link to post
Share on other sites

Introduction

Greetings fellow scripters and Armaholics, in this latest installment, I will continue to discuss the development of the framework and, of course, shamelessly advertise the framework in any way possible.

If this sounds boring, you can download the latest version from the original post. As always, the links to Google Drive for the .7z and .zip versions are already up to date. For those looking for older versions, go to file>revisions. The new version should be on Armaholic soon. Please bring any technical issues or mistakes to my attention, so e.g. people don't download the wrong version etc.

Changelog

This is the definitive release for ArmA 3 version 1.40 stable, and a good release for those who like vectors and coordinate systems. There are various, small fixes and improvements based upon reported and observed bugs.

Though it wouldn't appear so, a small improvement Zen_ConfigGetVehicleClasses is possibly the foremost addition. This allows Zen_ConfigGetVehicleClasses to be a complete flexible vehicle search function, offering all optional parameters for every major distinguishing feature of vehicles.

Two 1.40 bugs have been eliminated, including Zen_OrderFastRope working for AI, and a few vehicles not working with Zen_GetTurretPaths (and thus Zen_SpawnVehicleCrew).

A known issue was also fixed, NVG's are now turned on at night for players when a new loadout it given. Zen_OrderVehiclePatrol has been further tweaked from last release, to make sure a valid waypoint can always be found. Zen_SpawnVehicle is now bit more mindful of collisions, and can avoid them when spawning vehicles in the air. Zen_AddGiveMagazine now uses the current weapon rather than the primary weapon, so you can give rockets, pistol magazines, etc depending on what your teammate is holding.

As for coordinate systems, six new macros will round out the collection of vector transformations and conversions. You can now convert a three dimensional vector between any of the three coordinate systems (Cartesian, Cylindrical, Polar). Also note, the rotation macros are for Cartesian vectors only, you must convert to a Cartesian vector. None of that is particularly exciting for the average mission-maker, but one would be amiss not to include these operations in a math library.

Last, but certainly not least interesting, I have added a new demonstration mission, Zen_HC. This demonstration deals with using a headless client in a framework mission. Due to receiving questions about HC's from multiple users, it seemed sensible to make a demonstration out of it. It's actually quite easy to use an HC with the framework, as it only requires changing a few lines of code to run functions on the HC.

3/11/15

  1. Fixed: ZEN_FMW_Code_GiveLoadoutsOrdered did not convert the first argument to an array of units
  2. Fixed: Zen_GetTurretPaths did not detect some commander turrets
  3. Fixed: Zen_GiveLoadoutBlufor, Zen_GiveLoadoutCustom, Zen_GiveLoadoutIndfor, and Zen_GiveLoadoutOpfor now put NVG's back on at night
  4. Fixed: Zen_OrderFastRope did not force AI to eject
  5. Fixed: Zen_OrderVehiclePatrol required the waypoint to be too far from the vehicle
  6. Fixed: Zen_SpawnVehicle always avoids object collisions when spawning vehicles on the ground
  7. Added: Standard macros ZEN_STD_Math_VectCylCart, ZEN_STD_Math_VectCylPolar, ZEN_STD_Math_VectPolarCart, ZEN_STD_Math_VectPolarCyl, ZEN_STD_Math_VectRotateX, ZEN_STD_Math_VectRotateY
  8. Improved: Zen_AddGiveMagazine now gives a magazine for the current weapon of the other player
  9. Improved: Zen_ConfigGetVehicleClasses first parameter now has a skip value
  10. Improved: Zen_GetTurretPaths now defaults unidentified turret types to cargo
  11. Improved: Zen_RotateAsSet optimized
  12. Improved: Zen_SpawnVehicle does not override the fifth argument, if given, when the height is greater than 2 meters
  13. Documentation: Corrected for Zen_InvokeFireSupport, Zen_OrderExtraction, Zen_OrderInsertion, Zen_OrderVehicleMove, ZEN_STD_Math_VectRotateZ
  14. Documentation: Added headless client demonstration, Zen_HC
  15. Documentation: Added for ZEN_STD_Math_VectCylCart, ZEN_STD_Math_VectCylPolar, ZEN_STD_Math_VectPolarCart, ZEN_STD_Math_VectPolarCyl, ZEN_STD_Math_VectRotateX, ZEN_STD_Math_VectRotateY
  16. Documentation: Improved tutorial MissionPOWRandom.Stratis
  17. Documentation: Updated for Zen_AddGiveMagazine, Zen_ConfigGetVehicleClasses
  18. Documentation: Updated Notepad++ SQF language and autocompletion file with ArmA 3 1.40 stable commands

Function Spotlight

As users of my framework know, there is an enormous number of functions at your disposal. The amount of documentation that has to be sifted through can be extremely daunting. Each release I spotlight a function and talk about its usefulness. If you have found an obscure function (not in tutorials, barely seen in demonstrations or sample missions) that you think is useful, PM me and I can spotlight it.

The functions chosen for this release are: ZEN_FMW_Code_SpawnMarker, ZEN_FMW_Code_SpawnPoint, and ZEN_FMW_Code_SpawnPointBehind. While these are not technically functions, they are functional macros and each use several functions. Like all the macros, they exist because I don't want to repeat code.

ZEN_FMW_Code_SpawnMarker has the fewest arguments. It will simply spawn, give loadouts to, and order to patrol AI groups at random inside a marker:

ZEN_FMW_Code_SpawnMarker("mkPatrol", 3, east)

That replaces 8 lines of code and a minute or two of typing. Also note, the marker must be an area marker.

If you haven't placed a marker, you can settle for logical circle using ZEN_FMW_Code_SpawnPoint:

ZEN_FMW_Code_SpawnPoint(player, 300, 2, west)

Finally, you can take advantage of a little more math to have all the groups start on one side of the center and patrol normally around afterwards:

ZEN_FMW_Code_SpawnPointBehind(player, "mkObjective", 10, 300, 3, resistance)

I concede that the documentation's description of ZEN_FMW_Code_SpawnPointBehind may be somewhat hard to follow. Thus, imagine the player at some horizontal distance from a circle around the center, divided vertically into two halves; one half is closer to the player, one half is further away. The groups will spawn in the vertical half of the circle opposite the player's horizontal side. Thus, the groups will never be closer to the player than the center. Now just rotate all that to fit the direction from the player to the center.

Finally, all three macros share a special feature: they provide an array of all the groups they spawned, called _Zen_GrpsArray. This is a local variable, with a 'Zen' prefix to avoid conflicts, that you can use to further modify the groups. For simple tracking:

0 = [_Zen_GrpsArray] call Zen_TrackGroups;

You can be more creative than that, so that's all for now folks.

Beta

As already stated, the framework is in the beta stage of development. I am making every effort to quality control releases, but there will be bugs. Both new features and old ones could have bugs, issues, and things people just don't like. There is no ETA or plan for a 'final' version. The framework is a work in progress, and it will continue to progress while there are improvements to be made (there always will be).

Some of the bugs have been pointed out by users, and those fixes are included in the changelog above. I want to thank everyone who has used/supported the framework.

Share this post


Link to post
Share on other sites

Thanks again Zen for all your hard work and your bug crushing skills!

I've always wanted to learn how to program for Arma and this framework has allowed me to do just that!

Share this post


Link to post
Share on other sites
Guest

Thanks for always taking the time to inform us about your newest releases :cool:

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means soon you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

I've run into some issues with Zen_OrderFastRope. When I order fast-rope insertion into a forested area, the rope is too short and infantry gets stuck few meters above ground. The helicopter also takes a long time to set up its altitude for infantry deployment: after reaching the marker, it's descending vertically at first, then ascending - and chosen altitudes are pretty high. Could you add hover height to that function ?

Share this post


Link to post
Share on other sites

hey Zen

Thanks for all your help everything is coming along nicely

any ideas how i can use your spawn macro to spawn rhs groups

ZEN_FMW_Code_SpawnMarker("mkPatrol", 3, east)

ive tried

ZEN_FMW_Code_SpawnMarker("Enemy_1", 3, rhs_vehclass_infantry, rhs_faction_msv)

ZEN_FMW_Code_SpawnMarker("Enemy_1", 3, rhs_faction_msv)

but neither seem to have any effect

Share this post


Link to post
Share on other sites
I've run into some issues with Zen_OrderFastRope. When I order fast-rope insertion into a forested area, the rope is too short and infantry gets stuck few meters above ground. The helicopter also takes a long time to set up its altitude for infantry deployment: after reaching the marker, it's descending vertically at first, then ascending - and chosen altitudes are pretty high. Could you add hover height to that function ?

Due to uncooperative and unskilled AI pilots, the precision required for fastroping must be achieved by forcing the helicopter's velocity. There is an unnecessary delay between Zen_OrderHelicopterLand getting the helicopter to the correct height (that's when it goes down) and Zen_OrderInsertion calling Zen_OrderFastRope (that's when it goes up).

That's about 3 seconds in which the AI can decide they want to be at a different height, even though they are told to fly at 30 meters. I can just remove that delay and everything will still work.

Even forcing the helicopter to stop instantly still allows it to move up very slowly (about 1 meter per person that fastropes). Thus, I can just change the length of the ropes accordingly for each person.

This is working for me, so I'll update Google drive.

hey Zen

Thanks for all your help everything is coming along nicely

any ideas how i can use your spawn macro to spawn rhs groups

ZEN_FMW_Code_SpawnMarker("mkPatrol", 3, east)

ive tried

ZEN_FMW_Code_SpawnMarker("Enemy_1", 3, rhs_vehclass_infantry, rhs_faction_msv)

ZEN_FMW_Code_SpawnMarker("Enemy_1", 3, rhs_faction_msv)

but neither seem to have any effect

Addon units are a different faction rather than a different side. The macros use the default factions and soldier types of Zen_SpawnInfantry. The macro doesn't offer every possible argument for every function it uses for usability reasons. Of course, you can make your own macro that's slightly different:

#define ZEN_FMW_Code_SpawnMarkerCustomUnits(M, N, S, T, F) \
   _Zen_GrpsArray = []; \
   for "_Z" from 1 to N do { \
       _Zen_Pos = [ M ] call Zen_FindGroundPosition; \
       _Zen_Group = [_Zen_Pos, S, "infantry", [4,6], T, F] call Zen_SpawnInfantry; \
       _Zen_GrpsArray pushBack _Zen_Group; \
   }; \
   0 = [_Zen_GrpsArray, S] call Zen_GiveLoadout; \
   0 = [_Zen_GrpsArray, M] spawn Zen_OrderInfantryPatrol;

// ... 
ZEN_FMW_Code_SpawnMarkerCustomUnits("Enemy_1", 3, west, rhs_vehclass_infantry, rhs_faction_msv)

I'm not sure if that's exactly how it goes for RHS, but you see what it's getting at.

Share this post


Link to post
Share on other sites
Due to uncooperative and unskilled AI pilots, the precision required for fastroping must be achieved by forcing the helicopter's velocity. There is an unnecessary delay between Zen_OrderHelicopterLand getting the helicopter to the correct height (that's when it goes down) and Zen_OrderInsertion calling Zen_OrderFastRope (that's when it goes up).

That's about 3 seconds in which the AI can decide they want to be at a different height, even though they are told to fly at 30 meters. I can just remove that delay and everything will still work.

Even forcing the helicopter to stop instantly still allows it to move up very slowly (about 1 meter per person that fastropes). Thus, I can just change the length of the ropes accordingly for each person.

This is working for me, so I'll update Google drive.

It's working now, thanks !

Yes, the AI pilots are unreliable at best, I would avoid using them, but in my small community, I can't spare enough people to crew two Blackhawks :(

Share this post


Link to post
Share on other sites

Is there a way to get the AI to patrol multiple buildings in an area. As sort of a sweep and clear type maneuver? I know you have a patrol buildings function that works really well but it's a continuous thread and doesn't end after they have "cleared" the building.

And I have a coding question. Is there a way to get an AI to move to a specific point in a building that's not on the ground floor? Right now I've tried move and doMove and the AI will go to the X and Y coordinates but not the Z coordinate (upstairs). Do you have to use another command to get them to path to the other floors? (I know you can setPos or setPosATL (which I'm currently using) but for immersion I'd like them to move to the position)

Edited by CDN_BiggDogg

Share this post


Link to post
Share on other sites
Is there a way to get the AI to patrol multiple buildings in an area. As sort of a sweep and clear type maneuver? I know you have a patrol buildings function that works really well but it's a continuous thread and doesn't end after they have "cleared" the building.

And I have a coding question. Is there a way to get an AI to move to a specific point in a building that's not on the ground floor? Right now I've tried move and doMove and the AI will go to the X and Y coordinates but not the Z coordinate (upstairs). Do you have to use another command to get them to path to the other floors? (I know you can setPos or setPosATL (which I'm currently using) but for immersion I'd like them to move to the position)

That's a good feature request; I'll have to think about how to add that in, but I should have it by next release.

Assuming Zen_OrderInfantryPatrolBuilding works, doMove is the correct command. It gives the units positions directly from Zen_FindBuildingPositions. You might want to check the height of your position. Or doMove stopped working at some point and I didn't notice.

Share this post


Link to post
Share on other sites
That's a good feature request; I'll have to think about how to add that in, but I should have it by next release.

Assuming Zen_OrderInfantryPatrolBuilding works, doMove is the correct command. It gives the units positions directly from Zen_FindBuildingPositions. You might want to check the height of your position. Or doMove stopped working at some point and I didn't notice.

I actually was just trying to get a single unit to move to a spot on the second floor of the main airbase terminal building and stay there. I wasn't using any of your functions but I couldn't get him to climb the stairs. For the height do you have to have it at floor level or how does your Zen_FindBuildingPositions calculate the coordinates for height?

Share this post


Link to post
Share on other sites
I actually was just trying to get a single unit to move to a spot on the second floor of the main airbase terminal building and stay there. I wasn't using any of your functions but I couldn't get him to climb the stairs. For the height do you have to have it at floor level or how does your Zen_FindBuildingPositions calculate the coordinates for height?

I was referencing Zen_OrderInfantryPatrolBuilding because it's doing the same thing you're trying to do; you can look at it and compare with your code. Zen_FindBuildingPositions calculates the height by ray collision detection from points ascending each level of the building. It should detect every correct 3D position with a floor and ceiling for as many levels as the building has at a 2D position. It's intended to be as accurate as standing in the building yourself and using getPosATL.

You can use setPosATL and doMove directly with Zen_FindBuildingPositions positions; however, the AI might have trouble getting to some of the positions; maybe they are not able to find a path to a few points for some reason. The AI likes to use predefined building positions; those are what you see when you command AI in a building. Those typically lack a high enough density to be useful in many cases, thus Zen_FindBuildingPositions will generate more points for you.

Share this post


Link to post
Share on other sites
I was referencing Zen_OrderInfantryPatrolBuilding because it's doing the same thing you're trying to do; you can look at it and compare with your code. Zen_FindBuildingPositions calculates the height by ray collision detection from points ascending each level of the building. It should detect every correct 3D position with a floor and ceiling for as many levels as the building has at a 2D position. It's intended to be as accurate as standing in the building yourself and using getPosATL.

You can use setPosATL and doMove directly with Zen_FindBuildingPositions positions; however, the AI might have trouble getting to some of the positions; maybe they are not able to find a path to a few points for some reason. The AI likes to use predefined building positions; those are what you see when you command AI in a building. Those typically lack a high enough density to be useful in many cases, thus Zen_FindBuildingPositions will generate more points for you.

Thanks for the explanation. I played with doMove and it was definitely the Z position causing the problem so I came up with a pretty good workaround. I enabled the debug console then I used the commands _pos = getPosATL player; hint str _pos; copyToClipboard str _pos;. Then I hit execLocal button and it outputs my exact position and copies it to the clipboard. Once I did that then the doMove worked as intended. I can also place objects anywhere I want with good precision at any height! Then I just have to get the direction right! So thanks for the help!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×