ARMA3456 0 Posted October 30, 2017 I have a stand In the stand init: stand addAction["Spawn", "script.sqf"]; In the script.sqf: The script below provided by pierremgi allows me to be able to despawn the vehicle within 15 metres _expl1 = "O_Truck_02_transport_F" createVehicle position player; _expl1 addAction ["De-spawn vehicle",{ deleteVehicle (_this select 0) },nil,10,false,true,"", "_target distance stand < 15"]; How can I make it so that the second option on the truck's action menu allows it to attach to the player? I can't seem to get that working. I've looked at this, but can't seem to get the two working without errors: https://community.bistudio.com/wiki/attachTo Can someone put me on the right track? 1 Share this post Link to post Share on other sites
Beerkan 71 Posted October 30, 2017 Can you be more specific in what are you trying to do? There is no code in your example attaching anything to anything. While it looks like you're trying to increase the players inventory space you may have other ideas in mind. If you are trying to increase inventory space, the easiest way to do this is to use the VR_Suit as it has the largest capacity of any uniform. Add this to the unit's init in 3den editor. this forceadduniform "U_B_Soldier_VR";this setObjectTextureGlobal [0, "\a3\characters_f_epb\BLUFOR\Data\clothing1_dirty_co.paa"]; As this command dresses you in the VR_Suit I have added one of the available re-textures to the unit so it looks normal in game. B.T.W. Ignore all this if I've got your reasons wrong. Share this post Link to post Share on other sites
ARMA3456 0 Posted October 30, 2017 15 minutes ago, Beerkan said: Can you be more specific in what are you trying to do? There is no code in your example attaching anything to anything. While it looks like you're trying to increase the players inventory space you may have other ideas in mind. If you are trying to increase inventory space, the easiest way to do this is to use the VR_Suit as it has the largest capacity of any uniform. Add this to the unit's init in 3den editor. this forceadduniform "U_B_Soldier_VR";this setObjectTextureGlobal [0, "\a3\characters_f_epb\BLUFOR\Data\clothing1_dirty_co.paa"]; As this command dresses you in the VR_Suit I have added one of the available re-textures to the unit so it looks normal in game. B.T.W. Ignore all this if I've got your reasons wrong. I'm basically spawning a truck. When it spawns it has an action menu on it and the first option is to despawn it. I'm trying to achieve the 2nd option of the action menu to attach that vehicle to the player. Share this post Link to post Share on other sites
Tajin 349 Posted October 30, 2017 You've said that before, but we still don't know what you're actually trying to achieve by this. WHY do you want a truck to be attached to a player ? In ArmA there are always several solutions to a certain problem and if you tell us what you want to do, we might be able to propose a different (possibly better) solution. As far as simply using the command goes, here is all the info: https://community.bistudio.com/wiki/attachTo Share this post Link to post Share on other sites
Beerkan 71 Posted October 30, 2017 As you mentioned https://community.bistudio.com/wiki/attachTo command I assumed you were trying to combine as in glue something to another thing, hence attach. Back to your question. What I believe you are trying to do is "removeaction" from the truck and "addaction" to the player? Share this post Link to post Share on other sites
ARMA3456 0 Posted October 30, 2017 1 minute ago, Tajin said: You've said that before, but we still don't know what you're actually trying to achieve by this. WHY do you want a truck to be attached to a player ? As far as simply using the command goes, here is all the info: https://community.bistudio.com/wiki/attachTo I'm creating a strong man lifting contest where different vehicles can only be attached to specifics players and they would carry it along a fish line. Share this post Link to post Share on other sites
ARMA3456 0 Posted October 30, 2017 3 minutes ago, Beerkan said: As you mentioned https://community.bistudio.com/wiki/attachTo command I assumed you were trying to combine as in glue something to another thing, hence attach. Back to your question. What I believe you are trying to do is "removeaction" from the truck and "addaction" to the player? I'm not entirely sure. I've been able to achieve attaching the vehicle to the player. But I'm trying to add a second action where I can physically attach that vehicle to me. But I'm not sure how to achieve this. Share this post Link to post Share on other sites
Tajin 349 Posted October 30, 2017 Ah, I see. Maybe this will give you some ideas: http://killzonekid.com/arma-scripting-tutorials-attachto-and-setvectordirandup/ Or is it the addAction that you have problems with? Share this post Link to post Share on other sites
ARMA3456 0 Posted October 30, 2017 1 hour ago, Tajin said: Ah, I see. Maybe this will give you some ideas: http://killzonekid.com/arma-scripting-tutorials-attachto-and-setvectordirandup/ Or is it the addAction that you have problems with? It's just addAction. I'm able to attach the vehicle easily with this code: _expl1 = "O_Truck_02_transport_F" createVehicle (position player); _expl1 attachTo [player, [-0.1,0.1,1.15],"Pelvis"]; But this means when I click on the stand first addAction option it'll automatically make me attach to the truck The way it was previously done before: 1) I would use the stand addAction to spawn the vehicle 2) The vehicle's first addAction allows me to make it de-spawn 3) i would like the 2nd option to be that it'll attach to me This is the script I'm using so far, it's on my first post too: _expl1 = "O_Truck_02_transport_F" createVehicle position player; _expl1 addAction ["De-spawn vehicle",{ deleteVehicle (_this select 0) },nil,10,false,true,"", "_target distance stand < 15"]; Share this post Link to post Share on other sites
Tajin 349 Posted October 30, 2017 Well then simply add another action and put that attach-code inside. something like this: _expl1 = "O_Truck_02_transport_F" createVehicle position player; _expl1 addAction ["De-spawn vehicle", { deleteVehicle (_this select 0); }, nil, 10, false, true, "", "_target distance stand < 15"]; _expl1 addAction ["Hoist", { (_this select 0) attachTo [player, [-0.1,0.1,1.15],"Pelvis"]; }, nil, 10, false, true, "", "isNull attachedTo _target"]; _expl1 addAction ["Drop", { detach (_this select 0); }, nil, 10, false, true, "", "attachedTo _target == player"]; 1 Share this post Link to post Share on other sites
ARMA3456 0 Posted October 30, 2017 1 minute ago, Tajin said: Well then simply add another action and put that attach-code inside. something like this: _expl1 = "O_Truck_02_transport_F" createVehicle position player; _expl1 addAction ["De-spawn vehicle", { deleteVehicle (_this select 0); }, nil, 10, false, true, "", "_target distance stand < 15"]; _expl1 addAction ["Hoist", { (_this select 0) attachTo [player, [-0.1,0.1,1.15],"Pelvis"]; }, nil, 10, false, true, "", "isNull attachedTo _target"]; _expl1 addAction ["Drop", { detach (_this select 0); }, nil, 10, false, true, "", "attachedTo _target == player"]; Thank you very much. I appreciate it. Thanks for taking your time to provide the code. Share this post Link to post Share on other sites
ARMA3456 0 Posted October 31, 2017 8 hours ago, Tajin said: Well then simply add another action and put that attach-code inside. something like this: _expl1 = "O_Truck_02_transport_F" createVehicle position player; _expl1 addAction ["De-spawn vehicle", { deleteVehicle (_this select 0); }, nil, 10, false, true, "", "_target distance stand < 15"]; _expl1 addAction ["Hoist", { (_this select 0) attachTo [player, [-0.1,0.1,1.15],"Pelvis"]; }, nil, 10, false, true, "", "isNull attachedTo _target"]; _expl1 addAction ["Drop", { detach (_this select 0); }, nil, 10, false, true, "", "attachedTo _target == player"]; When I use this script on smaller objects for example: Land_Track_01_switch_F I can't seem to drop or de-spawn the item. There's no option that appears. I've tested it for quite a while as any objects most likely smaller than a normal car/suv can't be dropped or despawned. Share this post Link to post Share on other sites
HazJ 1289 Posted October 31, 2017 NOTE: This was quickly put together as an example mission. Might be a little sloppy, and probably needs cleaning up a little. EDIT: I forgot to unlock the vehicle after you release it, my bad. Easy to do though. Just use 0 instead of 2. Epic video finish! :D I hope this is what you are after, or at least a start. Example mission: https://1drv.ms/u/s!ArYSs9w5RSIDhDbSy_rV1N4wrvC3 init.sqf: TAG_fnc_pickupVehicle = compile preprocessFileLineNumbers "fn_pickupVehicle.sqf"; Usually I use CfgFunctions but this was just a quick example mission. fn_pickupVehicle.sqf: // Put this in the player init: // this setVariable ["isCarryingVehicle", false, true]; // Put this in the vehicle init: // (as many vehicles as you wish) // this addAction ["<t color='#ffffff'>" + (format ["Pickup %1", (getText (configFile >> "CfgVehicles" >> (typeOf this) >> "displayName"))]) + "</t>", {_this spawn TAG_fnc_pickupVehicle}, "", 12, false, false, "", "(_this distance getPosATL _target < 5) && (!(_this getVariable ""isCarryingVehicle""))"]; params [ "_object", "_unit", "_action" ]; // remove action on use _removeActionOnUse = false; // true OR false if ((_removeActionOnUse)) then { _object removeAction _action; }; if ((!isNull attachedTo _object)) exitWith { hintSilent format ["This vehicle (%1) is already being carried by someone.", (getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "displayName"))]; }; _unit setVariable ["isCarryingVehicle", true, true]; _object lock 2; _object attachTo [_unit, [-0.1, 0.1, 1.15], "pelvis"]; _unit addAction ["<t color='#ffffff'>" + (format ["Release %1", (getText (configFile >> "CfgVehicles" >> (typeOf (attachedObjects player select 0)) >> "displayName"))]) + "</t>", {if ((count attachedObjects player > 0)) then {detach (attachedObjects player select 0); (_this select 1) setPos [(getPos (_this select 0) select 0), ((getPos (_this select 0) select 1) - 5), (getPos (_this select 0) select 2)]; (_this select 1) removeAction (_this select 2); (_this select 1) setVariable ["isCarryingVehicle", false, true];};}, "", 12, false, false, "", "(_this == _target)"]; // adds the action again if _removeActionOnUse is FALSE if ((!_removeActionOnUse)) then { _object addAction ["<t color='#ffffff'>" + (format ["Pickup %1", (getText (configFile >> "CfgVehicles" >> (typeOf this) >> "displayName"))]) + "</t>", TAG_fnc_pickupVehicle, "", 12, false, false, ", "(_this distance getPosATL _target < 5) && (!(_this getVariable ""isCarryingVehicle""))"]; }; 1 Share this post Link to post Share on other sites