Jump to content
Sign in to follow this  
helling3r

Several editing problems (ACM and rearming)

Recommended Posts

Hello, im recently working on a apache tank hunt mission for 2 to 4 players which unfortunately gives me some trouble i cannot debug any further.

Thank you for your help, i was not able to get a step further with the forums, the biki, some internet sites and much of testing.

The mission can be downloaded here: http://silencers.de/~army/b-2-coop_apachetankhunt.takistan.pbo

  1. ACM-Module: I placed an ACM module which is synced to the player unit. I want it to spawn OPFORian infantry groups. This works already, but currently the enemy units spawn also in the BLUFOR base, which should NOT be the case. For that reason i read about the "blacklisting" via markers. Therefore i placed such a marker like the description says, but this do not work; however the area is deleted after mission start, so i assume it initializes correctly. The current position of the marker is my last try (assuming it to be a whitelist), prior to that it was placed over the base (as blacklist), which also did not work.
    What is wrong here?
  2. rearming the first chopper: At the base there are te two Helipads near the fuel-, ammo-, and repairtrucks. The right one is named "apache", the middle one is "apache2". "apache" was placed with the editor, "apache2" is spawned from an trigger (condition=true). Yesterday, "apache" was crewed by two humans while "apache2" was crewed by pilot=human, gunner=ai.
    While in single player it worked perfectly, in multiplayer it is not possible to rearm "apache", "apache2" works fine. Even sending the ai-gunner to "apache" did not work, neither did swapping seats of the two humans of "apache", nor did it work if only the pilot was in the chopper.
    What is courios is, that the pilot can see the "rearming..." text and also sees the ammunition going upwards. But then, suddenly, the old ammocount is restored and it goes up again. This results in the chopper never be able to resupply io ammo. Also very strange is, that refuelling and repairing works completely OK.
    Whats the problem here?

Share this post


Link to post
Share on other sites

#1. Im not sure about this I have never used the ACM, But I was under the impression that it did not work in multilayer.

#2. The Support trucks have always been very problematic to use. I dont bother with them, I just use a script to do the same task.

Here is xeno's great script for this:

Just put a trigger down over your heli pad.

In the condition:

("Helicopter" countType thislist > 0) && count (thislist unitsBelowHeight 1) > 0

onactivation:

nul0 = [(thislist select 0)] execVM "x_reload.sqf";

x_reload.sqf :

// by Xeno
private ["_config","_count","_i","_magazines","_object","_type","_type_name"];

_object = _this select 0;

_type = typeof _object;

if (_object isKindOf "ParachuteBase") exitWith {};

if (isNil "x_reload_time_factor") then {x_reload_time_factor = 1;};

//if (!local _object) exitWith {};

if (!alive _object) exitWith {};
_object setFuel 0;
_object setVehicleAmmo 1;	// Reload turrets / drivers magazine

_type_name = typeOf _object;

_object vehicleChat format ["Servicing %1... Please stand by...", _type];

_magazines = getArray(configFile >> "CfgVehicles" >> _type >> "magazines");

if (count _magazines > 0) then {
_removed = [];
{
	if (!(_x in _removed)) then {
		_object removeMagazines _x;
		_removed = _removed + [_x];
	};
} forEach _magazines;
{
	_object vehicleChat format ["Reloading %1", _x];
	sleep x_reload_time_factor;
	if (!alive _object) exitWith {};
	_object addMagazine _x;
} forEach _magazines;
};

_count = count (configFile >> "CfgVehicles" >> _type >> "Turrets");

if (_count > 0) then {
for "_i" from 0 to (_count - 1) do {
	scopeName "xx_reload2_xx";
	_config = (configFile >> "CfgVehicles" >> _type >> "Turrets") select _i;
	_magazines = getArray(_config >> "magazines");
	_removed = [];
	{
		if (!(_x in _removed)) then {
			_object removeMagazines _x;
			_removed = _removed + [_x];
		};
	} forEach _magazines;
	{
		_object vehicleChat format ["Reloading %1", _x];
		sleep x_reload_time_factor;
		if (!alive _object) then {breakOut "xx_reload2_xx"};
		_object addMagazine _x;
		sleep x_reload_time_factor;
		if (!alive _object) then {breakOut "xx_reload2_xx"};
	} forEach _magazines;
	// check if the main turret has other turrets
	_count_other = count (_config >> "Turrets");
	// this code doesn't work, it's not possible to load turrets that are part of another turret :(
	// nevertheless, I leave it here
	if (_count_other > 0) then {
		for "_i" from 0 to (_count_other - 1) do {
			_config2 = (_config >> "Turrets") select _i;
			_magazines = getArray(_config2 >> "magazines");
			_removed = [];
			{
				if (!(_x in _removed)) then {
					_object removeMagazines _x;
					_removed = _removed + [_x];
				};
			} forEach _magazines;
			{
				_object vehicleChat format ["Reloading %1", _x]; 
				sleep x_reload_time_factor;
				if (!alive _object) then {breakOut "xx_reload2_xx"};
				_object addMagazine _x;
				sleep x_reload_time_factor;
				if (!alive _object) then {breakOut "xx_reload2_xx"};
			} forEach _magazines;
		};
	};
};
};
_object setVehicleAmmo 1;	// Reload turrets / drivers magazine

sleep x_reload_time_factor;
if (!alive _object) exitWith {};
_object vehicleChat "Repairing...";
_object setDamage 0;
sleep x_reload_time_factor;
if (!alive _object) exitWith {};
_object vehicleChat "Refueling...";
while {fuel _object < 0.99} do {
//_object setFuel ((fuel _vehicle + 0.1) min 1);
_object setFuel 1;
sleep 0.01;
};
sleep x_reload_time_factor;
if (!alive _object) exitWith {};
_object vehicleChat format ["%1 is ready...", _type_name];

if (true) exitWith {};

Share this post


Link to post
Share on other sites

Thanks fopr that, i will try that out.

But i wonder why refuelling and repairing works on both helicopters, while rearming does not (or only partly as described above).

Could it be, that the helicopter is owned by its pilot, so the rearm is local to the pilot only? This would exactly fit the seen issues: Reload taking place at pilots view and not on gunners view, but pilots view is reset to state of gunners view (which could be the same as servers view?)

May it help to just spawn the "apache" by the server like i did with "apache2"?

About the ACM: i found this thread: http://forums.bistudio.com/showthread.php?t=89257&highlight=locality, i havent read it so far, but i will, maybe it helps.

Share this post


Link to post
Share on other sites

Please ignore this post. I had a typo in my code (missing commata) causing trouble.

Thue problems above however are not solved by this fix. :(

Edited by helling3r

Share this post


Link to post
Share on other sites

The issue you are having with rearming is not a code issue, as Xeno said it is an issue with the support trucks.

In my experience with this, you always need to be in the gunner seat as a pilot (get out of pilot and get in as gunner), or have a gunner already in place. Then as the gunner or with another player as gunner, make sure the gunner selects the "Rearm" action on the support truck, not the pilot. If its not working, make sure Manual Fire is off. If its STILL not working, have the pilot out of the aircraft (so there is only a gunner inside) and again select "Rearm" on the ammo truck.

Share this post


Link to post
Share on other sites

Ok, i will tra that; thank you!

For the ACM-Blacklisting, i found this post which i want to try also:

http://forums.bistudio.com/showthread.php?t=83056

[edit] before testing manually adding markers to the blacklisting, i would try the following:

http://forums.bistudio.com/showthread.php?t=83056 There one can read, that for auto-blacklisting to work, always two markers are needed; however as i understood the biki[1] only one marker needs to be placed and named specially. If the two-marker thingy turns out to be true, one should correct the biki[1] entry so that it shows more precisely how it works.

___

[1] http://community.bistudio.com/wiki/Ambient_Combat_Manager_-_Functions#By_markers

Edited by helling3r

Share this post


Link to post
Share on other sites

Hello murderhorse, thank you for your answer, but unfortunately it is completely unrelated and already answered a thousand times in other threads.

Despite that, im truly able to read the biki which makes it unneccessary to quote it here.

My ACM-Problem is only that blacklisting does not work as expected and there is already a possible solution for that.

The other problem regards rearming a chopper with an ammo truck with two human players.

Share this post


Link to post
Share on other sites

So, finally i got the time for further testing and editing.

The good news is, the ACM works like described above: To define one Blacklist zone via the auto-marker feature, one needs to place two markers, where BIS_ACM_1 defines the top left and BIS_ACM_2 the bottom right corner of a box. It does NOT work with the markers shape or dimensions!

The bad news is, i still did not get the rearm-script working in multiplayer. Xenos script did not work, but i put it there like described above.

To test the issue, i just put some "select this chopper and do repair it" into the trigger:

The second, only AI-Crewed chopper worked fine, it was indistructable while standing on the H-position where the trigger resides but my own still did not rearm.

I can not believe that this simple thing is so hard to implement to work in multiplayer.

Share this post


Link to post
Share on other sites

ok, got an idea: Does the trigger need to be repeatable?

Share this post


Link to post
Share on other sites

Do you Have an AI in the chopper with you? That can bug re-arming.

Share this post


Link to post
Share on other sites

Hello,

no, the problem occured with both human pilot and human gunner. I was in the gunner seat and did not even see an action-menu entry to rearm at the truck.

We tested it again with AI-Gunner, there it worked.

If you want to test it yourself, the current version can be downloaded here: http://silencers.de/~army/b-2-coop_apachetankhunt.takistan.pbo

Share this post


Link to post
Share on other sites
ok, got an idea: Does the trigger need to be repeatable?

just to make it clear, yes you need a trigger to be repeated if you want it to activate more than once.

Share this post


Link to post
Share on other sites

Ok, i got a step further. However the trigger fires only once at mission start. If i fly away, fire a few rounds and return, nothing happens... :(

The trigger is configured as activated by blufor, so thislist is filled properly. It is repeatable. Its min/max is configured as 0 and it is set to countdown, which should make no difference i think.

Trigger code:

class Item7
	{
		position[]={8076.1387,296.04001,1988.8252};
		a=5;
		b=5;
		activationBy="WEST";
		repeating=1;
		age="UNKNOWN";
		name="reload_trigger";
		expCond="(""Helicopter"" countType thislist > 0) && count (group(thislist select 0) unitsBelowHeight 1) > 0";
		expActiv="player sideChat ""DBG: reload_trigger fired"";nul0 = [(thislist select 0)] execVM ""x_reload.sqf""";
		class Effects
		{
		};
	};

---------- Post added at 22:13 ---------- Previous post was at 20:47 ----------

Ok, i found out why its not firing... It seems like the point where the position from the chopper is taken from is above 1 Meter. I raised it to 2 meters and now it works like a charm.

---------- Post added at 23:23 ---------- Previous post was at 22:13 ----------

Omg, i ran into another problem. The above stuff is solved, thank you.

Now i try my luck with some custom mission parameters.

One should trigger if the hinds are spawned or not while the second one should configure the ACM module.

However neither hinds are spawned, nor does the ACM work as expected (patrols are spawned but now the blacklisting is damaged again; it must be based on the varialbe because with a number it reliably works)

Here is what i do:

description.ext:

class b_acm_intensity {
title = "Enemy Patrol count";
values[] = {0, 0.2, 0.5, 1};
texts[] = {"Never", "Few", "Medium","Many"};
default = 1;
code = "b_var_acm_intensity = %1";
};

class b_spawnhinds {
title = "Spawn Hinds for second Apache";
values[] = {true, false};
texts[] = {"Yes", "No"};
default = true;
code = "b_var_spawnhinds = %1";
};

init.sqf:

[b_var_acm_intensity, BIS_ACM1] call BIS_ACM_setIntensityFunc;

the "condition of presence" is set to

b_var_spawnhinds

, but i also tried "b_var_spawnhinds==true" and "b_var_spawnhinds==1" (together with the proper parameter setting of course), none worked.

I test the hind presence condition with an tank target in front of the chopper.

What is courious is, that i use a trigger to generate some debug output, that shows the correct variable content according to the mission setting...

This drives me mad :(

Edited by helling3r

Share this post


Link to post
Share on other sites

You cant call mission peramiters directly like that, select them first and assign them to a var. Then you can use the info from them.

example:

init.sqf

mymissionvar = paramsArray select 1;

[mymissionvar, BIS_ACM1] call BIS_ACM_setIntensityFunc;

Just use paramsArray select 0 (Red number is what ever index in the paramsArray your peramiter is.

Share this post


Link to post
Share on other sites

Hm, please have a look int the pbo (linked above).

I use the F2 mission framework and that has some code at the top of init.sqf where the parameters are investigated one by one and finally the "code" statement of the parameter is compiled and executed.

As i understand that code (its a five liner or so) this also works for the f2 modules like selectable weather or the debug mode.

Since that code runs on top of init, i thought that my variables would be present, and my debug trigger indeed showed that they are there, at least if the mission starts running after briefing.

What is wrong here in my mind?

Share this post


Link to post
Share on other sites

Just for the record (see other Post[1]): The parameters code was correct; but the initialization order was not.

Therefore i removed the ACM-code and placed it into a separate script, which is called by init.sqf at the end. This way, it is run asynchronously and can wait on its own.

At the beginning of the script, a waiting line was introduced, so it waits for the parameters to be processed; this way, the variables are initialized when needed.

waitUntil {scriptDone f_processParamsArray};

The spawning stuff is implemented also in the separate script, as follow:

- The hinds in question each got a unique name

- If the parameter is NOT set to "please spawn hinds", i call deleteVehicle on those hinds.

It looks like the editor placed vehicles are initialized before the init.sqf runs (or in parallel, creating a race condition) and so they never get a chance to read the parameters.

___

[1] http://forums.bistudio.com/showpost.php?p=1951523&postcount=301

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
Sign in to follow this  

×