Jump to content
Zenophon

Zenophon's ArmA 3 Co-op Mission Making Framework

Recommended Posts

Hi @Zenophon

 

I have a bit of an odd issue. When I use Zen_AddGiveMagzine and Zen_AddRepackMagazines functions, and place the unit on the ship deck, the functions don't work. But when I move the units to land, it works as expected. 

 

I don't think the issue is your function per si, but an Arma issue, and it does not see the deck of the ship as a solid object, or something like that. 

 

Any ideas? or Anybody see this before? 

 

 

Share this post


Link to post
Share on other sites

Are you spawning the units on the deck (or placing them in the editor) and then using a loadout function?  There might be a delay for ArmA to create/initialize units on the ship; try adding a second or two wait before the functions run.  In general, units can have their equipment changed even if they are e.g. skydiving, in a vehicle, etc.; though, as you say, being on a ship might be a special case that is bugged.

 

The second fix is to spawn/place them on land, apply the loadout, wait/check that it is applied, then move them onto the boat.  Sometimes setup like this requires a short 'mission loading' black screen so that the player doesn't see units teleporting or changing equipment.

Share this post


Link to post
Share on other sites

Hi Zenophon

I just wanna say thanks for all of your arma 3 scripting framwork. I do know how to use modules and triggers to make mission but I'm struggling with Arma 3 scripts. your tutorials helps me a lot. Thank you so much !

Share this post


Link to post
Share on other sites

Hello.

 

Has anyone used findgroundposition with scripted markers?

 

It seems this is set up for editor placed markers only.

 

Was hoping for a work around so that function could follow markers placed from scripts.

 

Thanks.

Share this post


Link to post
Share on other sites
On 9/18/2020 at 2:06 PM, jandrews said:

Has anyone used findgroundposition with scripted markers?

Hi @jandrews   This is fairly random snipped of code I use - _this select 0 is the string name of the area marker. Marker can be map placed or created using Zen_SpawnMarker

 

while {!(_ok)} do
	{
	switch (tolower(_this select 1)) do {
		case "boat" :
			{
			_randomPos =  [_this select 0,0,[],2] call Zen_FindGroundPosition; // must be water
			_return = _randomPos findEmptyPosition [0,10,"O_Boat_Armed_01_hmg_F"];
			if ((count _return) > 0) then {
				_nObject = nearestObject [_return, "AllVehicles"];
				if !(isNull _nObject) then {_nObjectDist = _nObject distance2d _return} else {_nObjectDist = 50;};
//				if !(isNull _nObject) then {systemchat format ["Type of %1 at %2",typeof _nObject,_nObjectDist]}; // DEBUG
				if (_nObjectDist > 15) then {_ok = _return call DSC_isOutdoorsWet};
				};
			};
		case "inf" :
			{
			_randomPos = [_this select 0] call Zen_FindGroundPosition; // any land position
			_return = _randomPos findEmptyPosition [0,8,"Box_East_AmmoVeh_F"];
			if ((count _return) > 0) then {	_ok = _return call DSC_isOutdoorsDry};
			};
		case "static" :
			{
			_randomPos = [_this select 0,0,[],1,[3,15]] call Zen_FindGroundPosition; // off roads by 3m min (15-12)
			_return = _randomPos findEmptyPosition [0,12,"B_Truck_01_Repair_F"];

 

Share this post


Link to post
Share on other sites

Hi there Zenophon I'm having a problem with the framework, when I try to call an objective creation from documentation(I translated objective's text to Spanish) I get a generic error in expresion from Zen_AreTasksComplete.sqf line 34 note This was not an issue some months ago there is another problem involving zen_objectivepos could I get some assistance here? I'm really lost

          // Call functon to get random city/village area marker
          _randomCity = call f_getrandomcityAreaMarker;
          _randomCity setMarkerAlpha 0;	// Debug

          // Generate a random position within the city
          _ObjectivePos = [_randomCity] call Zen_FindGroundPosition;

          // Create a Eliminate Warlord objective at generated position
          _yourObjective = [_ObjectivePos, (resistance), east, "Officer","elimina"] call Zen_CreateObjective;

          // Assign a squad to protect the warlord
          _MortarGuard = [_ObjectivePos, east, "militia", [5,4]] call Zen_SpawnInfantry;
          // Call three custom functions to create a two dimensional array of 
          // markers in and around the center of the town
          _cityCenter = getMarkerPos _randomCity;
          _AREAMARKER_WIDTH = 200;
          // Create an array of positions relative to the city center
          _positionArray = [4,4,_cityCenter,_AREAMARKER_WIDTH] call f_getnearbyPositionsbyParm;
          // Convert all the positions into area markers
          _markerArray = [_positionArray,_AREAMARKER_WIDTH] call f_createMarkersfromArray;
          // Filter out all positions that are mostly water
          //_markerArray = [_markerArray] call f_filtermarkersbyTerrain;
          // Create FIVEE squads that move randomly within the grid
          for "_i" from 0 to 4 do {
            _newGroup = [_markerArray] call f_spawnsquadforMarkerArray;
          };

          waituntil { sleep 5; [(_yourObjective select 1)] call Zen_AreTasksComplete };

 

This is zen_aretaskscomplete.sqf
 

// This file is part of Zenophon's ArmA 3 Co-op Mission Framework
// This file is released under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)
// See Legal.txt

_Zen_stack_Trace = ["Zen_AreTasksComplete", _this] call Zen_StackAdd;
private ["_taskArray", "_taskState", "_tasksComplete", "_taskData"];

if !([_this, [["ARRAY", "STRING"], ["ARRAY", "STRING"]], [["STRING"], ["STRING"]], 1] call Zen_CheckArguments) exitWith {
    call Zen_StackRemove;
    (false)
};

_taskArray = _this select 0;

_taskState = ["failed", "succeeded", "canceled"];
if (count _this > 1) then {
    _taskState = _this select 1;
};

if (typeName _taskArray != "ARRAY") then {
    _taskArray = [_taskArray];
};

_tasksComplete = true;

{
    _taskData = [_x] call Zen_GetTaskDataGlobal;
    if !([(_taskData select 2), _taskState] call Zen_ValueIsInArray) exitWith {
        _tasksComplete = false;
    };
} forEach _taskArray;

call Zen_StackRemove;
(_tasksComplete)

There is a second issue involving framework usage, I use ALIVE in my mission on a dedicated server (this was an issue when I first translated the mission generation) on dedicated alive's virtualization changes Zen units into CSAT so I thought of using this snippet " this setVariable ["ALIVE_profileIgnore", true]; " on init, but I cant find unit's init in framework D: where do I place this in the framework? thankyou! have been stuck for months D:

Share this post


Link to post
Share on other sites

In the line

_yourObjective = [_ObjectivePos, (resistance), east, "Officer","elimina "] call Zen_CreateObjective;

it should be 'eliminate', or the task's completion trigger won't be set correctly.

By 'translated objective's text', do you mean that you modified Zen_ObjectiveCreateTask.sqf?  If so, check that there are no errors in that file.  Check the full log to see if there are any errors before the one from Zen_AreTasksComplete.

When I run the code below in an empty mission (just a player unit and a marker), there are no errors and the objective can be completed normally:

_yourObjective = ["Mk1", resistance, east, "Officer", "eliminate"] call Zen_CreateObjective;

diag_log str _yourObjective;
player sidechat str _yourObjective;

waituntil { sleep 5; [(_yourObjective select 1)] call Zen_AreTasksComplete };

player sidechat "task complete";

For the second problem, the code placed in a unit's 'init box' in the mission editor must be run by a script after the unit is created.  'this' changes to the variable or command the script uses to get the unit; for example,
 

_group = [...] Zen_SpawnInfantry;

{
    _x setVariable ["ALIVE_profileIgnore", true];
} forEach (units _group);

 

Share this post


Link to post
Share on other sites

Thanks man you helped me a lot with your example!! it was my mistake I wasn't calling the function correctly excellent framework!

Share this post


Link to post
Share on other sites

Hey man, not sure if I am going crazy but when trying to do this:
 

_g_O_patrol = [_p_spawnPatrol, east, AI_SKILL, [3,6], "Men", "OPF_F"] call Zen_SpawnInfantry;


that should get some vanilla CSAT faction guys it always prints theres no men in the faction. I also tried some modded ones with no luck.

Manually running:

["Men", east, "OPF_F", "All"] call Zen_ConfigGetVehicleClasses; 

from debug screen in editor comes up with empty array.

 

["Men", west, "BLU_F", "All"] call Zen_ConfigGetVehicleClasses; 

This is also an empty array.

 

However when I simply do:
 

_g_O_patrol = [_p_spawnPatrol, east, AI_SKILL, [3,6]] call Zen_SpawnInfantry;

 

It does spawn CSAT guys..


Any pointers?

Share this post


Link to post
Share on other sites

Hi Zen, Happy New Year!!! I hope 2021 is kind to you! Thank you for many many years of mission making with your scripts. I still use them to this day. I want to use Zen load outs to add a specific random Loadout (Array) to 2 specific units defined by the class names of the unit (EG "B_G_Soldier_F","B_G_Soldier_AR_F" etc). I also want the random loadout to be applied regardless of what side the specific units spawn on. I have the mission set up so named units can spawn as either Blufor or Opfor. This is to introduce a randomness to the mission. U do not know whether that soldier (For example) is friendly or hostile etc. 

 

I have tried with the script but cannot seem to get it to work. I would be very appreciative if you could Tellme how to do this!

Share this post


Link to post
Share on other sites

I appreciate this has not been updated for a while but has anybody else noticed that the Zen_OrderVehicleMove function is no longer working. Testing in vanilla usually results in the crew getting the order but not actually carrying it out (They also receive a waypoint which disappears after a second or so).

 

_ifvmv = [ifv0, [5084.19,4079.07,0]] spawn Zen_OrderVehicleMove; - example

 

Thanks anyway for your work on this fantastic framework

Share this post


Link to post
Share on other sites

This bug occurs when the driver is not the leader of the vehicle's crew; it might also affect Zen_OrderHelicopterLand.  I have updated the framework download links with a new version.  You can also fix it manually if you prefer:

 

line 96 Zen_OrderVehicleMove
 

    (((unitReady _vehicle) || (([_vehicle] call Zen_IsReady))) || (([_vehicle, _inPos] call Zen_Find2dDistance) < _completionDistance) || _isCrash || ((_vehicle isKindOf "SHIP") && ((getTerrainHeightASL getPosATL _vehicle) > -1)))

 

line 91 Zen_OrderHelicopterLand
 

    ((unitReady _heli) || {_isCrash})

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks so much for doing that, I find your framework indispensable these days and while 99% of the functionally has been working flawlessly I did notice in recent missions vehicles weren't moving to orders.

There was, for example, a similar result when using 'Zen_OrderInsertion' with ground vehicles so hopefully your change also fixed that.

 

Cheers

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

×