Jump to content
Sign in to follow this  
INF_MIke64

FIA Offroader augmentation.

Recommended Posts

This script provides a way to augment any Offroader or flatbed cive truck with the majority of static weapons found in vanilla A3.







Usage:
past script into mission file. add this
execVM "VehicleAugmentation.sqf";

into init.sqf.
position static weapon to the rear of the vehicle and use action menu to mount.

Known Issues:

V1.0
-Release
V1.1
-Mortars can now be manned and fired on the move
-Non raised HMG & GMG now supported for Offroader
V1.2
-Added Drone weapon compatability
-Fixed RTP error

V2.0
-Code rewrite
-Fixed:Actions are not removed correctly in MP (does not effect functionality)
-Fixed:Get out event not working In MP (player who mounts weapon can get out of weapon as intended, Others get out as standard and hover over vehicle)

 

V3.0

New Features:
-Hold Actions 
-Animation
-Configuration
-Vanilla vehicle config
-Vehicle to weapon action

Improved
-Getting out of weapon.
-Action limits

Removed
-Most MP bugs (hopefully)

-More stuff I can't remember

Credits:
IronFists Clan for helping test.
Anyone that replied with ideas for improvement.
Tajin for coding help

 

DOWNLOAD GITHUB
 

Edited by INF_MIke64

Share this post


Link to post
Share on other sites

i am running exactly your script in my server, nearly everything but the things i wrote in the resistance thread works for me.

Share this post


Link to post
Share on other sites

yep, as i wrote in the other thread. If you "prepare" vehicle then get in driver the "prepare" will never show up again until the vehicle would respawn with the script starting.

so you need to make if you go in driver that its still possible to have "prepare vehicle" in action menue.

Share this post


Link to post
Share on other sites

Ok thanks, unfortunately I've got lots of work going on until the 22nd March. You are welcome to make changes to my code if you wan't in the mean time.

Share this post


Link to post
Share on other sites

can you show here all the folders/files and other things wich are needed to implement into another mission than resistance.

Thus i tried to implement into another mod, but the "prepare vehicle" option isnt showing up on the vehicle...

i found:

Truck_initV2

Truck_init

truck_mountweapon

i gave the vehicle the name and the script that was working in resistance.

is there anything else i need to do other than copy thoose files in the correct folder way ?

handle any id`s ?

handle the prepare dialog elsewhere than thoose folders ?

any other files that it is working with i missed ?

something else ?

Edited by Kabs

Share this post


Link to post
Share on other sites

Don't use that code use the one posted here the instructions are at the top of the code.

Share this post


Link to post
Share on other sites
StaticMountV2.sqf

loading with:

MT = [[this,"Prepair Truck For Weapon","StaticMount.sqf"],"addactionMP",nil,false] spawn BIS_fnc_MP;

thoose two differs...

still if i name it both the same, now i see the prepare action, but it wont do it if i klick. Then i see the "get mortar on truck..whatever" until the truck is destroyed.

Share this post


Link to post
Share on other sites

yeah sorry it needs a update. you are aware this doesn't work properly that's why its posted here asking for help.

Share this post


Link to post
Share on other sites

but the version from LKincheloe is working for me without any problem ! *on his mod* so whats different ?

---------- Post added at 16:46 ---------- Previous post was at 15:28 ----------

Well ok i got it fixed now... somehow... think there was a missmatch in comands @vehicle. Or a spelling problem, not shure.

Now what you need to fix:

1. when prepare vehicle -> get in driver = prepare lost until car is destroyed.

2. When going out of mounted statics, often ends up glitching in the vehicle.

3. a better understanding/request where you can activate the action on the vehicle.

4. statics can be mounted from one vehicle to another *in mounted state* wich ends with the first vehicle removing itself no more static on itself bringing the static from the vehicle far away with the static, right behind the one without the static.

Also you can remove from both vehicles then :p its sorta glitchy and will bring bugusing in pvp thought.

5. we need to find a way to prevent statics from being dissassemble. For sure not if its mounted. this also leads to very bad glitches!!!!!!!

if thoose bad 5 are fixed, i thinks that would be nearly a stable realse time.

Thoose are big problems.

Edited by Kabs

Share this post


Link to post
Share on other sites

As much as its good to be interested in helping make things better i've got 3 courseworks due in soon and they are nowhere near done to my standards. As I said your welcome to do the work you found as problematic on it, but im not going to do anything untill I have my courseworks out of the way.

Share this post


Link to post
Share on other sites

np dont push yourself :) make it at ease. maybe i´ll lokk into somth.

Share this post


Link to post
Share on other sites

BTW: John, do you know where i can get a good C&H template? i am searching for a framework wich counts points for flag cap levels.

Share this post


Link to post
Share on other sites

found out that static at gets destroyed when mounted.

Edit: This fixes it. With new namecheck.

_LT = ["I_static_AT_F","O_static_AT_F","B_static_AT_F"];

if(typeOf _gun in _LT) then {_gun attachto [_veh,[0,-1.5,0.26]];_gun setDir 180;_gun setPos getPos _gun;};

Edited by Kabs

Share this post


Link to post
Share on other sites
found out that static at gets destroyed when mounted.

Edit: This fixes it. With new namecheck.

_LT = ["I_static_AT_F","O_static_AT_F","B_static_AT_F"];

if(typeOf _gun in _LT) then {_gun attachto [_veh,[0,-1.5,0.26]];_gun setDir 180;_gun setPos getPos _gun;};

thought it fixed that, but only in editor preview. on my server, the gun is still missplaced. gotta look into that maybe some more..

Share this post


Link to post
Share on other sites
thought it fixed that, but only in editor preview. on my server, the gun is still missplaced. gotta look into that maybe some more..

This is how i fixed it for server:

if(typeOf _gun in _L) then {_gun attachto [_veh,[0,-2.4,0.30]];_gun setDir 360;_gun setPos getPos _gun;};

if(typeOf _gun in _LT) then {_gun attachto [_veh,[0,-2.4,0.30]];_gun setDir 360;_gun setPos getPos _gun;};

but now i have problems with the remove action. the guns trying to get to ground but ending again on the offroader.

Share this post


Link to post
Share on other sites

Hey i know its been a while but i have had a shot at a update.

its still got all the debug stuff in it.

it now works on the rear of the vehicle automaticly (you may have to wait a while script isn't perfect)

//Add this to the INIT line of the vehicle you want to use nul = [this] execVM "StaticMountV3.sqf";
//Configured to work on Offroaders and trucks. Will work on nearly everything but weapon placing may be unrelyable.
//Known issues: Mortar explodes when moving and manned.
if (!isServer) exitWith {};
//setup
_veh = (_this select 0);
_moved = false;
_Cname = nil;
_Dname = nil;
_add = nil;
_MG = ["I_HMG_01_high_F","I_GMG_01_high_F","O_HMG_01_high_F","O_GMG_01_high_F","B_HMG_01_high_F","B_GMG_01_high_F"];
_L = ["I_static_AA_F","I_static_AT_F","O_static_AA_F","O_static_AT_F","B_static_AA_F","B_static_AT_F"];
_M = ["I_Mortar_01_F","O_Mortar_01_F","B_Mortar_01_F","B_G_Mortar_01_F"];
//hint "start";
//scan
while {alive _veh} do {
sleep 1;
if(!_moved) then{
	if (speed _veh <= 1 AND speed _veh >= -1 ) then {

		if(count attachedObjects _veh == 0) then {
			//Detection
			_NO = nearestObjects [[(_veh modelToWorld [0,-5,0]) select 0,(_veh modelToWorld [0,-5,0]) select 1,0],_MG + _L + _M,5];

				if(count _NO > 0)then{
				//Display name
				_Cname = typeof (_NO select 0);
				_Dname = getText (configFile >> "cfgVehicles" >> _Cname >> "displayName");
				//hint format ["%1", _Dname];

				//Action
				_add = _veh addaction [format["Attach %1",_Dname],{
				_NO = (_this select 3) select 0;
				_veh = (_this select 3) select 1;
				_L = (_this select 3) select 2;
				_MG = (_this select 3) select 3;
				_M = (_this select 3) select 4;
					//Locations
					if(typeOf (_NO select 0) in _L) then {(_NO select 0) attachto [_veh,[0,-1.5,0.25]];(_NO select 0) setDir 180;};
					if(typeOf (_NO select 0) in _MG) then {(_NO select 0)attachto [_veh,[0.25,-2,1]];};
					if(typeOf (_NO select 0) in _M) then {(_NO select 0) attachto [_veh,[0,-2,0]]; hint "Warning!\n Do not man the Mortar while moving. \n Causes vehicle to explode."};
				//Event Handler
				_out = (_NO select 0) addEventHandler ["GetOut", {(_this select 2) attachto [(_this select 0),[-3,-1,-0.5]]; detach (_this select 2);}];
				_veh removeaction (_this select 2);
				},[_NO,_veh,_L,_MG,_M]];
				};
			}else{
			//Attached 
			_atc = attachedObjects  _veh;

			//Display name
			_Cname = typeof (_atc select 0);
			_Dname = getText (configFile >> "cfgVehicles" >> _Cname >> "displayName");
			//hint format ["%1", _Dname];
			//Action
			_add = _veh addaction [format ["Detach %1",_Dname],{
			_atc = (_this select 3) select 0;
			_veh = (_this select 3) select 1;
			(_atc select 0) attachto [_veh,[0,-5,0.25]];
			detach (_atc select 0);
			//Remove event Handler
			(_atc select 0) removeEventHandler ["GetOut", 0]; 
			_veh removeaction (_this select 2);
			},[_atc,_veh]];
			};
		_moved = true;
	};
};
if(speed _veh > 1 OR speed _veh < -1 )then{
	_moved = false;
	if(!isNil "_add") then {_veh removeaction _add;};
};

};

Edit: added event handler to deal with getting stuck on getting out. fixed some bugs.

Edited by john681611
update

Share this post


Link to post
Share on other sites

More bug fixes

//Add this to the INIT line of the vehicle you want to use nul = [this] execVM "StaticMountV3.sqf";
//Configured to work on Offroaders and trucks. Will work on nearly everything but weapon placing may be unrelyable.
//Known issues: Mortar explodes when moving and manned.
//if (!isServer) exitWith {};
//setup
_veh = (_this select 0);
_moved = false;
_Cname = nil;
_Dname = nil;
_add = nil;
_MG = ["I_HMG_01_high_F","I_GMG_01_high_F","O_HMG_01_high_F","O_GMG_01_high_F","B_HMG_01_high_F","B_GMG_01_high_F"];
_L = ["I_static_AA_F","I_static_AT_F","O_static_AA_F","O_static_AT_F","B_static_AA_F","B_static_AT_F"];
_M = ["I_Mortar_01_F","O_Mortar_01_F","B_Mortar_01_F","B_G_Mortar_01_F"];
//hint "start";
//scan
while {alive _veh} do {
sleep 1;
if(!_moved) then{
	if (speed _veh <= 1 AND speed _veh >= -1 ) then {

		if(count attachedObjects _veh == 0) then {
			//Detection
			_NO = nearestObjects [[(_veh modelToWorld [0,-5,0]) select 0,(_veh modelToWorld [0,-5,0]) select 1,0],_MG + _L + _M,5];

				if(count _NO > 0)then{
				//Display name
				_Cname = typeof (_NO select 0);
				_Dname = getText (configFile >> "cfgVehicles" >> _Cname >> "displayName");
				//hint format ["%1", _Dname];

				//Action
				_add = _veh addaction [format["Attach %1",_Dname],{
				_NO = (_this select 3) select 0;
				_veh = (_this select 3) select 1;
				_L = (_this select 3) select 2;
				_MG = (_this select 3) select 3;
				_M = (_this select 3) select 4;
					//Locations
					if(typeOf (_NO select 0) in _L) then {(_NO select 0) attachto [_veh,[0,-1.5,0.25]];(_NO select 0) setDir 180;};
					if(typeOf (_NO select 0) in _MG) then {(_NO select 0)attachto [_veh,[0.25,-2,1]];};
					if(typeOf (_NO select 0) in _M) then {(_NO select 0) attachto [_veh,[0,-2,0]]; hint "Warning!\n Do not man the Mortar while moving. \n Causes vehicle to explode."};
				//Event Handler
				_out = (_NO select 0) addEventHandler ["GetOut", {(_this select 2) attachto [(_this select 0),[-3,-1,-0.5]]; detach (_this select 2);}];
				_veh removeaction (_this select 2);
				},[_NO,_veh,_L,_MG,_M]];
				};
			}else{
			//Attached 
			_atc = attachedObjects  _veh;

			//Display name
			_Cname = typeof (_atc select 0);
			_Dname = getText (configFile >> "cfgVehicles" >> _Cname >> "displayName");
			//hint format ["%1", _Dname];
			//Action
			_add = _veh addaction [format ["Detach %1",_Dname],{
			_atc = (_this select 3) select 0;
			_veh = (_this select 3) select 1;
			detach (_atc select 0);
			(_atc select 0) setpos [(_veh modelToWorld [0,-5,0]) select 0,(_veh modelToWorld [0,-5,0]) select 1,0];
			//Remove event Handler
			(_atc select 0) removeEventHandler ["GetOut", 0]; 
			_veh removeaction (_this select 2);
			},[_atc,_veh]];
			};
		_moved = true;
	};
};
if(speed _veh > 1 OR speed _veh < -1 )then{
	_moved = false;
	if(!isNil "_add") then {_veh removeaction _add;};
};

};

only fault now is the action isn't removing for everyone, but its a cosmetic bug.

Share this post


Link to post
Share on other sites

Finaly decided to release it here is the video more info to come soon.

Share this post


Link to post
Share on other sites

Heyho, looks nice.

The news at armaholic say you need help to make this run in MP.

If you contact me in Skype/Steam I might help you.

Share this post


Link to post
Share on other sites

Hey bud, unfortunately for some reason Armaholic threw out my updated information I had given them in the file submission and quoted this forum before I could update it from when I was stuck. If you check the first post it should now show a list of known issues, your welcome to download the code and look at it, to help resolve these issues. The remove action is only cosmetic as it does not effect the functionality. I would like to fix the problem with the mortar being unusable while the vehicle is moving, but I would like to keep both parts destructible.

Share this post


Link to post
Share on other sites

This is very useful. Great thinking. I'm sure it's already been asked, but is there a way to just put some of the weapons on to begin with?

Share this post


Link to post
Share on other sites

Erm yeah i guess so just use the attach to command in the init. Here is the stuff I use think it should work as normal but i haven't tested it for this specific senareo.

AT/AA

this attachto [_veh,[0,-1.5,0.25]];this setDir 180;

MG/HMG

this attachto [_veh,[0.25,-2,1]];

Mortar

this attachto [_veh,[0,-2,0]];

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  

×