Jump to content
Sign in to follow this  
NGagedFX

A few scripting problems I'm running into

Recommended Posts

First:

When you combine a Tripod Bag and M252 US Bag you'll be able to assemble an M252 Mortar. However, this mortar will only have very basic functionality as you'll have to fire on intuition. So is it possible to sync the assembled mortar with an Artillery Module in order to give it the ''Target Artillery'' option?

Second:

As of now, I find it pretty hard to target accurately using the "Target Artillery"-option, since the map is rather small and zoomed out. Is there any way in which the target-map can be fullscreen or in which you have to ability to zoom in on this target-map?

Third:

I added a little script with which you're able to get backpacks out of a ''Backpack Heap'' (a static object available in the editor). Also available is the UAV Terminal Backpack. What I want to do, is that when this backpack is added to a player, is to sync it with the ULB Module. However, I was unable to get it to work. Here's the setup:

ULB Module - ulb1

Backpack Heap - no name

BH Init: addBackpack = this addAction ["Add UAV Pack", "backpack\addUAVPack.sqf"];

addUAVPack.sqf:

removeBackpack player;

player addBackpack "US_UAV_Pack_EP1";

(unitBackpack this) synchronizeObjectsAdd [ulb1];

Any backpack is removed and the UAV Terminal Backpack is added. However, it doesn't get the ability to control the ULB. I also tried this synchronizeObjectsAdd-command in multiple ways with some other objects in the editor, but I can't seem to get this command to work at all. :confused:

Fourth:

I've synced this ULB Module to different vehicles (Terminal HMMMV, Striker MEV, Apache) but the only way this "ULB"-option pops up is when standing near it. I am in no way able to control the ULB when sitting in one of these vehicles. As for the HMMMV and Striker, it's not really much of a problem since you could just get out and use it, but you can't when flying an Apache. The only way I got it to work with an Apaches was when the player started in one, but since I don't want all players to start off in Apaches, I need to be able to somehow link it to an empty Apache so anyone that gets in it is able to control the ULB.

I don't mean to overload you with my problems, but I really can't get around them. I hope you guys know a solution to them. ;)

Share this post


Link to post
Share on other sites

Third:

I wrote a script for exactly the same. But the UAV works too :)

/*
===============================================================================================
TerminalBackpack - by Cyborg11
Version: 1.2
Date: 15.07.2010
Description:	A unit with a UAV Terminal Backpack has access to an UAV and ULB
			1. Synchronize the ULB to the ULB module and the UAV to the UAV module
			2. Name the modules
			3. Execute the script on the soldier that should have the action

Parameter: nul = [unit, ULB module, UAV module] execVM "TerminalBackpack.sqf";
	_unit = object which should have access to UAV/ULB
	_ulbm = name of ULB module - if you don't have a ULB module use nil
	_uavm = name of UAV module - if you don't have a UAV module use nil

Example:	nul = [this, ULBM1, nil] execVM "TerminalBackpack.sqf";
		nul = [this, nil, UAVM1] execVM "TerminalBackpack.sqf";
		nul = [this, ULBM1, UAVM1] execVM "TerminalBackpack.sqf";

Changelog:
v1.2:	- UAV works now
v1.1:	- fixed a few bugs with the ULB
v1.0:	- release
===============================================================================================
*/

private ["_unit", "_uavm", "_ulbm", "_terminal", "_terminalArray", "_unitList", "_newUnitList", "_rules", "_newRules"];

_unit = _this select 0;
_ulbm = _this select 1;
_uavm = _this select 2;

If (isNil "_ulbm" && isNil "_uavm") exitWith{
hint "ERROR in script TerminalBackpack.sqf!\n\nBoth modules are NIL, cancel script!"; 
diag_log text format ["**** ERROR in Script 'TerminalBackpack.sqf' in mission '%1'!", missionName];
diag_log text format ["**** Both module values (_ulbm / _uavm) are NIL!"];
};

// [98,97,99,107,112,97,99,107,95,117,115,95,97,117,118,46,112,51,100] - backpack_us_auv.p3d - Classname: US_UAV_Pack_EP1

While {alive _unit} do {
_backpack = unitBackpack _unit;
_condition = toArray(str(_backpack));

If (115 IN _condition && 95 IN _condition && 97 IN _condition && 117 IN _condition && 118 IN _condition && 46 IN _condition) then {
	If (!isNil "_ulbm") then {
		_unitList = _ulbm getVariable "unitList";
		If (!(_unit IN _unitList)) then {
			_newUnitList = _unitList + [_unit];
			_ulbm setVariable ["unitList", _newUnitList, true];
		};
	};

	If (!isNil "_uavm") then {
		_rules = _uavm getVariable "rules";
		If (!(_unit IN _rules)) then {
			_uavm synchronizeObjectsAdd [_backpack, _unit];
		};
	};		
} else {
	If (!isNil "_ulbm") then {
		_unitList = _ulbm getVariable "unitList";
		If (_unit IN _unitList) then {
			_newUnitList = _unitList - [_unit];
			_ulbm setVariable ["unitList", _newUnitList, true];
		};
	};

	If (!isNil "_uavm") then {
		_rules = _uavm getVariable "rules";
		If (_unit IN _rules) then {
			_uavm synchronizeObjectsRemove [_backpack, _unit];
		};
	};
};

sleep 2;
};

Share this post


Link to post
Share on other sites

Third:

I added a little script with which you're able to get backpacks out of a ''Backpack Heap'' (a static object available in the editor). Also available is the UAV Terminal Backpack. What I want to do, is that when this backpack is added to a player, is to sync it with the ULB Module. However, I was unable to get it to work. Here's the setup:

ULB Module - ulb1

Backpack Heap - no name

BH Init: addBackpack = this addAction ["Add UAV Pack", "backpack\addUAVPack.sqf"];

addUAVPack.sqf:

Any backpack is removed and the UAV Terminal Backpack is added. However, it doesn't get the ability to control the ULB. I also tried this synchronizeObjectsAdd-command in multiple ways with some other objects in the editor, but I can't seem to get this command to work at all. :confused:

The ULB issues have been discussed elsewhere. :)

Basically ULB is designed to be used by a player-from-the-start Apache only. If you switched out the ULB for the UAV module what you're trying would work just perfectly with the backpack and stuff.

Share this post


Link to post
Share on other sites

You can use the synchronizeObjectsAdd command for the UAV module but for the ULB module you have to change the unitList variable :)

Like I did in my script. And it's working. You can control your ULB as a soldier.

BIS did the same in Coltan Blues :)

=> http://community.bistudio.com/wiki/ULB

BIS_heli_uav_0 setvariable ["unitList",[hco_west_1,hco_west_2]];

The reason why you can use the synchronizeObjectsAdd command on the UAV module is this:

_linked = synchronizedobjects _logic;
{
if (vehicle _x iskindof "uav") then {
	[_logic,"uavList",[_x],true,true] call bis_fnc_variablespaceadd;
} else {
	if !(isnull leader _x) then {
		[_logic,"rules",[_x],true,true] call bis_fnc_variablespaceadd;
	} else {
		[_logic,"terminals",[_x],true,true] call bis_fnc_variablespaceadd;
	};
};
sleep 0.01;
} foreach _linked;

Such a code doesn't exist in the ULB module so you have to manually override the variables.

First:

Maybe you can try to find the Mortar with the nearObjects command to give it a name and after this you can do whatever you want with it.

Second:

Theres only one method: You have to change the script and the dialog. :D

Share this post


Link to post
Share on other sites

Sorry Cyborg11, but I can't get your script to work entirely as I intended. It works wonderfully when only the ULB is synced to the ULB Module, but if I sync any additional vehicles to the ULB, it doesn't work at all. My plan was to use the Stryker MEV as an MHQ vehicle and the HMMMV Terminal as a reconnaissance unit, both of which should be able to acces the ULB. And ofcourse the UAV Terminal back at the base should also allow acces.

Setup:

-Operator - no name

Init: nul = [this, ulbm, nil] execVM "TerminalBackpack.sqf";

-ULB Module - ulbm

-ULB (no name) synced to ULB Module

-UAV Terminal ("yellow version", no name), Stryker MEV (empty, no name) and HMMMV Terminal (empty, no name) synced to ULB Module

-And ofcourse in my mission folder your TerminalBackpack.sqf

Do you have any idea what's going wrong? :( My idea for a solution would be to extend your script, but replace the requirement of ''having a UAV Backpack'' to "sitting in a Striker MEV/HMMMV Terminal or standing near UAV Terminal", which would almost instantly solve n.4 too.

First:

I tried the nearObjects command, but I was unsuccesfull as usual. :(

Setup:

-Artillery Module - artym

-Operator - no name

-Tripod Bag - no name

-M252 Bag - no name

-Trigger - no name

Activation: Radio Alpha

Text: Add Target Artillery

onAct: nObject1 = getPos player nearestObject "M252_US_EP1"; artym synchronizeObjectsAdd [nObject1]

So I assemble the M252 Mortar, fire the Alpha channel, get in the gunner seat, and there's no "Target Artillery"-option. :mad:

Edited by NGagedFX

Share this post


Link to post
Share on other sites

It's a bug in the ULB module.

It doesn't work on empty vehicles :(

Only on the player and on player / AI controlled vehicles.

If you do the setup do YOU have acess to the ULB?

Oh and btw: Your setup won't work in MP because the ULB module is buggy in MP. Another player expect the host can't use the ULB. If he tries to use it he will be stucked into the ULB camera and can't exit it.

So he have to restart the game. :p

Share this post


Link to post
Share on other sites

If I don't use your script and link empty vehicles to the ULB Module, then I can acces the ULB when standing near them. If I don't link anything but the ULB to the module, then your script works perfectly. And about the MP component, I noticed that when testing it with a friend. Once he got in the ULB itself or in a ULB controlling object, he was stuck in there, unable to do anything.

It's strange that BIS delivered such an overloaded-by-bugs-module. But I guess that gives me a good reason to limit use of the ULB to the mentioned vehicles, and at UAV control to the UAV Terminal and UAV Backpacks. That way there still is a difference in role and purpose I guess (atleast until BIS fixes the module). Now I only need to setup a proper working UAV, which I've been trying for hours since the release of OA, but it still doesn't cut the job for me. But I'll leave that to another thread. ;)

You seem to know quite a lot about scripting, and I don't want to force my question upon you, but since you were able to link the ULB to a backpack, would it also be possible to link it to sitting inside a vehicle? :o

Share this post


Link to post
Share on other sites

I don't know why my script doesn't work anymore if you sync the module to an empty vehicle :(

The unitList variable only lists me and not the empty vehicle.

It's strange :eek::eek:

I can't get the ULB module working with empty vehicles. It doesn't work.

BIS should fix the ULB module then we can do what we want :)

Maybe the wiki helps you with your mortar problem :)

Share this post


Link to post
Share on other sites

Cyborg, I'm not sure if it's me, or the buggy ULB/UAV modules, but I can't seem to get your script to work.

I'm willing to sacrifice a red-shirted ensign, and use an AI piloted ULB (and just pretend it's empty), but no matter how many times I try, it just keeps telling me that the ULB is destroyed, even though I see it hovering right over us.

And the UAV just keeps crashing on me the moment mission starts. And/or the addaction doesn't show up.

Could be me. I don't doubt that a bit.

Alternatively, I could use ideas from you clever guys. I'm using SHK's script and kylania's example mission, to have the chopper 'crash' at one of a few random places in the map. So, what's a good / fun way for the player to identify where this chopper has crashed?

I just thought it would be fun to use one of those UAV/ULB toys with the new UAV backpack, as a starting point in the mission to find the downed chopper ... so that we can then have a mission to go to it.

Share this post


Link to post
Share on other sites
So, what's a good / fun way for the player to identify where this chopper has crashed?

waitUntil {local player};
sleep 0.1;
player attachTo [ch, [0,0,0]];
player sideChat "Oh shi--";
sleep 0.1;
waitUntil {(getPos ch select 2) < 25};
detach player;
player setPos getMarkerPos "start";
player sideChat "Phew!";

Share this post


Link to post
Share on other sites

Does anyone know if there have been any missions released using this script? Would love to be able to see it working, so I can figure out what I'm doing wrong.

Share this post


Link to post
Share on other sites

Forgive me, I was referring to the ULB script.

And, well, this is embarrassing, but I guess all I needed to do was change my AH-6J, to an AH-6X, and now it seems to be working. :o Not sure why I hadn't tried that sooner.

Now all I'm struggling with is trying to adapt and learn from what you gave me in another thread, so that I can use it with Revive/Respawn.

I'm trying variations like this on the afterRespawn.sqf that you so kindly provided earlier;

if (player == s2) then {
    _actionId = player addAction["Fire Missile","launchMissile.sqf",[this, 

missilestart,"M_Hellfire_AT",200], 1, false, true, ""];


}


if (player == s2) then { "nul = [this, ULBM1, nil] execVM "TerminalBackpack.sqf""; }

but so far, no luck. Closest I've gotten so far, is when I did something along the lines of

if (player == s2) then {"execVM TerminalBackpack.sqf"};

or something like that, I can't even remember now, and it threw up the hint/warning that said "Both modules are NIL, cancel script". So I knew it was trying to work, but it needed that first part added in there somehow as well.

I understand that I need to reactivate it using your clever solution just like you did for the guided missiles, but it's the actual syntax that I absolutely drown in.

Edit: if (player == s2) then {

_actionId = player addAction["Fire Missile","launchMissile.sqf",[this, missilestart,"M_Hellfire_AT",200], 1, false, true, ""]; null=[s2, ULBM1, nil] execVM "TerminalBackpack.sqf";

}

Thanks to you kylania, and Cyborg11, my FAC friend can have ULB and Revive too.

Edited by R.Flagg
Wile E. Coyote, Super Genius

Share this post


Link to post
Share on other sites

Is it possible to remove the vehicle identification squares friendly and enemy, from the map when using the ULB / TerminalBackpack.sqf ?

I wish to use the ULB for recon, to find bad guys, and/or downed choppers, etc... but when using the ULB, and looking at the map (to give it a waypoint)... I can already see where everything is at due to these vehicle identification rectangles or squares (not sure what they are called).

Any help removing that info from the map would be much appreciated.

Share this post


Link to post
Share on other sites

Same as the above post and how would one go about using an ACE backpack can't seem to find the line in the script about where to remove it, and I i'm bad with scripts.

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  

×