theduke Posted March 12, 2016 Report Share Posted March 12, 2016 I've been messing around the past few weeks with trying to mount m2s to certain trucks. I found this script that allows you to mount a bike in a truck, as if you were carrying the bike lol. seems its only for the editor. http://www.arma2base.de/include.php?path=download&contentid=179 i've been trying to get it to work, but to no avail. Wondering if anyone with experience would be willing to help me with this. Here are the 3 files associated with it. mount_vcl_init.sqf Spoiler // mount_vcl_init.sqf // © JUNE 2009 - norrin ([email protected]) /* Name playable units and vehicle in the editor Put this in the init line of the vehicle in the editor: nul = [this] execVM "mountOnVcl\mount_vcl_init.sqf"; */ _vcl = _this select 0; _typeOfVcl = _this select 1; _c = 0; _load = _vcl addAction ["Load bike on truck", "mountOnVcl\mount_vcl.sqf", _typeOfVcl, 0, false, true]; _unload = _vcl addAction ["Unload vehicle", "mountOnVcl\dismount_vcl.sqf","", 0, false, true]; _toAttach = objNull; _vcl removeAction _load; _vcl removeAction _unload; if (isServer) then { _vcl setVariable ["NORRN_mountOn_vcl_pos0", [false, _toAttach], true]; sleep 2; }; while {alive _vcl} do { if (!((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0) && _c == 0 && count (nearestObjects [_vcl, ["man"], 10]) > 0 && count (nearestObjects [_vcl, [_typeOfVcl], 10]) > 0) then { _load = _vcl addAction ["Load vehicle on truck", "mountOnVcl\mount_vcl.sqf", _typeOfVcl, 0, false, true]; _vcl removeAction _unload; _c = 1; }; if (((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0) && _c == 1) then { _unload = _vcl addAction ["Unload vehicle", "mountOnVcl\dismount_vcl.sqf","", 0, false, true]; _vcl removeAction _load; _c = 0; }; if (count (nearestObjects [_vcl, ["man"], 10]) == 0 || count (nearestObjects [_vcl, [_typeOfVcl], 10]) == 0) then { _vcl removeAction _load; _vcl removeAction _unload; if (!((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0)) then {_c = 0}; if ((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0) then {_c = 1}; }; //hint format ["%1", (_vcl getVariable "NORRN_mountOn_vcl_pos0")]; sleep 2; }; if (!alive _vcl) exitWith {}; mount_vcl.sqf Spoiler // mount_vcl.sqf // © JUNE 2009 - norrin ([email protected]) _vcl = _this select 0; _caller = _this select 1; _typeOfVcl = _this select 3; _dir = getdir _vcl; _mountVcl = objNull; _blogs = 0; _c = 0; if (count nearestObjects [player, [_typeOfVcl], 20] > 0) then { _mountVcl = nearestObjects [player, [_typeOfVcl], 20] select 0; }; if (vehicle _caller != _caller) then {_caller action ["GetOut", vehicle _caller]; sleep 1}; if (!((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0)) then { _mountVcl attachTo [_vcl,[0.3,-1.5,0.3]]; sleep 0.1; _vcl setVariable ["NORRN_mountOn_vcl_pos0", [true, _mountVcl], true]; }; if (true) exitWith {}; dismount_vcl.sqf Spoiler // dismount_vcl.sqf // © JUNE 2009 - norrin ([email protected]) _vcl = _this select 0; _caller = _this select 1; _mountVcl = (_vcl getVariable "NORRN_mountOn_vcl_pos0") select 1; _vclDir = getDir _vcl; if (vehicle player == player) then { detach _mountVcl; _mountVcl setPos [(getPos _vcl select 0) - (5 * sin _vclDir), (getPos _vcl select 1) - (5 * cos _vclDir), 0]; _vcl setVariable ["NORRN_mountOn_vcl_pos0", [false, objNull], true]; }; if (true) exitWith {}; Thanks Link to comment Share on other sites More sharing options...
0 ViseVersa Posted March 15, 2016 Report Share Posted March 15, 2016 Did you get any kind of errors in your logs? Check both server && client log (client log is located at %appdata%\local\arma2oa\arma2oa.rpt) Link to comment Share on other sites More sharing options...
Question
theduke
I've been messing around the past few weeks with trying to mount m2s to certain trucks. I found this script that allows you to mount a bike in a truck, as if you were carrying the bike lol. seems its only for the editor.
http://www.arma2base.de/include.php?path=download&contentid=179
i've been trying to get it to work, but to no avail. Wondering if anyone with experience would be willing to help me with this.
Here are the 3 files associated with it.
mount_vcl_init.sqf
// mount_vcl_init.sqf
// © JUNE 2009 - norrin ([email protected])
/*
Name playable units and vehicle in the editor
Put this in the init line of the vehicle in the editor: nul = [this] execVM "mountOnVcl\mount_vcl_init.sqf";
*/
_vcl = _this select 0;
_typeOfVcl = _this select 1;
_c = 0;
_load = _vcl addAction ["Load bike on truck", "mountOnVcl\mount_vcl.sqf", _typeOfVcl, 0, false, true];
_unload = _vcl addAction ["Unload vehicle", "mountOnVcl\dismount_vcl.sqf","", 0, false, true];
_toAttach = objNull;
_vcl removeAction _load;
_vcl removeAction _unload;
if (isServer) then
{
_vcl setVariable ["NORRN_mountOn_vcl_pos0", [false, _toAttach], true];
sleep 2;
};
while {alive _vcl} do
{
if (!((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0) && _c == 0 && count (nearestObjects [_vcl, ["man"], 10]) > 0 && count (nearestObjects [_vcl, [_typeOfVcl], 10]) > 0) then
{
_load = _vcl addAction ["Load vehicle on truck", "mountOnVcl\mount_vcl.sqf", _typeOfVcl, 0, false, true];
_vcl removeAction _unload;
_c = 1;
};
if (((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0) && _c == 1) then
{
_unload = _vcl addAction ["Unload vehicle", "mountOnVcl\dismount_vcl.sqf","", 0, false, true];
_vcl removeAction _load;
_c = 0;
};
if (count (nearestObjects [_vcl, ["man"], 10]) == 0 || count (nearestObjects [_vcl, [_typeOfVcl], 10]) == 0) then
{
_vcl removeAction _load;
_vcl removeAction _unload;
if (!((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0)) then {_c = 0};
if ((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0) then {_c = 1};
};
//hint format ["%1", (_vcl getVariable "NORRN_mountOn_vcl_pos0")];
sleep 2;
};
if (!alive _vcl) exitWith {};
mount_vcl.sqf
// mount_vcl.sqf
// © JUNE 2009 - norrin ([email protected])
_vcl = _this select 0;
_caller = _this select 1;
_typeOfVcl = _this select 3;
_dir = getdir _vcl;
_mountVcl = objNull;
_blogs = 0;
_c = 0;
if (count nearestObjects [player, [_typeOfVcl], 20] > 0) then
{
_mountVcl = nearestObjects [player, [_typeOfVcl], 20] select 0;
};
if (vehicle _caller != _caller) then {_caller action ["GetOut", vehicle _caller]; sleep 1};
if (!((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0)) then
{
_mountVcl attachTo [_vcl,[0.3,-1.5,0.3]];
sleep 0.1;
_vcl setVariable ["NORRN_mountOn_vcl_pos0", [true, _mountVcl], true];
};
if (true) exitWith {};
dismount_vcl.sqf
// dismount_vcl.sqf
// © JUNE 2009 - norrin ([email protected])
_vcl = _this select 0;
_caller = _this select 1;
_mountVcl = (_vcl getVariable "NORRN_mountOn_vcl_pos0") select 1;
_vclDir = getDir _vcl;
if (vehicle player == player) then
{
detach _mountVcl;
_mountVcl setPos [(getPos _vcl select 0) - (5 * sin _vclDir), (getPos _vcl select 1) - (5 * cos _vclDir), 0];
_vcl setVariable ["NORRN_mountOn_vcl_pos0", [false, objNull], true];
};
if (true) exitWith {};
Thanks
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now