vaguswarrior 0 Posted June 19, 2016 So I'm pretty new to this scripting and there is a ton I do not know, and some of the information in the wiki is kind of vague or intermediate level for me to understand how things work. I'm trying to get an AI APC that my player group escorts through a series of editor placed waypoints. I'd like the Team Leader of the player group to be able to stop the APC from moving or Start the APC moving again, but have it move only along the editor place waypoints. I have two units placed on the map with the following variables: vipvic: an AI Blufor APC that has a series of waypoints TeamLead: a playable infantry unit I have three sqf files: Init.sqf: [] execVM "viccontrol.sqf"; viccontrol.sqf: _stopaction = TeamLead addAction ["<t color='#FF0000'>VIP APC Hold Position</t>", {["apcmove.sqf", _this select 3]}, APCSTATUS = "HOLD"]; _startaction = TeamLead addAction ["<t color='#00ff00'>VIP APC Proceed</t>", {["apcmove.sqf", _this select 3]}, APCSTATUS = "MOVE"]; TeamLead addAction "_stopaction"; apcmove.sqf: if (APCSTATUS == "HOLD") then { vipvic stop true; TeamLead removeAction "_stopaction"; TeamLead addAction "_startaction"; } else { if (APCSTATUS == "MOVE") then { vipvic stop false; TeamLead removeAction "_startaction"; TeamLead addAction "_stopaction"; } }; I know there are a huge errors in this script, and I might be approaching this completely wrong...my thought was that I have a script that adds two addActions to the unit TeamLead, these addActions then call the script that tells the apc to stop or start. I have a feeling it's broken with the whole trying to pass an argument (HOLD or MOVE) to the apcmove script but I don't know..essentially I wrote this with no experience and I have a feeling it's completely wrong. I'd like this to be something that can run on a dedicated server so I'm concerned both about locality and the fact that it doesn't work at all. Any assistance is appreciated! Share this post Link to post Share on other sites
serena 151 Posted June 20, 2016 APCSTATUS = 0; player addAction ["Hold", {APCSTATUS = 1; vipvic stop true}, nil, 1.5, true, true, "", "APCSTATUS == 0"]; player addAction ["Proceed", {APCSTATUS = 0; vipvic stop false}, nil, 1.5, true, true, "", "APCSTATUS == 1"]; Demo mission: Vip.Altis Improved version, without APCSTATUS variable: player addAction ["Hold", {vipvic stop true}, nil, 1.5, true, true, "", "not stopped vipvic"]; player addAction ["Proceed", {vipvic stop false}, nil, 1.5, true, true, "", "stopped vipvic"]; Demo mission: Vip.Altis_v1.1 Share this post Link to post Share on other sites
kylania 568 Posted June 20, 2016 To run on a dedicated server you'd want to do something like: {[vipvic, true] remoteExec ["stop", vipvic]} I'd made a demo mission too, which is far more complex since I didn't note stop was a toggle... :unsure: init.sqf: teamLead setVariable ["APCSTATUS", true, true]; vipHoldAction = teamLead addAction ["<t color='#FF0000'>VIP APC Hold Position</t>", "apcmove.sqf", [vipvicD, "HOLD"], 9, true, true, "", "_this getVariable 'APCSTATUS'"]; vipMoveAction = teamLead addAction ["<t color='#00ff00'>VIP APC Proceed</t>", "apcmove.sqf", [vipvicD, "MOVE"], 9, true, true, "", "!(_this getVariable 'APCSTATUS')"]; apcmove.sqf: params ["_object", "_caller", "_action", "_args"]; _args params["_vehicle", "_mode"]; _command = switch (_mode) do { case "HOLD": { _vehicle remoteExec ["doStop", _vehicle]; false }; case "MOVE": { [_vehicle, (getPos _vehicle)] remoteExec ["doMove", _vehicle]; true }; }; _caller setVariable ["APCSTATUS", _command, true]; Stops on a dime, takes it's sweet time driving off again. Share this post Link to post Share on other sites