Flax 397 Posted April 5, 2012 I have this script that is making an APC move to a position on map click, but i want it to stop moving on a key press down say "Ctrl + Shift + S" and then continue to the waypoint once the same or a different key combination is pressed. I've tried playing around with event handlers but they wont work o here is the untouched code without my attempt at the stops. ifv = _this select 0; hint "Click on map to create Waypoint." onMapSingleClick "ifv move _pos; onMapSingleClick ''; true;" ifv removeAction wp; ifv removeAction bh; ifv removeAction rtb; ifv removeAction cm; menu = ifv addAction ["Open Menu", "menu.sqs"]; Thanks for the help in advance! Share this post Link to post Share on other sites
PELHAM 10 Posted April 5, 2012 Why would you want a key press for this? You can use the following in a radio trigger or add actions on the vehicle - stops and starts the vehicle even when under fire it will not move. Radio alpha text: stop (driver nameOfVehicle) disableAI "MOVE"; Ragio bravo text: go (driver nameOfVehicle) enableAI "MOVE"; Share this post Link to post Share on other sites
Flax 397 Posted April 5, 2012 Hmm sounds like a good idea i will try now. In answer to why the key down, I wanted the player to have quick access to stopping the vehicle without having to navigate through menus but if this works quick enough I'll use that. :) Share this post Link to post Share on other sites
Flax 397 Posted April 5, 2012 As an extension to this does anyone know how i can remove the stop action once the move command is completed?? Share this post Link to post Share on other sites
PELHAM 10 Posted April 6, 2012 Remove an add action? http://community.bistudio.com/wiki/addAction An easy way to keep track of and remove actions is to store the IDs of the actions in variables. This can be accomplished by doing the following: _myaction = player addAction ["Hello", "hello.sqs"] This stores the action's ID in the local variable "_myaction" and assists in keeping track of the action ID. To remove the above action, you would use the following line: player removeAction _myaction Share this post Link to post Share on other sites
Flax 397 Posted April 6, 2012 (edited) Yea i have the remove action sorted, as you can see its already used in the code i first posted, the problem I'm having is only removing the action after the move has completed. Here is the pseudo code for what i mean. If ifv velocity = [0,0,0] AND ifv enableAI "MOVE" = True Then ifv removeAction stop; Thanks for the help by the way. Edited April 6, 2012 by Flax Share this post Link to post Share on other sites
blakeace 11 Posted April 6, 2012 Hmm sounds like a good idea i will try now. In answer to why the key down, I wanted the player to have quick access to stopping the vehicle without having to navigate through menus but if this works quick enough I'll use that. :) If you wanted the option of having a keyboard shortcut if you decide to use an action menu, you are able to define one as part of an action menu item. The shortcut parameter from here: shortcut: String - (optional, default:"") One of the key names defined in bin.pbo (e.g. "moveForward") The list of options is here: If you used one of the custom keys eg "USER1" you could define that custom key to be any combo of keys you desired. Hope this helps Blake Share this post Link to post Share on other sites
Flax 397 Posted April 6, 2012 Thanks Blake that works great! Just got to sort out the other problem now :). Loving the TakeOn work your doing keep it up!! Share this post Link to post Share on other sites
blakeace 11 Posted April 6, 2012 Cheers, I'm not sure if this is helpful with how you are designing things; But the addaction command also has a condition parameter that allows you to specify certain tests when determining whether the action is available or not. If these actions are required multiple times, then using the condition parameter maybe easier than removing and re creating the action? Maybe you could use something like checking the speed of the IFV. eg speed IFV != 0 in the stop action condition. You could have another action called start that only appears when the speed is 0. You could also have another check that looks at the distance between the vehicles position and the final position. Eg IFV distance Move pos > 20. If it is less than 20m then the stop action isn't available. Then when another move is ordered, the stop action will again display. Depending on what you are trying to do these options may or may not help? Blake. Share this post Link to post Share on other sites
Flax 397 Posted April 6, 2012 This is exactly the sort of thing i was looking for Blake. Again thanks for the help. Share this post Link to post Share on other sites