domcho 20 Posted August 15, 2011 Hello. I wanted to know how can I make a planed that was spawned with the http://community.bistudio.com/wiki/BIS_fnc_spawnVehicle to fly in a specific height using flyInHeight command and how can I add a waypoint to him by using map clicking. Since it's a spawned AI I can't give it a name and I don't know how to add waypoints with map clicking. Thanks!!! :bounce3: I am playing ArmA 2 not ArmA 2 OA Share this post Link to post Share on other sites
sxp2high 22 Posted August 15, 2011 (edited) Hi there, you can use the return value of the call for that. Which is an array. For example: _Array = [positionwhatever, 123, "Plane", west] call BIS_fnc_spawnvehicle; _Vehicle = (_Array select 0); _Crew = (_Array select 1); _Group = (_Array select 2); _Vehicle flyInHeight 234; _WP = _Group addWaypoint [(getPos something), 0]; _WP SetWaypointType "MOVE"; The map click thingy could look like this: Create the plane and name it: _Array = [(getMarkerPos "PlaneDestination"), 123, "A10", west] call BIS_fnc_spawnvehicle; _Vehicle = (_Array select 0); _Crew = (_Array select 1); _Group = (_Array select 2); _Vehicle setPos [(getPos _Vehicle select 0), (getPos _Vehicle select 1), 234]; _Vehicle flyInHeight 234; _Vehicle setVehicleInit "PlaneX = this;"; processInitCommands; Give player an action: player addAction ["Set waypoint", "setWP.sqf", [], 100, false, true, "", ""]; setWP.sqf: WPSet = false; hint "Click the map to set a waypoint."; onMapSingleClick "'PlaneDestination' setMarkerPos _pos; WPSet = true;"; waitUntil {WPSet}; hint "Waypoint set."; PlaneX doMove (getMarkerPos "PlaneDestination"); This requires, as you can see, a marker named "PlaneDestination". Edited August 15, 2011 by sxp2high Share this post Link to post Share on other sites
domcho 20 Posted August 15, 2011 Hi there,you can use the return value of the call for that. Which is an array. For example: _Array = [positionwhatever, 123, "Plane", west] call BIS_fnc_spawnvehicle; _Vehicle = (_Array select 0); _Crew = (_Array select 1); _Group = (_Array select 2); _Vehicle flyInHeight 234; _WP = _Group addWaypoint [(getPos something), 0]; _WP SetWaypointType "MOVE"; The map click thingy could look like this: Create the plane and name it: _Array = [(getMarkerPos "PlaneDestination"), 123, "A10", west] call BIS_fnc_spawnvehicle; _Vehicle = (_Array select 0); _Crew = (_Array select 1); _Group = (_Array select 2); _Vehicle setPos [(getPos _Vehicle select 0), (getPos _Vehicle select 1), 234]; _Vehicle flyInHeight 234; _Vehicle setVehicleInit "PlaneX = this;"; processInitCommands; Give player an action: player addAction ["Set waypoint", "setWP.sqf", [], 100, false, true, "", ""]; setWP.sqf: WPSet = false; hint "Click the map to set a waypoint."; onMapSingleClick "'PlaneDestination' setMarkerPos _pos; WPSet = true;"; waitUntil {WPSet}; hint "Waypoint set."; PlaneX doMove (getMarkerPos "PlaneDestination"); This requires, as you can see, a marker named "PlaneDestination". Thanks. The first thing without the map clicking works great. I'll try the map clicking now. ---------- Post added at 12:23 PM ---------- Previous post was at 12:09 PM ---------- Hi there,you can use the return value of the call for that. Which is an array. For example: _Array = [positionwhatever, 123, "Plane", west] call BIS_fnc_spawnvehicle; _Vehicle = (_Array select 0); _Crew = (_Array select 1); _Group = (_Array select 2); _Vehicle flyInHeight 234; _WP = _Group addWaypoint [(getPos something), 0]; _WP SetWaypointType "MOVE"; The map click thingy could look like this: Create the plane and name it: _Array = [(getMarkerPos "PlaneDestination"), 123, "A10", west] call BIS_fnc_spawnvehicle; _Vehicle = (_Array select 0); _Crew = (_Array select 1); _Group = (_Array select 2); _Vehicle setPos [(getPos _Vehicle select 0), (getPos _Vehicle select 1), 234]; _Vehicle flyInHeight 234; _Vehicle setVehicleInit "PlaneX = this;"; processInitCommands; Give player an action: player addAction ["Set waypoint", "setWP.sqf", [], 100, false, true, "", ""]; setWP.sqf: WPSet = false; hint "Click the map to set a waypoint."; onMapSingleClick "'PlaneDestination' setMarkerPos _pos; WPSet = true;"; waitUntil {WPSet}; hint "Waypoint set."; PlaneX doMove (getMarkerPos "PlaneDestination"); This requires, as you can see, a marker named "PlaneDestination". Everything is fine except that I tried this with a helicopter and set the waypoint with map clicking behind me. Unfortunately the helicopter ran away. Head to the waypoint but passed it and did not stop. :eek: Thanks though :yay: ---------- Post added at 12:46 PM ---------- Previous post was at 12:23 PM ---------- I still need a name of the plane. I put triggers which activate carpet bombing script. Without the plane having a name the script won't activate. The triggers are: Condition:NameOfPlane in thislist Activation:testbomb = [NameOfPlane] execVM "carpetbombing.sqf" Is there a way to name the spawned plane? Share this post Link to post Share on other sites
sxp2high 22 Posted August 15, 2011 Please no more full quotes. :rolleyes: You can make him stop, once he's in a certain distance from the marker. For example: waitUntil {PlaneX distance (getMarkerPos "PlaneDestination") < 100}; doStop PlaneX; Just add those lines at the end of setWP.sqf But if he detects enemies, he will engage and leave his position. These two lines i posted above gave it the name PlaneX. :) _Vehicle setVehicleInit "PlaneX = this;"; processInitCommands; If that doesn't work you can use setVehicleVarName. _Vehicle setVehicleVarName "PlaneX"; Share this post Link to post Share on other sites
domcho 20 Posted August 15, 2011 Sorry for the quotes lol :o the plane does not need to engage enemies. I tested it now and it worked fine. I used game logic for waypoint without map clicking because this makes him pass over the target exactly. Is there a way to set his speed to limited since he flies too fast and not all the triggers activate. I don't know why I copy-pasted them. How can I make him fly with limited speed? Thanks:yay: Share this post Link to post Share on other sites
jedra 11 Posted August 15, 2011 I jumped over from your other thread! You wanted to run the Carpet Bomb when the plane got to the destination. In this case instead of doing the 'doStop' that sxp had in the script, do this instead... testbomb = [PlaneX] execVM "carpet.sqf"; So, when the plane gets to the destination, it will run the carpet bomb script. Share this post Link to post Share on other sites
sxp2high 22 Posted August 15, 2011 (edited) For limiting the speed there are two ways. If you created a waypoint, just add this line: _WP setWaypointSpeed "LIMITED"; If you are using the doMove command, add this line: _Vehicle setSpeedMode "LIMITED"; You should also set these two values after spawning it: _Vehicle setBehaviour "Careless"; _Vehicle setCombatMode "Blue"; This will make sure that he flies directly through the waypoints. Without these two lines, he will get panic after spotting enemies =He will fly strange maneuvers and crash sooner or later. :D Edited August 15, 2011 by sxp2high Share this post Link to post Share on other sites
domcho 20 Posted August 15, 2011 (edited) I jumped over from your other thread! You wanted to run the Carpet Bomb when the plane got to the destination. In this case instead of doing the 'doStop' that sxp had in the script, do this instead... testbomb = [PlaneX] execVM "carpet.sqf"; So, when the plane gets to the destination, it will run the carpet bomb script. It's OK. I changed it's name to Bomber. All I need now is to make him somehow fly with limited speed. When he enters the triggers not all activate. I put like 8 triggers with the carpet.sqf script and only 3-4 work. As I said I copy-pasted them which means I couldn't have typed something wrong. Since the first trigger works. I think making the plane to fly slow will fix it, also it makes it cooler when he drops bombs :cool: :D ---------- Post added at 02:03 PM ---------- Previous post was at 01:28 PM ---------- OK, so my PC got raped when the plane released the package :D You can download the mission from here: http://www.4shared.com/file/DhuNqjjj/Battle20for20Novy20SoborCherna.html But in order to play it you need the Wings of Russia mod which can be downloaded from here: http://www.armaholic.com/page.php?id=10747 When the enemy reaches Novy Sobor press "M" and click "Carpet bomb" on the radio. Fall back a bit and hold your position. Enjoy the boom boom boom boom boom... Thanks a lot for everyone who helped me :p. This was my very first mission in ArmA 2 :eek: :yay: Edited August 15, 2011 by Domcho Share this post Link to post Share on other sites
jedra 11 Posted August 15, 2011 (edited) Now, you need to post it in the User Missions thread. By the way - did a small vid of your carpet bomb... pWDwqvNrVY4 Edited August 15, 2011 by Jedra Share this post Link to post Share on other sites