Jump to content
champ-1

CH Mobile Headquarters

Recommended Posts

CH Mobile Headquarters v0.91

Download from Dropbox

Download on Armaholic



Description:

This script modifies certain vehicles for use as a mobile headquarters. In other words it allows to teleport from the object at the base to one of the HQ vehicles deployed on the map. For now it supports these vehicles:

- HEMTT Transport

- Tempest Transport

- Zamak Transport (CSAT)

- Zamak Transport (AAF)

- Truck (FIA)

But you can configure any vehicle for use with this script. (see section "for advanced users")

Features:

- HQ composition for every faction

- any action (Arsenal, VAS) can be attached to any object in composition

- customizable HQ and cargo objects

- immersive HQ deployment

- can work with any custom vehicles and objects

- different map markers for mobile and deployed HQ

- immersive teleport to HQ

- supports multiple HQs at a time

Installation:

1. Copy "CHHQ.sqf" into your mission folder.

2. Place any object (for example: map or flag) in editor that will be used to teleport to HQ.

3. Add following code in that object init line:

null = [this, SIDE] execVM "CHHQ.sqf"

Where SIDE is the name of the side (west, east or resistance) MHQ belongs to.

4. Place one of the supported vehicles in editor.

5. Add following code to the init line of that vehicle:

null = [this, SIDE (optional)] execVM "CHHQ.sqf"

Where SIDE is the name of the side (west, east or resistance) this MHQ will belong to. If SIDE is left empty, default vehicle side is used.

6. (Optional) Add the following code in your "init.sqf" if you wish enable or disable map markers for HQs:

CHHQ_showMarkers = false; // Set 'true' if you want real time map markers for all HQs on your side. (Default: true)

For advanced users:

You can add your own presets and edit existing ones for any HQ vehicle. Go to the bottom of the "CHHQ.sqf" and find line:

switch (toLower typeOf _obj) do {

Under this line are stored blocks of code with configuration of every supported vehicle. For example:

case ("b_truck_01_transport_f"): { // Type of HQ vehicle this configuration is used for. Warning: use only lower case letters!
_composition = [ // Array of arrays that contains object composition for deployed HQ
	[
		"Land_Cargo20_grey_F",
		[4.11963,-0.677246,0.0971179],
		271.612,
		{_this animate ["Door_1_rot",1]; _this animate ["Door_2_rot",1]} // executed localy on every PC
	]
];
_cargoInfo = [ // Array that contains information about cargo attached to HQ
	"Land_Cargo20_grey_F",
	[0.045,-2.31,1.15],
	270,
	"_this setVariable ['bis_disabled_Door_1',1]; _this setVariable ['bis_disabled_Door_2',1]" // executed localy on every PC
];
[_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup; // Function that starts this script
};

_composition: Array of Arrays in format:

String
- type of object

Array
- offset from HQ

Scalar
- relative direction from HQ

String or Code
- init code for the object. Special variables passed to the script code are _target (HQ vehicle) and _this (object itself).

_cargoInfo: Array in format:

String
- type of object

Array
- offset from HQ

Scalar
- relative direction from HQ

String or Code
- init code for the object. Special variables passed to the script code are _target (HQ vehicle) and _this (object itself).

To create your own object composition you can use my function below.

Place in editor (preferably on an empty VR map) vehicle you would like to create composition for. Add some objects around it (you can use Zeus for that). Get in that vehicle and run this function:

CHHQ_fnc_getComposition = {
_radius = _this select 0;
_veh = if (vehicle player isEqualTo player) then {objNull} else {vehicle player};
if (isNull _veh) exitWith {systemChat "You need to be inside the vehicle to grab object composition around it."};

_objArray = [];
_vehPos = getPosASL _veh;
_vehDir = getDir _veh;
{		
	if (_x != _veh && !(_x isKindOf "Man")) then {
		_type = typeOf _x;
		_offset = [_vehPos, getPosASL _x] call BIS_fnc_vectorDiff;
		_rotVector = [_offset, _vehDir] call BIS_fnc_rotateVector2D;
		_dirOffset = (getDir _x) - _vehDir;
		_objArray pushBack [_type, _rotVector, _dirOffset];	
	};
} forEach nearestObjects [_veh, ["all"], _radius];
copyToClipboard str _objArray;
};

[15] call CHHQ_fnc_getComposition; // radius in meters from vehicle to grab objects

Object composition will be copied in your clipboard.

Videos:

Changelog:

v0.91

- added: ability to execute code for every object in composition (for more information read section "for advanced users")

- added: algorithm to measure object composition size and check for suitable conditions only in that radius

- changed: removed dummy unit inside deployed HQ until (forever?) I learn how to make him invisible and stop from getting out of the vehicle

- fixed: marker names not having a proper ID

- fixed: disabled simulation for some objects in composition

v0.9

- beta release

Download

Edited by Champ-1
  • Like 1

Share this post


Link to post
Share on other sites
Guest

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

Great script really like it :D But there is a problem when the vehicle respawn its no longer a MHQ vehicle just a normal truck...

Share this post


Link to post
Share on other sites
Great script really like it :D But there is a problem when the vehicle respawn its no longer a MHQ vehicle just a normal truck...
Well obviously. Because it's not the same vehicle.

Some respawn scripts have an option to execute code on vehicle respawn, you can add

[this] execVM 'CHHQ.sqf'

there and it should work fine.

Share this post


Link to post
Share on other sites

Nice work bin messing around this it and try to spwan an rhs ammo box for us side but the virtual ammo box is not working any ideas ?

Share this post


Link to post
Share on other sites
Nice work bin messing around this it and try to spwan an rhs ammo box for us side but the virtual ammo box is not working any ideas ?
You mean Arsenal?

My guess is that when you place object in editor it has different process of initialization from when you spawn it with command. In other words: I DUNNO LOL

Share this post


Link to post
Share on other sites
Damn thanks for the info any idea how to fix this
I might add some virtual ammo box feature in the future.

Although I don't see much point in that. You teleporting from base to HQ you just got all ammo and weapons at the base. Why would you need more at the HQ?

Share this post


Link to post
Share on other sites

I KNOW WHAT YOU MEAN BUT TRY TO build this in to a mission so when you die you can start at different spwan points and when you start at mhq would be nice to have the ammo box there

Share this post


Link to post
Share on other sites

Maybe i answered my question but, logically it is compatible with MP?

I KNOW WHAT YOU MEAN BUT TRY TO build this in to a mission so when you die you can start at different spwan points and when you start at mhq would be nice to have the ammo box there

There is no need in this as Champ Said

Share this post


Link to post
Share on other sites

This is great and thanks for sharing it. However I seem to have a problem with certain objects. I was trying to create very advanced HQ, well more like a FOB, so I have spent a lot of time building. I have used MCC and Zeus, cause sometimes one of them is just not enough. In the end I use your function to generate a composition and ended up with this:

[["HouseFly",[2.20801,-2.77197,2.13987],332.548],["HoneyBee",[-1.8501,-3.80566,0.698578],90.1849],["HouseFly",[3.20483,-4.96436,1.83639],84.0151],["HoneyBee",[0.131836,-1.29834,0.573361],212.148],["Oil_Spill_F",[2.41821,-2.12646,0.124091],178.645],["HouseFly",[-1.48145,-6.24048,2.16958],281.517],["ButterFly_random",[3.18115,-6.34546,0.147679],296.454],["ButterFly_random",[3.62866,-1.97583,0.583371],190.194],["B_Truck_01_Repair_F",[0,0,0],0],["HouseFly",[3.85596,-1.38086,1.89677],331.981],["HoneyBee",[-3.46094,-2.89209,0.458437],316.015],["Land_TTowerSmall_1_F",[1.89038,-8.44263,0.124091],178.645],["TF_NATO_Radio_Crate",[4.6355,-7.34351,0.099093],178.595],["HoneyBee",[6.08472,-4.95972,0.507335],112.188],["HouseFly",[-2.19043,0.732422,1.82737],135.612],["HouseFly",[5.12646,-7.89111,1.16623],161.094],["Land_HBarrierBig_F",[-4.47852,-1.38086,-0.146642],270.668],["HoneyBee",[3.29736,-9.70313,0.461686],118.543],["HouseFly",[0.838379,-10.4756,1.61881],113.42],["Land_Leaflet_04_F",[4.44653,-9.25513,1.44228],82.5485],["Land_HBarrierBig_F",[-4.46362,-0.0490723,0.124091],269.705],["Land_PCSet_01_screen_F",[4.87476,-9.15234,0.0534067],130.108],["HouseFly",[2.40601,-10.4524,1.78818],112.196],["Land_HBarrierBig_F",[-5.10669,-7.94556,-0.010169],270.668],["Mosquito",[2.01685,2.33423,0.985028],41.5494],["Land_HBarrierBig_F",[-4.41455,-8.37817,0.124091],270.467],["HouseFly",[5.64771,-8.63867,1.55979],241.324],["Land_Cargo_House_V3_F",[6.98438,-7.67749,0.124091],359.166],["OfficeTable_01_new_F",[4.91309,-9.47607,0.0990925],90.5304],["Item_FirstAidKit",[4.93652,-9.65552,0.124108],178.645],["Mosquito",[4.92578,-9.79224,1.12723],339.258],["Land_TacticalBacon_F",[4.77759,-9.97656,0.879985],178.731],["Land_PCSet_01_case_F",[4.8833,-9.95825,0.0990858],89.4273],["HoneyBee",[-6.19238,-6.74658,0.482352],148.11],["HouseFly",[7.17212,-7.88818,1.93985],79.0445],["Land_Graffiti_02_F",[7.94922,-6.39038,1.84769],1.85938],["Land_OfficeCabinet_01_F",[4.76611,-10.6641,0.099133],355.795],["Land_OfficeChair_01_F",[5.84619,-10.2996,0.0990939],308.684],["HoneyBee",[-7.26416,-5.4043,0.420335],39.1662],["Land_Pallet_MilBoxes_F",[8.24341,-7.46484,0.131279],359.913],["HoneyBee",[9.04639,-5.12915,0.370598],331.418],["Land_MapBoard_F",[7.22852,-10.2676,0.0968647],331.444],["Land_HBarrierBig_F",[-1.25562,-13.7913,0.0187016],181.054],["Land_HBarrierBig_F",[-1.18726,-13.6331,0.124091],180.626],["Land_PaperBox_open_full_F",[8.4751,-9.76099,-0.00475693],359.913],["Land_HBarrierBig_F",[7.18457,-13.874,-0.0496759],181.054],["Land_HBarrierBig_F",[7.21753,-13.5759,0.124091],180.626],["ButterFly_random",[11.5613,0.400391,0.13834],254.106],["Land_HBarrierBig_F",[-4.39575,7.177,-0.144029],270.668],["Land_HBarrierBig_F",[-4.44897,8.2561,0.124091],271.217],["Land_HBarrierBig_F",[12.6018,-10.3816,0.424091],270.558],["Misc_cargo_cont_net3",[2.66968,9.35181,1.62409],180.91],["Land_HBarrierBig_F",[12.6001,-11.1089,-0.14962],270.558],["Misc_cargo_cont_net3",[2.56396,9.42163,0.124091],180.91],["Misc_cargo_cont_net3",[-0.558594,9.46143,1.62409],180.91],["Misc_cargo_cont_net3",[-0.605469,9.49097,0.124091],180.91],["Misc_cargo_cont_net3",[5.76392,9.3064,0.124091],180.91],["PowGen_Big_EP1",[14.6819,-2.39844,0.124091],88.0809]]

Housefly, HoneyBee and Mosquito? I have used some object that came form mods, such as AIATP and RHS, TFAR, but I have no idea why would some objects be recognized as bugs? Could it be that those objects are with scope=1 ( private ) or this script cant get classnames from mods?

Here is how my deployed HQ ( FOB ) should look like.

cKa5u0gl.jpgFBG89sel.pngC6QQ9Y0l.pngBJa09iLl.pngbzjqiKIl.png3NjgNzLl.png

But when I deploy it here is what I get.

ZFfEivdl.jpgpEpSzFRl.jpgKFg0sm7l.jpgcltkaDml.jpg

Two trucks instead of one, and they spawn one of top another causing them to both blow up, the hesco bag fence is missing, at least half of it is, and its missing Z coordinate ( not one on top of another, they are all on ground, the HQ container house spawns rotated 180, and all of the furniture inside is thrown out.

So, what do I need to add to your grabber function in order to achieve what I want? Also ammobox idea is fine, it just needs to be added trough the code t the cargo space of the truck and need a initialization code for virtual arsenal. https://community.bistudio.com/wiki/Arsenal

Share this post


Link to post
Share on other sites

Housefly, HoneyBee and Mosquito? I have used some object that came form mods, such as AIATP and RHS, TFAR, but I have no idea why would some objects be recognized as bugs? Could it be that those objects are with scope=1 ( private ) or this script cant get classnames from mods?

Flies are fine, they are spawned by the game near houses and trees and some other objects. You can filter them or just ignore.

Two trucks instead of one, and they spawn one of top another causing them to both blow up, the hesco bag fence is missing, at least half of it is, and its missing Z coordinate ( not one on top of another, they are all on ground, the HQ container house spawns rotated 180, and all of the furniture inside is thrown out.

For my function to work properly you need to sit in the HQ truck, I'm guessing you didn't do that?

the hesco bag fence is missing, at least half of it is
For now this function copies objects around truck in radius of 15 meters. That's because when you deploy HQ it checks for empty and flat terrain around HQ. You may have troubles finding flat and empty land for such a big FOB you've build.

_MaSSive, I called that category "for advanced users" for a reasons. You have to understand what you are doing.

Post you mission with object composition here. Will see what's up with it.

Share this post


Link to post
Share on other sites

Figured out about the double truck part, I had to remove the actual truck from composition. Now that part works fine.

Still Hesco bags are not how I set them, and I ran the function from debug console while being inside the truck. Will attach the missions soon.

Here is the mission > Dropbox link

I have removed the housefly's, mosquitoes and other pests from array, increased scan range to 100 ( dont care about Altis and Stratis I dont play on them ) and from what I have is that all objects are there, but they seem to be flipped for 180 degrees ( not a problem Ill fix that in the grabber function, or you do it ) and still object place on top of each other dont work. Its missing Z coordinate, so I guess Ill have to add that to the grabber function. There is no Z ATL offset, and that is why ( I think ) landbags spawn all on the ground.

Note: You will need AIATP, TFAR and AGM possibly to run this mission. Place it in %userprofile%\Documents\Arma 3 - Other Profiles\**Your_Nickname**\MPMissions and run it from MP editor.

Edited by _MaSSive

Share this post


Link to post
Share on other sites

I think you uploaded wrong mission. There are only two objects on the map.

---------- Post added at 18:11 ---------- Previous post was at 18:07 ----------

increased scan range to 100 ( dont care about Altis and Stratis I dont play on them )
It's not only limitation of this function that grabs object composition, but of the CHHQ script iteself. If your FOB composition bigger then 15 meters in radius, some objects may end up inside houses, rocks, trees, etc. Because they are spawned outside of the range that checked for empty terrain.

Share this post


Link to post
Share on other sites

Its not wrong mission. Go ahead and deploy HQ. If you want composition is SQM format I can give you that. And Im just now trying to use getPosATL and 100m range. Ill see where it gets me.

PS: Pls forgive me I forgot that you need RHS Escalation also.

Missions.sqm

Edited by _MaSSive

Share this post


Link to post
Share on other sites

Dude, you saying you cant grab compisition correctly from placed objects and then you give me that wrong composition. Why would I need that? I asked you for your FOB placed in editor, but whatevs.

Fixed couple things, try it now:

CHHQ_fnc_getComposition = {
_radius = _this select 0;
_veh = if (vehicle player isEqualTo player) then {objNull} else {vehicle player};
if (isNull _veh) exitWith {systemChat "You need to be inside the vehicle to grab object composition around it."};

_objArray = [];
_vehPos = getPosASL _veh;
_vehDir = getDir _veh;
{
	if (_x != _veh && !(_x isKindOf "Man")) then {
		_pos = getPosASL _x;
		_dir = getDir _x;
		_type = typeOf _x;
		_offset = [
			(_vehPos select 0) - (_pos select 0),
			(_vehPos select 1) - (_pos select 1),
			(_pos select 2) - (_vehPos select 2)
		];
		_diroffset = _dir - _vehDir;
		_objArray pushBack [_type,_offset,_diroffset];	
	};
} forEach nearestObjects [_veh, ["all"], _radius];
copyToClipboard str _objArray;
};

[15] call CHHQ_fnc_getComposition; // radius in meters from vehicle to grab objects

Edited by Champ-1

Share this post


Link to post
Share on other sites

Whatever "dude". I gave you right composition I have no idea what are you talking about. Its not like BI has a 3D editor, I gave you MCC grabbed missions.sqm.

getPos wont work right, you need to use getPosATL or ASL, but I see you did that. Now it works with Y offset.

CHHQ_fnc_getOffset = {
   _veh = if (vehicle player isEqualTo player) then {nearestObject [player, "allVehicles"]} else {vehicle player};
   _objArray = [];
   _vehPos = getPosATL _veh;
   _vehDir = getDir _veh;
   {
       if !(_x isEqualTo _veh && _x isEqualTo player) then {
           _pos = getPosATL _x;
           _dir = getDir _x;
           _type = typeOf _x;
           _offset = [(_pos select 0) - (_vehPos select 0),(_pos select 1) - (_vehPos select 1),(_pos select 2) - (_vehPos select 2)];
           _diroffset = (_dir + 180 - _vehDir) % 180;
           _objArray pushBack [_type,_offset,_diroffset];    
       };
   } forEach nearestObjects [player, [], 100];
   copyToClipboard str _objArray;
};

With this I was able to grab what I wanted, Ill try getPosASL with your updated script and Ill tell you how it went. Of cousre this is pretty much demanding what I am doing. Average Joe wont need this, so your script will work nicely.

Just add killed MHQ notification, and remove all other remaining composition objects after XX seconds MHQ is killed, not to clutter the server. Perhaps add ammobox with VA in the truck. FOB or MHQ, every forward outpost must have supplies. Without it its not FO.

Share this post


Link to post
Share on other sites
Whatever "dude". I gave you right composition
In the second post, yes.
I have no idea what are you talking about.
Obviously you have an idea :D

Updated function above. Nothing is fliped now. Check it out.

---------- Post added at 19:16 ---------- Previous post was at 19:12 ----------

Just add killed MHQ notification, and remove all other remaining composition objects after XX seconds MHQ is killed, not to clutter the server.
All objects spawned by HQ removed when HQ is removed. You can add any notifications you like outside of this script. Some respawn scripts already have such notifications.
Perhaps add ammobox with VA in the truck. FOB or MHQ, every forward outpost must have supplies. Without it its not FO.
Lol dude, it's just an "immersive" way to teleport from base. It's not like its real HQ or anything :D

---------- Post added at 19:31 ---------- Previous post was at 19:16 ----------

By the way, really cool FOB (although I didn't see any moded objects), I hope it works on rugged terrain.

Share this post


Link to post
Share on other sites

You are evil you know? It works, and thanks for the help I guess. :yay:

Respawn, ammobox with VA, notification and all other parts will work for me with NSLVR script from Larrow. I wont bugg you with it.

This is intended to work on Fallujah, Takistan, Sahrani and Rahmadi, we dont play on Stratis and Altis. Ill make another composition with light FO, which will be about 20m in radius. This one is not actually 100m I just used 100 to be on the safe side. Its 50 perhaps.

Anyways thanks for the script, now it works wonderful. Will need a playtest on dedicated server, so I guess I let you know if it has any other issues.

Cheers.

Share this post


Link to post
Share on other sites

really nice script. Thanks

2 things.

is it MP compatible?

and sometimes get messgae that the HQ cantt be delployed here. be good to have info in that message as to why.

Edited by twisted

Share this post


Link to post
Share on other sites

I experienced yesterday that it is not really MP compatible.

We had some bugs:

1. Its not JIP compatible

2. For some people it bugs around. The Box from the MQH disappears. Some can't open the container door. Sometimes it does not move for some people even tough it is been driven....

Share this post


Link to post
Share on other sites
I experienced yesterday that it is not really MP compatible.

We had some bugs:

1. Its not JIP compatible

2. For some people it bugs around. The Box from the MQH disappears. Some can't open the container door. Sometimes it does not move for some people even tough it is been driven....

I'll double check it again, but last time I checked everything worked in MP.
Sometimes it does not move for some people even tough it is been driven....

This doesn't seems like its a bug with the script. Maybe you have major desync on server?

---------- Post added at 15:48 ---------- Previous post was at 15:44 ----------

is it MP compatible?
I thought so. :D
and sometimes get messgae that the HQ cantt be delployed here. be good to have info in that message as to why.
There is always two reasons: slope too steep or there are some objects nearby that may interfere with deployed HQ.

In the next update I will improve this part. It will check radius based on current object composition for HQ. So if you have really small HQ, you will be able to deploy it almost everywhere.

Edited by Champ-1

Share this post


Link to post
Share on other sites
I'll double check it again, but last time I checked everything worked in MP.

When we had a play yesterday, one member that JIP couldn't move to an deployed MHQ. (The MHQ was deployed before he joined)

This doesn't seems like its a bug with the script. Maybe you have major desync on server?

I was the only one that experienced these troubles. We probably have another session today. We will give it further testing and I can tell you later then! ^^

Share this post


Link to post
Share on other sites
We will give it further testing and I can tell you later then! ^^
Yeah, thanks

---------- Post added at 17:23 ---------- Previous post was at 16:44 ----------

Just tested it on dedicated server. There are some bugs, but nothing as serious as you described. At least for me.

It works with JIP and JIP can teleport to HQ.

Share this post


Link to post
Share on other sites

CH Mobile Headquarters v0.91

Download

Description:

Here you go guys, now you can have any virtual boxes and arsenals attached to any objects. I hope you like it :D

Changelog:

v0.91

- added: ability to execute code for every object in composition (for more information read section "for advanced users")

- added: algorithm to measure object composition size and check for suitable conditions only in that radius

- changed: removed dummy unit inside deployed HQ until (forever?) I learn how to make him invisible and stop from getting out of the vehicle

- fixed: marker names not having a proper ID

- fixed: disabled simulation for some objects in composition

Download

Edited by Champ-1

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

×