nomadd 66 Posted March 6, 2013 updated: 03-11-2018 This is a set of scripts I made for ARMA2. Well I finally got around to updating this after a long break from Arma 3. I have tried to optimize it and clean it up as best as I am able. As I learn more about scripting I change and implement what I learn, but it is a slow process. SLP_spawn will spawn units, vehicles, armor , air,boats in just about any configuration you want. It will also tell spawned units what to do using either CBA or BIS functions, taskpatrol/taskdefend/attack ,and functions I have created hunt\attack ,and scripts community authors have made like Zen_occupyhouse and SHK_buildingpos. SLP is very robust in what it can do. It can have opfor units spawn in bluefor vehicles(if that is what you want) and patrol an area or defend an area. You can decide how many groups you want with how many units per group. You can completely randomize the number and locations of units\vehicles in a mission. SLP will work with any mod. Just have to set the units/vehicles in the SLP_unit_config.sqf. examples: CUP, Unsung etc SLP runs completely server side. I have tested it on hosted and dedicated (dedicated testing has been awhile so not sure if any errors will show up, I am too lazy to put a server back up for testing). I have included a readme with all credits and more instructions, but probably easiest to look at the demo to see how you can implement it. I included a number of examples in the demo of how to spawn units/vehicles I recommend using CBA with this but it will work with out CBA. BIS_fnc_taskpatrol is a little strange on some things. Boats will not patrol with BIS_fnc_taskpatrol. They head straight for land. No idea why this happens. -this newest version has the option of using "initsting" you can run custom scripts on newly spawned units ( see demo for examples). -I have made to many changes since the last version to list everything I know their are better ways of doing some of the scripting, so if anyone wants to make changes feel free. I just ask my name stay attached somewhere and you share it with the community. newest version 3.49 https://www.dropbox.com/s/4ecaq9maikj4q3x/SLP_spawn_v3%2e49.Stratis.7z?dl=0 1 Share this post Link to post Share on other sites
ringoray 1 Posted March 6, 2013 Thanks for this will give it a try. I wonder will this reduce lag on hosted games between friends? Share this post Link to post Share on other sites
SuperbusMaximus 1 Posted March 6, 2013 (edited) Thanks for the script, but I am having no luck so far getting it to work, which is probably due to the fact I have never really used scripts and don't know where everything should be properly installed to get it to work. Got it working thanks! Edited March 6, 2013 by SuperbusMaximus Share this post Link to post Share on other sites
nomadd 66 Posted March 6, 2013 @Ringoray I have a number of missions I use this in. I usually host with 3-5 friends playing, have never had a lag issue. However, if you try and spawn hundreds of AI at once you will probably have an issue. I will also set triggers to detect when bluefor/opfor (which ever side you are playing) gets close to an area , then spawns the units. @superbus can you get the demo to work? Share this post Link to post Share on other sites
ringoray 1 Posted March 7, 2013 @Nomadd, Thanks for the info, I will play it with some of my friends and give you some feedback!:) Share this post Link to post Share on other sites
Guest Posted March 9, 2013 Release frontpaged on the Armaholic homepage. [ALPHA] SLP Spawning script v3 Share this post Link to post Share on other sites
nomadd 66 Posted March 10, 2013 Thanks Foxhound Working on an updated demo to show more examples of how to use this script. Future update will include boats and the ability to spawn boats on random patrols. I will probably wait and release this after CBA fncs get updated to ARMA3. Share this post Link to post Share on other sites
SD_BOB 10 Posted March 10, 2013 Nomadd, great system... Kind of a easy to use simplified DAC. Couple of quick questions, if you use the "building" task, is it possible to get the units to move slowly between different position with the building and maybe go to other buildings aswell? Also would be it possible to maybe color code the text for the debug markers, to represent the different task modes. I.E keep the Red diamond markers for OPFOR but change the color of the text so say patrol would be standard red, building might be green, defend yellow etc. Just like to keep an eye on what everything is doing. Share this post Link to post Share on other sites
nomadd 66 Posted March 10, 2013 @Shadow.D The "buidling" task I am using atm is not possible. It is a script written by Shuko, and it just places units inside buildings randomly. Once CBA gets fully updated the CBA_fnc_taskdedend will actually have units defend an area and patrol around going inside buildings. I will have to look at the markers. I can see what you are asking but the way things are set up atm I can't do it. I will see if I can make some changes to implement it. Been busy , but I have almost finished making the new demo mission. I have an example of how you can use SLP to spawn and then let UPS script take over. I know UPS has "randomup", "randomdown" that can make getting units into buildings much easier. Share this post Link to post Share on other sites
SD_BOB 10 Posted March 10, 2013 (edited) Cheers for the response mate, i wonder if you are just calling a script onto the guys for "building" maybe you could try this one until the CBA Fncs are added... crB_HousePos.sqf ////////////////////////////////////////////////////////////////// // Function file for Armed Assault // Created by: (AEF)Wolffy.au [CTB] // Created: 20100705 // Modified: 20100711 // Contact: http://creobellum.org // Purpose: Move or patrol a unit to random house positions // // The following code is an extract from Random Building Position Script v1.0 by Tophe of Östgöta Ops // Usage: // Move unit or object to random house position within 10m // 0 = [this] execVM "crB_scripts\crB_HousePos.sqf"; // // Move unit or object to random house position within 50m // 0 = [this, 50] execVM "crB_scripts\crB_HousePos.sqf"; // // Patrol unit to random house positions within 50m with a maximum // wait time 300 sec between positions // 0 = [this, 50, true] execVM "crB_scripts\crB_HousePos.sqf"; // // Patrol unit to random house positions within 50m with a maximum // wait time 600 sec between positions // 0 = [this, 50, true, 600] execVM "crB_scripts\crB_HousePos.sqf"; ////////////////////////////////////////////////////////////////// if (!isServer) exitwith {}; private["_obj","_radius","_patrol","_maxwait","_pos","_bldgpos","_i","_j","_nearbldgs"]; _obj = _this select 0; _radius = 10; if(count _this > 1) then {_radius = _this select 1;}; _patrol = false; if(count _this > 2) then {_patrol = _this select 2;}; _maxwait = 300; if(count _this > 3) then {_maxwait = _this select 3;}; _pos = getPos _obj; _bldgpos = []; _i = 0; _j = 0; _nearbldgs = nearestObjects [_pos, ["Building"], _radius]; { private["_y"]; _y = _x buildingPos _i; while {format["%1", _y] != "[0,0,0]"} do { _bldgpos set [_j, _y]; _i = _i + 1; _j = _j + 1; _y = _x buildingPos _i; }; _i = 0; } forEach _nearbldgs; _pos = _bldgpos select floor(random count _bldgpos); if(_obj isKindOf "Man" || _obj isKindOf "Car") then { if(_patrol) then { _obj setSpeedMode "LIMITED"; }; _obj setCombatMode "YELLOW"; _obj move _pos; } else { _obj setPos _pos; _obj setDir (random 360); _obj setVectorUp [0,0,1]; }; _obj setDir (random 360); while{_patrol && alive _obj} do { sleep (random _maxwait); _pos = _bldgpos select floor(random count _bldgpos); _obj move _pos; // waitUntil{unitReady _obj;}; // _obj setDirection (random 360); }; ////////////////////////////////////////////////////////////////// Have tested this, seems to work fine on individual editor units and groups. Edited March 10, 2013 by Shadow.D. ^BOB^ Share this post Link to post Share on other sites
1para{god-father} 105 Posted March 11, 2013 is there a way to have a continuous spawn until a condition is meet ? then stop spawn until it is true again then spawn again i.e if TRUE spawn and keep spawning when group is dead unlimited times , when FALSE stop spawn and wait until TRUE again ? would this be possible ? Share this post Link to post Share on other sites
nomadd 66 Posted March 11, 2013 @psvialli I worked on this awhile back. I found a way to do it. It wasn't pretty by any means but it worked. The problem I had was it would throw an error when use on dedicated. It would work, but throw out an error. I got busy with other things and stopped working on it. I will try and dig up what I did before. Share this post Link to post Share on other sites
nomadd 66 Posted March 12, 2013 (edited) Ok been working on a few things: @Shadow.BOB I changed the debug markers to show what task the group is doing IE: grp1--4units..patrol So whatever task you are using will now show in the debug markers. I looked at using different color markers for the tasks but things were getting to convoluted on the screen with all the different markers. I also set up a task using CRB_housepatrol script. It works but there are quite a few bugs in game that mess with it. 1. It does not work well for groups. The group will patrol but only some of the units will go in buildings. Single spawned units seem fine. 2. Building positions do not seem to be fully functioning for all the buildings. 3. AI very rarely will open a door(just walk right through it). Sometimes AI will just walk right through a building(no collision). AI rarely wants to use staircases. I know this is ALPHA so I think alot of the issues will be resolved. @psvialli I looked again at what you want. There is just no good way to do this. The scripts are just not set up to start and stop the same spawn. I can make it so you can spawn endless groups until a condition is met, but can't really start the same spawn again using the same condition. You can probably get around this by scripting... having the condition turn true/false and then running your spawn line [whatever] spawn SLP_spawn again. This is pretty much what I did the last time I was able to get this to work. Hatchet job of an exp: this has not been tested but gives you an idea while {conditon is true} do { ["",[],[],[],[],[],[],'groupname = group this'] spawn SLP_spawn; waituntil {waituntil {{alive _x} count units groupname <= 0}; }; On another note. I have found that bis_fnc_taskpatrol will not put waypoints over water (I am not sure why). If I try and spawn a helo and patrol over water it always goes toward land and then patrols. The CBA functions will be released soon so I am going to wait on updating until I get to try those. I will of course have SLP_spawn set so you can use CBA or not use it, your choice. Edited March 12, 2013 by Nomadd Share this post Link to post Share on other sites
nomadd 66 Posted March 21, 2013 Newest Version: SLP_Spawn v3.1 Change log: -"Tasks" will now be shown in the debug markers, to let you know what the spawned units/vehicles are doing -fixed markers in lower left corner -added CBA functions -added example with CRB_housepos -expanded the demo with more examples -changed some of the hints -cleaned up the code -various fixes The script will now use CBA functions if CBA is detected. If CBA is not detected it will use BIS functions. You can make a mission that will work either way but be warned CBA functions and BIS functions do not work exactly the same. Mainly CBA_fnc_taskdefend and BIS_fnc_taskdefend are quite different in the way units will preform in game. Just play around with them to find what you like. There are quite a few bugs in game, yeap its ALPHA, that have nothing to do with with the script or the "tasks". I am not going to worry about them until the game gets further along in development. I have a feeling most of these things will get fixed. -units have a bad tendency of walking through objects, buildings etc -alot of building positions are not working -a number of buildings do not seem to have positions, uppers floors of the guard towers are a good example -waypoints do not work over water. I am not sure about editor placed waypoints but spawned ones do not seem to work. need to test this more -AI units get stuck in a stand up -crouch loop -AI sometimes just get stuck and will not move -AI seldom like to open doors, easier to just walk through them -AI can be as dumb as a box of rocks when the fighting starts(this is not all the time, but it does happen often) I know there are more bugs, but these came to mind from testing SLP and watching the spawned AI. Newest version is on front page. I tested as much as I am able and found no problems. If anyone finds a problem let me know and I will see about fixing it. Share this post Link to post Share on other sites
massasster 1 Posted March 21, 2013 @Nomadd- It's so hard to tell what in the world I am messing up. I've tinkered around with several different setups and it's just not doing what I am expecting. I've tried this.. 0=["first",[0,0,8],[[first,obj4,25]],[12,[5,8]],[],[],[],'nul=[this,"spawn2"] execVM "ups.sqf";'] spawn SLP_spawn; Expecting it to spawn 12 groups of between 5 to 8 - it did not... it continued to spawn several small groups of 1 to 2... So I tried this 0=["fkme",[0,0,8],[[obj4,15]],[5,[1,2]],[],[],[],'nul=[this,"spawn2"] execVM "ups.sqf";'] spawn SLP_spawn; It continued to spawn smaller groups but refused to spawn them at OBJ4, just kept spawning at the trigger.. I said hell with it and moved the trigger... I placed a condition on the trigger !alive mytarget and with Debug on everything worked. Soon as I turned debug off inside the SLP_init it just stopped working... Share this post Link to post Share on other sites
Guest Posted March 21, 2013 Updated version frontpaged on the Armaholic homepage. [ALPHA] SLP Spawning script v3.1 Share this post Link to post Share on other sites
nomadd 66 Posted March 21, 2013 @MassAsster 0=["first",[0,0,8],[[first,obj4,25]],[12,[5,8]],[],[],[],'nul=[this,"spawn2"] execVM "ups.sqf";'] spawn SLP_spawn; should be 0=["first",[0,0,8],[[first,obj4],25],[12,[5,8]],[],[],[],'nul=[this,"spawn2"] execVM "ups.sqf";'] spawn SLP_spawn; It looks like you are trying to use first(guess this is a named object) and obj4 as the location for the spawned units. The locations can be in an array [first,ob4]. The script will then randomly spawn units at either location. The 25, is 25 meter offset from the spawn location. You had all 3 elements in the same array and the scripts would not know what to do with 25 as a spawn position. If you are just naming the script call "first" and you do not have an object actually named first..then use 0=["first",[0,0,8],[obj4,25],[12,[5,8]],[],[],[],'nul=[this,"spawn2"] execVM "ups.sqf";'] spawn SLP_spawn; Remember with UPS you need to have a marker called "spawn2" set to the size you want. Download the latest demo. I have a working example of spawning and then letting UPS take over Share this post Link to post Share on other sites
massasster 1 Posted March 21, 2013 (edited) @Nomadd I spent the better part of my evening working on this and it's still just kicking my rear... Can you just take a fast look at this and tell me, even using your example in the newest version, why they refuse to cooperate ? lol thanks for any help you can offer... it's prob something so small I'm overlooking some how.. http://ecbiz122.inmotionhosting.com/~tucker17/myexample.zip Trigger to spawn is "harry2" (a civilian on a chopper) Spawn location is bottom left town - "obj4" /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ _debug = (paramsarray select 0); // 0:off 1:on //If on shows markers for group position,type(units,vehicle,armor,air),number of units in the group and current waypoint // Also, will turn on debug messages /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ with this line set to _debug = 0 , doesn't work.. with this line left as is, works... I don't get it Edited March 21, 2013 by MassAsster Share this post Link to post Share on other sites
nomadd 66 Posted March 21, 2013 (edited) @MassAsster I was able to take a look at the mission. I made some changes and everything is working fine. When harry2 is killed 8 groups of 5 units will spawn and UPS will take over. I left your mission as is and just copied it and renamed it with _edit at the end. That way you can compare the two. You had everything right just needed a few small changes. I need to redo the readme. Didn't think about it being confusing using (paramsarray select X). If you play multiplayer, in the lobby you can click on paramaters and change things. SLP is set up to take advantage of that. You can turn debug on/off in the paramaters. You can also set missions up to change the number of groups,number of units per group based on the paramaters. This allows you to change a mission on the fly without having to go in and redo the mission. I did it this way so a mission can be more dynamic. If you are playing with 5 friends,you can have X number of enemies. If you are playing with 20 friends then you can change the paramaters in the lobby and increase the number of enemies to X. If you look at the decription.ext you will see how this is set up. You mission is here: link removed Edited March 29, 2013 by Nomadd Share this post Link to post Share on other sites
massasster 1 Posted March 21, 2013 Nomadd Awesome - I will look over it and continue to add them to the rest of the "objectives" - I really like that you made the script that dynamic - big thank you to you, that is just awesome for those of us using it. I will follow your lead on the edits you made and attempt to finish this mission out - again, huge thank you. Share this post Link to post Share on other sites
massasster 1 Posted March 22, 2013 I don't know what the deal is, ive set up params like you have , set up the files back to default and if i put anything other than "1;" in the _debug = line, than i get XX aborted message. if It's set to "1" (where it works), than I can't disable debugging... any chance you can hard code debug some place? Share this post Link to post Share on other sites
nomadd 66 Posted March 22, 2013 @MassAsster The way the " debug =" works is either with a 1 or 0, 1 is on, 0 is off. No other setting will work. Now to use paramsarray, you have to have it set up in the description.ext. class Header { gameType = Coop; minPlayers = 1; maxPlayers = 10; }; respawn = "instant"; respawndelay = 2; class Params { class debug { // paramsArray[0] title = "Debug"; values[] = {0,1}; texts[] = {"Disabled","Enabled"}; default = 1; }; class EnemyInfgroups { // paramsArray[1] title = "Number of Enemy Infantry Groups"; values[] = {1,3,5}; texts[] = {"1", "3", "5"}; default = 1; }; class EnemyInfsize { // paramsArray[2] title = " Number of Enemy Units in Infantry Groups"; values[] = {3,6,9}; texts[] = {"6", "9", "12"}; default = 3; }; class Enemyvehgroups { // paramsArray[3] title = "Number of Enemy Vehicles Groups"; values[] = {0,1,2,3}; texts[] = {"0", "1", "2", "3"}; default = 1; }; class Enemyvehsize { // paramsArray[4] title = " Number of Enemy Units in Vehicles Groups"; values[] = {0,1,2,3}; texts[] = {"0", "1", "2", "3"}; default = 1; }; class Enemyarmgroups { // paramsArray[5] title = "Number of Enemy Armor Groups"; values[] = {0,1,2,3}; texts[] = {"0","1", "2", "3"}; default = 1; }; class Enemyarmgsize { // paramsArray[6] title = " Number of units in Armor Groups"; values[] = {0,1,2,3}; texts[] = {"None", "1", "2", "3"}; default = 1; }; class Enemyairgroups { // paramsArray[7] title = "Number of Enemy Air"; values[] = {1,2,3}; texts[] = {"1", "2", "3"}; default = 1; }; }; if you look at the first element under class params, you will see class debug. The values are {0,1}, "Disabled" and "Enabled" are what will show in the paramaters from the multiplayer lobby. To be able to use this you need to put: /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ _debug = (paramsarray select 0); // 0:off 1:on //If on shows markers for group position,type(units,vehicle,armor,air),number of units in the group and current waypoint // Also, will turn on debug messages /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ (paramsarray select 0) is the first element in the CLASS PARAMS in the description.ext. The one labeled CLASS DEBUG. Whatever the value is set to in the paramsarray it will be used by _debug = (paramsarray select 0); This way you can change it in the paramaters in the lobby before you play a mission, but you can only "Enable" which would give it a value of 1 or "Disable" which will give it a value of 0. If you don't want to mess with any of that, then you will have to manually changed it in the SLP_init.sqf to either a 1 or 0,depending if you want markers to show or not. I may be wrong but I am pretty certain you can't change paramaters in the normal editor, you have to use multiplayer. You will need to copy/move the mission from Documents\ARMA3 ALPHA\User Name\missions to Documents\ARMA3 ALPHA\User Name\MPmissions to be able to see it in multiplayer. Then to get to it, start the game, goto play, multiplayer, start a lan server and your mission should pop up. You will be able to edit or play. When you play the mission you will see a button that says paramaters. You can put the demo mission in the MPmissions folder and see how it all works. Like I said above, you don't have to do any of this. You can just manually change the value to a 1 or 0. Do all your editing , once everything is working go in and change _debug = 0; to turn the markers off. I hope this helps and is not too confusing. Once you play around with it, it gets easier. One last thing, to save on headaches. The first element in any array is always 0. CLASS DEBUG is the first one, so it is (paramsarray select 0) Share this post Link to post Share on other sites
massasster 1 Posted March 22, 2013 I figured out the jist from your array , had set up the description.ext and launched the game . I get "tgr6 aborted" messages as if it was still in debug but something went horribly wrong.. the version you sent me back - should do it for you, if you look at _debug = i should have it set to 1, try and change it . changing it to anything other than "1" throws errors for me.. With it set to 1, Ive attempted to go into the multiplayer lobby and edit the debug setting there, it does not effect the debug, it still remains on.. Share this post Link to post Share on other sites
nomadd 66 Posted March 22, 2013 (edited) I found why it is saying aborted. It is not your mission, it is SLP. I forgot to remove/change a hint in the code, nothing is actually being aborted. Somehow I missed that in my testing. I will upload a new version of SLP with the correction. ---------- Post added at 09:57 AM ---------- Previous post was at 09:56 AM ---------- HOTFIX Thanks to MassAsster for bringing this to my attention. I missed this in my testing. -SLP was saying it was aborting when it really wasn't. -removed another hint I was using for testing, missed that one also new version 3.1.1 Front Page Edited March 22, 2013 by Nomadd Share this post Link to post Share on other sites
massasster 1 Posted March 22, 2013 thanks man, your a life saver - scripts all i ever wanted and more. credit to you Share this post Link to post Share on other sites