zeeb 2 Posted January 5, 2020 Hey there! I've been working on a Wave based mission that will be playable by 5 people. I'm not the most adept when it comes to scripting in Arma so I could use some of your help. The script I've created is very basic and I could need some help in evolving it, currently I have some issues with it;1. I don't know how to make the script count the Waves, adding a number behind like "Wave 1, Wave 2" etc. (This would be very nice to have to see what wave you're at and to add maybe a Tank as enemy every 10th wave)2. I feel like my countdown system could be better.3. I managed to make the script select from different units when spawning them, however everyone spawns as the same selection, I can tell why it does but not how to fix it.4. I currently use the Waypoint MOVE for the enemies and assigned it to a marker in the middle of the player's base, but have no idea if this is the most effective way of doing it.5. I feel like the code is not optimized as well as it could be, if you have any insights on how to improve it or make it more optimal, please share. Here it is:waveScript.sqf // Arsenal arsenal_box hideObject false; hint "Arsenal is available for 30 seconds."; sleep 20; // Countdown hint "Next wave in 10 seconds."; sleep 1; hint "Next wave in 9 seconds."; sleep 1; hint "Next wave in 8 seconds."; sleep 1; hint "Next wave in 7 seconds."; sleep 1; hint "Next wave in 6 seconds."; sleep 1; hint "Next wave in 5 seconds."; sleep 1; hint "Next wave in 4 seconds."; sleep 1; hint "Next wave in 3 seconds."; sleep 1; hint "Next wave in 2 seconds."; sleep 1; hint "Next wave in 1 second."; sleep 1; // Next Wave arsenal_box hideObject true; hint "Wave incoming!"; // AI Spawning _groupAlpha = createGroup [east, true]; //selected_spawn = selectRandom ["spawn_1", "spawn_2", "spawn_3", "spawn_4", "spawn_5"]; selected_spawn = selectRandom ["spawn_test"]; enemy_type = selectRandom ["O_Soldier_F", "O_Soldier_GL_F", "O_Soldier_AR_F", "O_Soldier_M_F"]; enemy_type createUnit [getMarkerPos selected_spawn, _groupAlpha]; enemy_type createUnit [getMarkerPos selected_spawn, _groupAlpha]; enemy_type createUnit [getMarkerPos selected_spawn, _groupAlpha]; enemy_type createUnit [getMarkerPos selected_spawn, _groupAlpha]; enemy_type createUnit [getMarkerPos selected_spawn, _groupAlpha]; _groupAlpha allowFleeing 0; _groupAlpha move getMarkerPos "player_base"; Any sort of input is appreciated. Thanks in advance! /zeeb Share this post Link to post Share on other sites
RCA3 593 Posted January 5, 2020 Hello! 1. I don't know how to make the script count the Waves, adding a number behind like "Wave 1, Wave 2" etc. (This would be very nice to have to see what wave you're at and to add maybe a Tank as enemy every 10th wave) Done. 2. I feel like my countdown system could be better. Done. 3. I managed to make the script select from different units when spawning them, however everyone spawns as the same selection, I can tell why it does but not how to fix it. Done. 4. I currently use the Waypoint MOVE for the enemies and assigned it to a marker in the middle of the player's base, but have no idea if this is the most effective way of doing it. You're using move, not addWaypoint which is fine for this case. 5. I feel like the code is not optimized as well as it could be, if you have any insights on how to improve it or make it more optimal, please share. Optimization doesn't really matter in small, one timer, non-cpu intensive scripts like this. 👍 Note: I made it run on server only so it won't spawn enemies on every client and it's single player and multiplayer ready. Run it from a trigger or from somewhere local to server (ex: AI unit or initServer.sqf). Quote if !(isServer) exitWith{}; // Init if (isNil "waveScriptCount") then{waveScriptCount = 0}; waveScriptCount = waveScriptCount + 1; // Arsenal arsenal_box hideObjectGlobal false; "Arsenal is available for 30 seconds." remoteExec ["hint", 0]; sleep 20; // Countdown for "_i" from 0 to 9 do{ private _msg = format ["Next wave in %1 seconds.", 10 - _i]; _msg remoteExec ["hint", 0]; sleep 1; }; // Next Wave arsenal_box hideObjectGlobal true; "Wave incoming!" remoteExec ["hint", 0]; // AI Spawning // Foot Soldiers private _groupAlpha = createGroup [east, true]; //private _selected_spawn = selectRandom ["spawn_1", "spawn_2", "spawn_3", "spawn_4", "spawn_5"]; private _selected_spawn = selectRandom ["spawn_test"]; for "_i" from 0 to (4 + random 3) do{ //enemy count private _enemy_type = selectRandom ["O_Soldier_F", "O_Soldier_GL_F", "O_Soldier_AR_F", "O_Soldier_M_F"]; _enemy_type createUnit [getMarkerPos _selected_spawn, _groupAlpha]; }; _groupAlpha allowFleeing 0; _groupAlpha move (getMarkerPos "player_base"); // Tank Spawning every 10 waves if ((waveScriptCount % 10) isEqualTo 0) then{ //private _selected_spawn = selectRandom ["spawn_1", "spawn_2", "spawn_3", "spawn_4", "spawn_5"]; private _selected_spawn = selectRandom ["spawn_test"]; private _tanktype = selectRandom ["O_MBT_04_cannon_F", "O_MBT_02_cannon_F"]; private _safepos = [(getMarkerPos _selected_spawn), 0, 100] call BIS_fnc_findSafePos; private _tank = [_safepos, 0, _tanktype, east] call BIS_fnc_spawnVehicle; _tank doMove (getMarkerPos "player_base"); }; 1 Share this post Link to post Share on other sites
zeeb 2 Posted January 6, 2020 Wow, you really nailed all the steps too. What a legend! Big thanks to you mate, appreciate it big time. 😄 Cool if I ask you stuff in PM's going forward with the script? 1 Share this post Link to post Share on other sites
RCA3 593 Posted January 6, 2020 Thank you. 😉 Sure, if it doesn't get too long... 😃 1 Share this post Link to post Share on other sites