marker 1 Posted March 1, 2013 Well that topic header is a mouthful... :) What I am doing is using an Armoured SUV, with it's initial state of gun turret closed! I created an an addaction that allows any player within the SUV to climb to the turret after it has opened. I then give them the option to move to any seat except the drivers seat... This is where my first problem occurs. I cannot remove all of the addactions, it is still left with two of the choices after I regain the move to gunner action.. I want to obviously remove the two other choices so I do not get a build up of redundant ones. Second problem is, and it probably is something I have done stupid.. In the mission I posted, I made the SUV playable by gunner and driver. Now when I get in as gunner I am automatically moved to the passenger seat as I wanted and the addactions work fine apart from the above! When I join the mission as a unit outside the SUV the addactions don't work, obviously that wouldn't be wanted! Test mission in link below. Thanks http://www21.zippyshare.com/v/10007303/file.html Share this post Link to post Share on other sites
panther42 2 Posted March 2, 2013 Took a quick look marker. You are trying to remove actions in CloseL, CloseP, and CloseR which do not exist within the scope of each script. These are set in gun.sqf as local variables. Only the id of the individual addAction is passed to each script. Share this post Link to post Share on other sites
marker 1 Posted March 2, 2013 How would I over come that mate? Appreciate you looking it over. Share this post Link to post Share on other sites
panther42 2 Posted March 2, 2013 I would use the "condition" parameter of addAction. Add them once to the vehicle, and depending on what position the player is in, they will only show what you want. I'm trying to figure out the path of your actions.... Share this post Link to post Share on other sites
marker 1 Posted March 2, 2013 I'll double check wiki again... By path of actions do you mean the route that each one is used? Such as. 1 hatch is closed. 2 move to gunner 3 make choice of seat position 4 repeat from 2 Each close sqf points back to gun.sqf. Sorry if that not what you mean.. Thanks Share this post Link to post Share on other sites
panther42 2 Posted March 2, 2013 That's what I was getting at. Every time you run gun.sqf, you are adding three addActions...then only one is removed, leaving two. Building upon each other Share this post Link to post Share on other sites
marker 1 Posted March 2, 2013 I'll try again tomorrow mate.. Will use your suggestion of initial seating position to give them the addaction of the gun, then one addaction to move back to original position... Share this post Link to post Share on other sites
marker 1 Posted March 2, 2013 With reference to the parameters available with addaction, would hideonuse true be useful? Or again would that only effect the used addaction, or the whole menu? Share this post Link to post Share on other sites
nimrod_z 6 Posted March 2, 2013 not sure i understand why you would want to remove the other actions once 1 is selected but i have a working model that gets rid of the action for the position you are in and returns the position you came from. your SUV_Initial (gunner pmcsuv1) action ["moveToCargo", pmcsuv1,0]; pmcsuv1 animate ["HideGun_01", 1]; sleep 1; pmcsuv1 animate ["CloseCover1", 1]; pmcsuv1 animate ["CloseCover2", 1]; _open = pmcsuv1 addaction [("<t color="#FF3300"">" + ("Move To Gunner") +"</t>"), "gun.sqf",true,0,false,true,"","Local player && vehicle player != player && !(player getVariable 'gunner')]; _cargoR = pmcsuv1 addaction [("<t color="#FF3300"">" + ("Move To Back Right") +"</t>"), "closeR.sqf",true,0,false,true,"","Local player && vehicle player != player && !(player getVariable 'bright')]; _cargoL = pmcsuv1 addaction [("<t color="#FF3300"">" + ("Move To Back Left") +"</t>"), "closeL.sqf",true,0,false,true,"","Local player && vehicle player != player && !(player getVariable 'bleft')]; _cargoP = pmcsuv1 addaction [("<t color="#FF3300"">" + ("Move To Passenger") +"</t>"), "closeP.sqf",true,0,false,true,"","Local player && vehicle player != player && !(player getVariable 'pfront')]; your init.sqf player setVariable ["pfront", false,true]; player setVariable ["gunner", false,true]; player setVariable ["bleft", false,true]; player setVariable ["bright", false,true]; gun.sqf ////////////////////////////////////////////////////////////////// // Function file for Armed Assault // Created by: MarKeR ////////////////////////////////////////////////////////////////// _turret = _this select 2; pmcsuv1 animate ["HideGun_01", 0]; pmcsuv1 animate ["CloseCover1", 0]; pmcsuv1 animate ["CloseCover2", 0]; player action ["moveToTurret", pmcsuv1,[0]]; player setVariable ["pfront", false,true]; player setVariable ["gunner", true,true]; player setVariable ["bleft", false,true]; player setVariable ["bright", false,true]; //pmcsuv1 removeaction _turret; //_cargoR = pmcsuv1 addaction [("<t color="#FF3300"">" + ("Move To Back Right") +"</t>"), "closeR.sqf]; //_cargoL = pmcsuv1 addaction [("<t color="#FF3300"">" + ("Move To Back Left") +"</t>"), "closeL.sqf]; //_cargoP = pmcsuv1 addaction [("<t color="#FF3300"">" + ("Move To Passenger") +"</t>"), "closeP.sqf]; closeR.sqf ////////////////////////////////////////////////////////////////// // Function file for Armed Assault // Created by: MarKeR ////////////////////////////////////////////////////////////////// _closeR = _this select 2; (gunner pmcsuv1) action ["moveToCargo", pmcsuv1,1]; pmcsuv1 animate ["HideGun_01", 1]; sleep 1; pmcsuv1 animate ["CloseCover1", 1]; pmcsuv1 animate ["CloseCover2", 1]; player setVariable ["pfront", false,true]; player setVariable ["gunner", false,true]; player setVariable ["bleft", false,true]; player setVariable ["bright", true,true]; // pmcsuv1 removeAction _closeP; // pmcsuv1 removeaction _closeL; // pmcsuv1 removeaction _closeR; //_open = pmcsuv1 addaction [("<t color="#FF3300"">" + ("Move To Gunner") +"</t>"), "gun.sqf]; closeP.sqf ////////////////////////////////////////////////////////////////// // Function file for Armed Assault // Created by: MarKeR ////////////////////////////////////////////////////////////////// _closeP = _this select 2; (gunner pmcsuv1) action ["moveToCargo", pmcsuv1,0]; pmcsuv1 animate ["HideGun_01", 1]; sleep 1; pmcsuv1 animate ["CloseCover1", 1]; pmcsuv1 animate ["CloseCover2", 1]; player setVariable ["pfront", true,true]; player setVariable ["gunner", false,true]; player setVariable ["bleft", false,true]; player setVariable ["bright", false,true]; // pmcsuv1 removeAction _closeP; // pmcsuv1 removeaction _closeL; // pmcsuv1 removeaction _closeR; //_open = pmcsuv1 addaction [("<t color="#FF3300"">" + ("Move To Gunner") +"</t>"), "gun.sqf]; closeL.sqf ////////////////////////////////////////////////////////////////// // Function file for Armed Assault // Created by: MarKeR ////////////////////////////////////////////////////////////////// _closeL = _this select 2; (gunner pmcsuv1) action ["moveToCargo", pmcsuv1,2]; pmcsuv1 animate ["HideGun_01", 1]; sleep 1; pmcsuv1 animate ["CloseCover1", 1]; pmcsuv1 animate ["CloseCover2", 1]; player setVariable ["pfront", false,true]; player setVariable ["gunner", false,true]; player setVariable ["bleft", true,true]; player setVariable ["bright", false,true]; // pmcsuv1 removeAction _closeP; // pmcsuv1 removeaction _closeL; // pmcsuv1 removeaction _closeR; //_open = pmcsuv1 addaction [("<t color="#FF3300"">" + ("Move To Gunner") +"</t>"), "gun.sqf]; maybe it will help with the direction you want to go with it..:) Share this post Link to post Share on other sites
cuel 23 Posted March 2, 2013 (edited) Funny, I found some old script for the armored SUV yesterday, I edited it a little to fit what I needed. Maybe not what you're looking for, but hopefully it can help. // By SSG Cuel 2013 // called with, from init of suv // [this] call compile preProcessFileLineNumbers "lg.sqf"; if (isDedicated) exitWith {}; if (count _this == 1) then { (_this select 0) spawn { _veh = _this; _veh addAction ["Close Cover","lg.sqf","close",1,false,true,"","(player == (gunner _target) && ((_target animationPhase 'HideGun_01') == 0))"]; _veh addAction ["Open Cover","lg.sqf","open",1,false,true,"","(vehicle player == _target && player != driver _target && ((_target animationPhase 'CloseCover1') == 1))"]; while {alive _veh} do { if (player == gunner _veh && ((_veh animationPhase "HideGun_01")== 1)) then { moveOut player; if (_veh emptyPositions "cargo" > 0) then { waitUntil {vehicle player == player}; player moveInCargo _veh; }; }; sleep 0.2; }; }; }else{ _target = _this select 0; _caller = _this select 1; _id = _this select 2; _type = toLower (_this select 3); switch _type do { case "open" : { _target animate["CloseCover2",0]; _target animate["CloseCover1",0]; sleep 2; _target animate["HideGun_04",0]; sleep 0.5; _target animate["HideGun_03",0]; sleep 0.5; _target animate["HideGun_02",0]; sleep 0.5; _target animate["HideGun_01",0]; }; case "close": { //["FP_switchMove",[player,"ArmoredSUV_GunnerTurnIn_PMC"]] call CBA_fnc_globalEvent; _target animate["HideGun_01",1]; sleep 0.5; _target animate["HideGun_02",1]; sleep 0.5; _target animate["HideGun_03",1]; sleep 0.5; _target animate["HideGun_04",1]; sleep 1; _target animate["CloseCover1",1]; _target animate["CloseCover2",1]; }; }; }; Edited March 2, 2013 by cuel Share this post Link to post Share on other sites
marker 1 Posted March 2, 2013 Absolutely brilliant guys.. Much appreciated... Nimrod That is exactly what I was trying to do... Cuel, works brilliantly mate, just wanted the extra option of being able to choose seat positions! Looking over the code, the use of variables seems to work so much better than convoluted addaction scripts that I was trying to do! Funny how seeing something working in action lets you see a deeper use of some code! Share this post Link to post Share on other sites
marker 1 Posted March 2, 2013 (edited) Thanks guys.. Got it working exactly how I want it.... Don't know what happened to the colour on thevideo, or the quality... Add this to your init.sqf player setVariable ["pfront", false,true]; player setVariable ["gunner", false,true]; player setVariable ["bleft", false,true]; player setVariable ["bright", false,true]; Place this in your vehicles init field. My vehicle was named _car nul = [this] execVM "SUV_Initial.sqf"; nul = [this] execVM "Lock.sqf"; Lock.sqf, which stops players from popping head through the gun turret when it is closed, places then to back left seat. Thanks to Kylania private ["_unit","_veh"]; _veh = _this select 0; while {true} do { waitUntil {(_veh animationPhase "HideGun_01")==1}; _unit = _veh turretUnit [0]; if (!(isNull _unit)) then { _unit action ["moveToCargo", _veh,2]; hint "Open Hatch"; }; sleep 1; }; SUV_Initial.sqf ////////////////////////////////////////////////////////////////// // Function file for Arma II // Created by: MarKeR, Variables By Nimrod_Z ////////////////////////////////////////////////////////////////// _car = _this select 0; (gunner _car) action ["moveToCargo", _car,0]; _car animate ["HideGun_01", 1]; sleep 1; _car animate ["CloseCover1", 1]; _car animate ["CloseCover2", 1]; _open = _car addaction [("<t color=""#FF3300"">" + ("Move To Gunner") +"</t>"), "gun.sqf",false,9,false,true,"","Local player && vehicle player != player && !(player getVariable 'gunner')"]; _cargoR = _car addaction [("<t color=""#FF3300"">" + ("Move To Back Right") +"</t>"), "closeR.sqf",false,8,false,true,"","Local player && vehicle player != player && !(player getVariable 'bright')"]; _cargoL = _car addaction [("<t color=""#FF3300"">" + ("Move To Back Left") +"</t>"), "closeL.sqf",false,7,false,true,"","Local player && vehicle player != player && !(player getVariable 'bleft')"]; _cargoP = _car addaction [("<t color=""#FF3300"">" + ("Move To Passenger") +"</t>"), "closeP.sqf",false,6,false,true,"","Local player && vehicle player != player && !(player getVariable 'pfront')"]; Gun.sqf ////////////////////////////////////////////////////////////////// // Function file for Arma II // Created by: MarKeR, Variables By Nimrod_Z ////////////////////////////////////////////////////////////////// _car = _this select 0; _caller = _this select 1; _turret = _this select 2; _car animate ["HideGun_01", 0]; _car animate ["CloseCover1", 0]; _car animate ["CloseCover2", 0]; player action ["moveToTurret", _car,[0]]; player setVariable ["pfront", false,true]; player setVariable ["gunner", true,true]; player setVariable ["bleft", false,true]; player setVariable ["bright", false,true]; CloseP.sqf ////////////////////////////////////////////////////////////////// // Function file for Arma II // Created by: MarKeR, Variables By Nimrod_Z ////////////////////////////////////////////////////////////////// _car = _this select 0; _caller = _this select 1; _closeP = _this select 2; (gunner _car) action ["moveToCargo", _car,0]; _car animate ["HideGun_01", 1]; sleep 1; _car animate ["CloseCover1", 1]; _car animate ["CloseCover2", 1]; player setVariable ["pfront", true,true]; player setVariable ["gunner", false,true]; player setVariable ["bleft", true,true]; player setVariable ["bright", true,true]; CloseL.sqf ////////////////////////////////////////////////////////////////// // Function file for Arma II // Created by: MarKeR, Variables By Nimrod_Z ////////////////////////////////////////////////////////////////// _car = _this select 0; _caller = _this select 1; _closeL = _this select 2; (gunner _car) action ["moveToCargo", _car,2]; _car animate ["HideGun_01", 1]; sleep 1; _car animate ["CloseCover1", 1]; _car animate ["CloseCover2", 1]; player setVariable ["pfront", true,true]; player setVariable ["gunner", false,true]; player setVariable ["bleft", true,true]; player setVariable ["bright", true,true]; CloseR.sqf ////////////////////////////////////////////////////////////////// // Function file for Arma II // Created by: MarKeR, Variables By Nimrod_Z ////////////////////////////////////////////////////////////////// _car = _this select 0; _caller = _this select 1; _closeR = _this select 2; (gunner _car) action ["moveToCargo", _car,1]; _car animate ["HideGun_01", 1]; sleep 1; _car animate ["CloseCover1", 1]; _car animate ["CloseCover2", 1]; player setVariable ["pfront", true,true]; player setVariable ["gunner", false,true]; player setVariable ["bleft", true,true]; player setVariable ["bright", true,true]; Test Mission.. http://www19.zippyshare.com/v/26070666/file.html Edited March 2, 2013 by marker Share this post Link to post Share on other sites
nimrod_z 6 Posted March 4, 2013 very nice dude.. glad i could assist a little. :D.. Share this post Link to post Share on other sites