blackharaz 12 Posted June 9, 2022 Hey guys, I've searched for while but I can't find any solution for my problem. I'm creating a training map for our clan and I want to include a dogfight training. I want to spawn a pool of enemy jets at one of a predefined position and it have to give the jet one of a predefined movepoint to circle until he detects the player. I'm not the fittest in sqf and that's what I created yet: Pool of enemy jets (included in "init.sqf"): Spoiler arr_airTarget = [ "CUP_O_SU34_CSAT", "O_Plane_02_F", "O_Plane_CAS_02_dynamicLoadout_F", "rhs_mig29s_vvsc", "CUP_O_Su25_Dyn_SLA" ]; I set 5 "empty markers" to spawn on and 5 to move on at the map and included them in "init.sqf": Spoiler arr_airSpawn = [ "spawnAir_0", "spawnAir_1", "spawnAir_2", "spawnAir_3", "spawnAir_4" ]; arr_airMove = [ "moveAir_0", "moveAir_1", "moveAir_2", "moveAir_3", "moveAir_4" ]; After that I wrote a script to pick all three randomly and set the variables in my "cas.sqf"-file: Spoiler if (count arr_airTarget > 0) then { _randomN = floor (random count arr_airTarget); _randomAirTarget = arr_airTarget select _randomN; } else { }; if (count arr_airSpawn > 0) then { _randomN = floor (random count arr_airSpawn); _randomAirSpawn = arr_airSpawn select _randomN; } else { }; if (count arr_airMove > 0) then { _randomN = floor (random count arr_airMove); _randomAirMove = arr_airMove select _randomN; } else { }; Until here it worked fine. The script picks randomly the units and positions. Now the problem is to spawn it in and there I depair. =( I tried it like that... _jet = [_randomAirSpawn, "0", _randomAirTarget, east] call BIS_fnc_spawnVehicle; ...and nothing happens. =( And after that I've no idea how to give a waypoint to "_jet". What am I doing wrong? Share this post Link to post Share on other sites
Gunter Severloh 4052 Posted June 9, 2022 Hey, you can always use my mission which you can be in dogfights, as well as engage ground targets. The mission does what your looking to do. All factions blufor, opfor, and independent plane classnames are used, and you can choose what sides you want to engage. Theres 7 maps you can fly on. I plan to release the script thats in the mission but i been to busy with other projects right now. Altis is the original mission i built before i started porting it to other maps. Share this post Link to post Share on other sites
Stormmy1950 42 Posted June 9, 2022 Here i made a simple version of the script: private _jets = [ "B_Plane_CAS_01_dynamicLoadout_F", "B_Plane_Fighter_01_F", "O_Plane_CAS_02_dynamicLoadout_F", "O_Plane_Fighter_02_F", "I_Plane_Fighter_04_F", "I_Plane_Fighter_03_dynamicLoadout_F" ]; private _spawnMarkerLocations = [ "spawnAir_0", "spawnAir_1", "spawnAir_2", "spawnAir_3", "spawnAir_4" ]; private _jetWaypoint = [ "moveAir_0", "moveAir_1", "moveAir_2", "moveAir_3", "moveAir_4" ]; private _randomJet = selectRandom _jets; private _randomMarker = selectRandom _spawnMarkerLocations; private _randomWaypointLocation = selectRandom _jetWaypoint; private _group = createGroup east; private _pilot = _group createUnit["O_Pilot_F",[0,0,0],[],0,"NONE"]; private _jet = createVehicle[_randomJet,getmarkerpos _randomMarker,[],0,"Fly"]; _pilot moveInDriver _jet; private _wp = _group addWaypoint [getMarkerPos _randomWaypointLocation, 0]; Share this post Link to post Share on other sites
blackharaz 12 Posted June 10, 2022 7 hours ago, Gunter Severloh said: Hey, you can always use my mission which you can be in dogfights, as well as engage ground targets. The mission does what your looking to do. All factions blufor, opfor, and independent plane classnames are used, and you can choose what sides you want to engage. [..] Theres 7 maps you can fly on. I plan to release the script thats in the mission but i been to busy with other projects right now. Altis is the original mission i built before i started porting it to other maps. Hey Gunter Severloh. I took a look and it's a nice mission to train dogfights. 😃 But not really useful to me. My mission have to run on a server with 45 mods loaded (especilly ACE) and is a map to train all kind of warfare we'll get in our missions. Not only for pilots. It's also including a medic training, tank training, infantry and at the moment I try to simplify the CAS and dogfight training. We want all this parts of training in one map and not switching the map every time if we want to train another part. =( But with a few small mod adjustments I will see if we want to put it in the rotation pool. 😉 1 Share this post Link to post Share on other sites
blackharaz 12 Posted June 10, 2022 7 hours ago, Stormmy1950 said: Here i made a simple version of the script: Hey Stormmy, thx for your fast reply and the code looks much simpler then mine. 😃 But I tried it out and it don't work. =( I put your code in "dogfight.sqf" and started my mission in editor as "Multiplayer". Then I used []ecexVM "scripts\training\dogfight.sqf" to start it (local and global) and he gave an error back. ArmA complains that the variable _pilot is not defined and I like often in sqf I can't comprehend this error. =/ Share this post Link to post Share on other sites
blackharaz 12 Posted June 10, 2022 7 hours ago, Stormmy1950 said: Here i made a simple version of the script: Hey Stormmy, thx for your fast reply and the code looks much simpler then mine. 😃 But I tried it out and it don't work. =( I put your code in "dogfight.sqf" and started my mission in editor as "Multiplayer". Then I used []ecexVM "scripts\training\dogfight.sqf" to start it (local and global) and he gave an error back. ArmA complains that the variable _pilot is not defined and I like often in sqf I can't comprehend this error. =/ Share this post Link to post Share on other sites
blackharaz 12 Posted June 10, 2022 @Stormmy1950 Okay. I found out he is spawning the jets but don't put a pilot in. 🙈 Share this post Link to post Share on other sites
Stormmy1950 42 Posted June 10, 2022 6 hours ago, blackharaz said: @Stormmy1950 Okay. I found out he is spawning the jets but don't put a pilot in. 🙈 So basicly what am i doing here is i have array of jets, array of spawn positions for jets and array of move waypoints. Then i selectrandom jet, position and waypoint. Then i create a CSAT pilot at the 0,0,0 position in the world it shold be at bottom left corner of the map. then i create the jet that is selected randomly from a array, at the random spawn postion. Then in the script i move the pilot from 0,0,0 position to driver of a jet. then i give him the waypoint to random location. 2.If you copyied the code from the from here make sure there is no hidden characters. 3.How are you executing this code from addaction,trigger,ace interaction ? 4. if you copy the code from here there should't be any hidden characters: https://pastebin.com/Q8bkwHqc 1 Share this post Link to post Share on other sites
blackharaz 12 Posted June 10, 2022 @Stormmy1950 I feel so stupid atm. 😖 Thanks a lot. 😊 You solved my issue. 💪 Share this post Link to post Share on other sites