Arma 3
addAction and createVehicle
this addAction ["Bagfence","createVehicle.................]; Does anyone have information on how the two work together? The aim would be that the engineer would be able to build or dismantle the barrier. Or does this build somewhere Init.sqf files.

https://community.bistudio.com/wiki/addAction
and
https://community.bistudio.com/wiki/createVehicle
Legutóbb szerkesztette: CasioFin; 2017. febr. 21., 0:08
< >
114/14 megjegyzés mutatása
Not tested, but something like this in the units init for example. This would only to drop one, but what about moving them or multiple objects...? I personally would make it a function or script.

this addaction ["Bag Fence" , {"Land_BagFence_Long_F" createVehicle position _target}];
is this what you want? this gives the player a addaction to spawn a barrier and be able to move it around, then another action to place the barrier. we need more details.

run this anywhere, in a seperate file and call it from the init would be best.
placeBarrier = { grabBA = player addAction ["Grab Barrier", { _barrier = "Land_HBarrier_3_F" createVehicle position player; _barrier attachTo [player,[0, 5, 0]]; player removeAction grabBA; call dropBarrier; }]; }; dropBarrier = { dropBA = player addAction ["Place Barrier", { detach _barrier; player removeAction dropBA; }]; }; call placeBarrier;
Thank you thedubl that almost had a working script, but the _target had to change the player.
[Sec8]goKitty199 Just like this I'm looking for, but brought was a bit of an unfinished script.
For more information on this what I'm trying to look for.
  • spawn and destroy (delete object).
  • choose from the list what to build.
  • turn the object 45 degrees in any direction.
  • and only Engineer class can build that.
if these would be possible.
Legutóbb szerkesztette: CasioFin; 2017. febr. 22., 6:10
CasioFin91 eredeti hozzászólása:
[Sec8]goKitty199 Just like this I'm looking for, but brought was a bit of an unfinished script.
For more information on this what I'm trying to look for.
  • spawn and destroy (delete object).
  • choose from the list what to build.
  • turn the object 45 degrees in any direction.
  • and only Engineer class can build that.
if these would be possible.
i dont know how to do that for just an engineer, but you can take my script that i was working on a few months ago and change it to use what you want, its pretty much the same thing

spawnramps.sqf rampDirection = 180; objectHeight = 0; rampSteepness = 0; rampsMain = { removeAllActions player; hint "Make sure to only make the ramp steeper when your directly behind it, such as if you were jumping it!"; player addAction ["Open Menu", openedMenu]; call deleteObjectAction; }; openedMenu = { removeAllActions player; player addAction ["Ramps", rampSelection]; //make a new addaction for set ramps such as tabletops, tripples and such and exec from another .sqf file, have the tabletop and jumps attatchTo the first ramp, not the player. player addAction ["Premade sections", "spawnPreMadeSections.sqf"]; player addAction ["Vehicles", "spawnVehicles.sqf"]; player addAction ["Close Menu", {call rampsMain}]; call deleteObjectAction; }; rampSelection = { removeallActions player; player addAction ["Tall Concrete Ramp", { removeAllActions player; ramp = "Land_RampConcreteHigh_F" createVehicle position player; ramp attachTo [player, [0, 10, objectHeight]]; ramp setDir 180; call rampActions; }]; player addAction ["Short Concrete Ramp", { removeAllActions player; ramp = "Land_RampConcrete_F" createVehicle position player; ramp attachTo [player, [0, 10, 0]]; ramp setDir 180; call rampActions; }]; player addAction ["Back", {call openedMenu}]; call deleteObjectAction; }; rampActions = { //do switch with variable player addAction ["rotate", rotateOr]; player addAction ["steeper", rotateOsteep]; player addAction ["raise", raiseObject]; player addAction ["lower", lowerObject]; player addAction ["drop", dropO]; }; dropO = { rampDirection = 180; objectHeight = 0; rampSteepness = 0; detach ramp; detach secondRamp; detach thirdRamp; detach forthRamp; call openedMenu; }; rotateOr = { rampDirection = rampDirection + 20; ramp setDir rampDirection; }; rotateOsteep = { rampSteepness = rampSteepness - 0.1; ramp setVectorUp [0,rampSteepness,1]; }; raiseObject = { objectHeight = objectHeight + 1; ramp attachTo [player, [0, 10, objectHeight]]; }; lowerObject = { objectHeight = objectHeight - 2; ramp attachTo [player, [0, 10, objectHeight]]; }; deleteObjectAction = { player addAction ["Delete", {deleteVehicle cursorTarget}]; }; call rampsMain;
I'm trying to use this information to continue as far as possible. Thank you for this information.
Sec8gokitty199 eredeti hozzászólása:
is this what you want? this gives the player a addaction to spawn a barrier and be able to move it around, then another action to place the barrier. we need more details.

run this anywhere, in a seperate file and call it from the init would be best.
placeBarrier = { grabBA = player addAction ["Grab Barrier", { _barrier = "Land_HBarrier_3_F" createVehicle position player; _barrier attachTo [player,[0, 5, 0]]; player removeAction grabBA; call dropBarrier; }]; }; dropBarrier = { dropBA = player addAction ["Place Barrier", { detach _barrier; player removeAction dropBA; }]; }; call placeBarrier;
Yo first off this is awesome thanks I managed to get the Radio Antenna spawned. When I click place barrier though it gives me an error about detach _barrier; Any ideas?
"player removeAction dropBA;...' Error undefined variable in expression: _barrier ??
Legutóbb szerkesztette: Mountain; 2017. szept. 9., 13:07
Chaka eredeti hozzászólása:
"player removeAction dropBA;...' Error undefined variable in expression: _barrier ??
this was a long time ago. anyways thats because _barrier is defined in the placeBarrier function and it is local to that function. for now just make it global so change it from _barrier to barrier
Omg thank you man works like a charm! One other question how would I set it so only when the player is near an object or in a trigger this action pops up?
Legutóbb szerkesztette: Mountain; 2017. szept. 9., 14:48
Chaka eredeti hozzászólása:
Omg thank you man works like a charm! One other question how would I set it so only when the player is near an object or in a trigger this action pops up?
on the object that you want the addaction on, double click on it and give it a variable name(ill use objectAction as an example). change player addAction/removeAction, change the word player to objectAction and it will have the action on the object with the variable name objectAction.
IM SORRY BUFFALO eredeti hozzászólása:
i dont know how to do that for just an engineer

something like that i think:

if ((typeOf player == "engineer_uniform_class1") or (typeOf player == "engineer_uniform_class2") or etc...) then { ur script; };
Warcat06 eredeti hozzászólása:
IM SORRY BUFFALO eredeti hozzászólása:
i dont know how to do that for just an engineer

something like that i think:

if ((typeOf player == "engineer_uniform_class1") or (typeOf player == "engineer_uniform_class2") or etc...) then { ur script; };
strong bump lol this was awhile ago.
better way
if ((player getUnitTrait "engineer")) then { //derherpaderp };
IM SORRY BUFFALO eredeti hozzászólása:
is this what you want? this gives the player a addaction to spawn a barrier and be able to move it around, then another action to place the barrier. we need more details.

run this anywhere, in a seperate file and call it from the init would be best.
placeBarrier = { grabBA = player addAction ["Grab Barrier", { _barrier = "Land_HBarrier_3_F" createVehicle position player; _barrier attachTo [player,[0, 5, 0]]; player removeAction grabBA; call dropBarrier; }]; }; dropBarrier = { dropBA = player addAction ["Place Barrier", { detach _barrier; player removeAction dropBA; }]; }; call placeBarrier;

How do i delete barrier after i walk away from it? I tried adding this to the last line, waitUntil { sleep 10; (player distance barrier > 50);}; deleteVehicle barrier; but it didn't work.
< >
114/14 megjegyzés mutatása
Laponként: 1530 50

Közzétéve: 2017. febr. 21., 0:03
Hozzászólások: 14