Darkangel 10 Posted August 30, 2013 Hey all! So i'm trying to make a demolition derby mission, well a more advanced one. The system I have right now works but is unreliable, which is putting down each vehicle and setting a respawn script on it if it gets damage or blows up which I don't like. So this is the system I have in mind, how would I go about making it so when you walk up to a AI it gives you a list of vehicles to choose from in the action menu and you just click the one you want and it spawns a few meters away from you? So lets say the list has the Off Road pick up truck, then the MATV and the ATV. Could someone please help me out with this? Share this post Link to post Share on other sites
Zenophon 110 Posted August 30, 2013 To implement the action menu as you describe, all you need is a simple function to spawn vehicles and addAction statements to past arguments into that function. I would start by placing down some object on the map that the player interacts with to spawn the vehicles, I will call this object 'MenuObject'. Naming the object is important so that the code executed by the action can reference it. Then, in the init line of any object in the editor, or in your init.sqf, use code like this: MenuObject addAction ["Spawn ATV", {createVehicle [(_this select 3), (getPosATL MenuObject), [], 5, "NONE"];}, "B_Quadbike_01_F"]; You can just list an many addActions as you want options to spawn vehicles, just change the classname and action text ('B_Quadbike_01_F' and 'Spawn ATV' above) to match whatever vehicle you want to spawn. If the function in the addAction was longer and more complicated, you would want to place it into an external file or compile into a variable to use in the addAction, but repeated the code in this one line will work fine here. If you want to make the menu look cleaner by adding an action that takes you to a submenu where you pick the vehicle, or even the vehicle type and then another submenu, then you will need more advanced scripting to manage the actions that appear. I could do something like that for you if you really think it will improve your mission. 1 Share this post Link to post Share on other sites
Gods Companion 0 Posted February 4, 2016 To implement the action menu as you describe, all you need is a simple function to spawn vehicles and addAction statements to past arguments into that function. I would start by placing down some object on the map that the player interacts with to spawn the vehicles, I will call this object 'MenuObject'. Naming the object is important so that the code executed by the action can reference it. Then, in the init line of any object in the editor, or in your init.sqf, use code like this: MenuObject addAction ["Spawn ATV", {createVehicle [(_this select 3), (getPosATL MenuObject), [], 5, "NONE"];}, "B_Quadbike_01_F"]; You can just list an many addActions as you want options to spawn vehicles, just change the classname and action text ('B_Quadbike_01_F' and 'Spawn ATV' above) to match whatever vehicle you want to spawn. If the function in the addAction was longer and more complicated, you would want to place it into an external file or compile into a variable to use in the addAction, but repeated the code in this one line will work fine here. If you want to make the menu look cleaner by adding an action that takes you to a submenu where you pick the vehicle, or even the vehicle type and then another submenu, then you will need more advanced scripting to manage the actions that appear. I could do something like that for you if you really think it will improve your mission. Hi! I have been trying to use this command, and i would like to spawn in several vehicles by using the one command. As an example, Spawn 200m (Then it spawns 3 vehicles at 200m) i have learned how to get the positions but how do i make it spawn in at all three locations at the same time? Thank you Share this post Link to post Share on other sites
ArmaMan360 94 Posted February 5, 2016 MenuObject addAction ["Spawn ATV", {createVehicle [(_this select 3), (getPosATL MenuObject), [], 5, "NONE"];}, "B_Quadbike_01_F"]; I understand this line except for one thing, what does the _this select 3 denote? It is supposed to be the type of the vehicle to be spawned as per wiki but why is the "B_Quadbike_01_F" not included at the place where _this select 3 is? And counting variables in the code, how would you reach the "B_Quadbike_01_F" with 0,1,2,3? I mean I would use this line instead: MenuObject addAction ["Spawn ATV", {createVehicle ["B_Quadbike_01_F", (getPosATL MenuObject), [], 5, "NONE"];}]; Thanks Share this post Link to post Share on other sites