Jump to content
Sign in to follow this  
nomadd

SLP_Spawing script

Recommended Posts

SLP_spawn ...created by Nomadd

Credits:

Shuko ... I am using his SHK_pos.sqf to find the spawn locations. I have not altered it in anyway , full credits go to Shuko for this script. I am also using his SHK_buildingpos.sqf script

as an example of what can be added to the SLP_tasks.sqf for the spawned groups to preform, again full credit to Shuko for his script.

CBA and it creators

Silola for creating DAC , got a lot of ideas from there

all the folks at the BI forums who have taken the time to answer questions and provide help

DISCLAIMER:

I have tested this on multiplayer listen and dedicated servers, should work fine for SP, just not tested. I am still a novice at scripting so mistakes are likely. I am sure their are better ways to do some of the things I have done. If anyone with more scripting knowledge wants to improve/change this you have my blessing (just share it with everyone else).

First:

In your init.sqf (if you don't have one , you need to make one) put:

execvm "SLP\SLP_Init.sqf";

Second:

Make sure you have a functions module and at least one unit for each side present on the map.

note: If you want to use this with UPSMON the units have to be present probability 100%, otherwise, they can be set to probability 0.

UPSmon bugs-out and everything spawned will surrender if no units are present on the map.

How it works:

0= ["nameofspawn",[side,faction,delay(optional)],[position,offset distance(optional)],[infantry],[vehicles],[armor],[air],[tasks,taskinfo1,taskinfo2](optional),'string for unit init'(optional)] spawn SLP_spawn;

I have two unit configs. One is for ACE the other not-ACE, the script will detect if ACE is running and spawn ACE units otherwise it will use the non ACE. This lets missions use ACE units but not require ACE for the mission to work.

You can spawn any faction. Also, if you want Takistan militia to have USMC armor , you can set it that way.

The demo mission gives just a few examples of what you can do. The demo mission shows how to use arrays for different positions for units spawned to attack,defend,patrol. How to spawn units in one place then have them move to another place to preform the task. How to have units spawn randomly at different locations. How to implement the paramsarray to be able to change the mission everytime you play. I also tried to break everything down in the readme to explain things better.

Maybe some folks will find this useful. I have tried to thoroughly test this(just me doing the testing and with 3 kids running around, time is hard to find). If you find a problem or have a question please post it. I will try to get you an answer.

I recommend

CBA- the taskattack,taskpatrol and taskdefend are much better than BISs

ASR_AI. -will override the skill settings in SLP_init

TPWCAS

ARMA2

DEMO MISSION AND READ ME HERE:

v2.2

http://www.mediafire.com/?qnu87ofp7jgmj06

EDIT: ARMA3 version moved to ARMA3 editing section

Thanks,

Nomadd

Edited by Nomadd
update

Share this post


Link to post
Share on other sites

Download works fine for me.

Share this post


Link to post
Share on other sites

Made a few changes and fixed a few minor bugs. I linked the newest version in the first post.

-debug markers are now local

-fixed a small bug with debug marker not updating correctly when using the "hunt" task

-changed "attack","patrol" and "hunt" tasks so now units will search nearby houses

-"hunt" task will now work with groups or objects. just have to name them

-few other small changes

Nomadd

Share this post


Link to post
Share on other sites

Updated to version 1.2

-minor changes to markers when debugging mission

-SLP_task: "attack" can now have a single destination to attack or can be an array of destinations. If it is an array a random destination will be picked

EXP: ,["attack","atkmark1"] spawn SLP_Spawn; ,["attack",["atkmark1","atkmark2","atkmark3"]] spawn SLP_Spawn

-small change to the way the number of groups created is counted

Nomadd

Share this post


Link to post
Share on other sites

Hi Nomadd,

Good work!!

I really like your script, it's exactly what I need !!

Just a little thing, it will be nice if we could desactivate the respawn for A.I .

Or maybe i don't see the option?

Thanks

Share this post


Link to post
Share on other sites

@Wilsdorf

Not sure I follow about deactivating the script. You can set the number of times groups will spawn. If you want only want 1 group then only 1 will spawn or you can set an array exp: [3,6] and 3 to 6 groups will spawn. If you mean the ability to stop the spawning altogether once it has been called. I have not looked into doing that(not sure how easy that would be to do).

You could put the spawn line in a script and use some true/false conditons exp:

if (!isserver) exitwith {};
if (whatever) then {
["trg1"[0,0,15],[trg1],[1,[5,7]],[],[],[],["patrol",300]] spawn SLP_spawn
};
when the condition is true 1 infantry group with 5-7 units will spawn at position trg1. You could also use  a while {} do loop with a delay. This will continue to spawn the group while the condition is true

while {whatever} do {

["trg1"[0,0,15],[trg1],[1,[5,7]],[],[],[],["patrol",300]] spawn SLP_spawn
sleep 10;  
};

I hope this helps and I am glad to hear someone is enjoying the script

Nomadd

Share this post


Link to post
Share on other sites

Just a question can you set numbre of respawn i.e when all are dead in a group respawn another group - that way you can have another wave comming in , once those are dead , is that possible

Share this post


Link to post
Share on other sites

@psvialli

I should be able to change the script to do what you are wanting. Give me a some time to work on it. Real life work has picked up so don't have as much time for ARMA atm.

Nomadd

Share this post


Link to post
Share on other sites

Update to v1.3

-added boolean, you can set delay in secs or set it as true. If set as true another group will not spawn until the first group is completely killed

EXP: 0=["spawnname",[0,0,true],[trg1],[3,[4,6]],[],[],[],["defend","base"]] spawn SLP_spawn

One group with 4-6 units will spawn. once all are killed another group with spawn, once all are killed the final group will spawn.

Note: only use the boolean with one type of spawn, either infantry or vehicles or tanks or air. I put an example in the demo mission also updated the readme.

I also put an example of a way to do endless spawns until a condition is met. It works on hosted and dedicated , but for some strange reason, I have yet to figure out, it gives a script error on dedicated. The script seems to work fine on dedicated just gives an error. If put the line that is causing the error in a trigger I do not get an error. Maybe someone with more scripting knowledge than I can point to what the problem is. I will continue to work on it as time allows

Nomadd

Edited by Nomadd

Share this post


Link to post
Share on other sites

WOW nice one, love the hunt feature made an escape and evade mission so this will come in handy as another group will soon come looking for us if we take out the original group.

Thanks for that!

Share this post


Link to post
Share on other sites

Just wanted to say thanks. To you and to those in your credits.

I particularly enjoy the fact that I can constantly respawn baddies near me, no matter where I go, and have them 'hunt' my group. Something I've always wanted but was unable to do on my own. So, thank you for that.

It is a nice and easy way to set up a quick sandbox-y type of thing where you just wanna cruise around and fight bad guys, for no particular reason other than it's fun to blow shit up.

Cheers! :681:

Share this post


Link to post
Share on other sites

Been away for awhile. I dusted off Arma and started playing again. I realized I had a small problem with the markers script.

-fixed marker script

-some code changes

-updated readme

As I learn more, I will continue to try and make the script more efficient. Any bugs and problems please post them and I will try and take care of them.

Nomadd

SLP_Spawn v1.4

deleted link...12-31-12

Edited by Nomadd

Share this post


Link to post
Share on other sites

MAJOR UPDATE

I had some time over the holidays to take a hard look at this set of scripts. I wanted to do more with it and did not like some of the ways it did things. So, I basically reworked it from the ground up.

Hopefully, the changes I have made will make a difference.

update:

-Major code change. The script now use functions to accomplish the actual spawning. Meaning you can spawn units,vehicles,armo,aircraft from the same script call at the same time. They use to spawn in order. When one was done the next would spawn units>>Vehicles>>armor>>aircraft. That is no longer an issue.

-cleaned up alot of code, made quite a few of my own functions to make things smoother

-Stopped using BIS_fnc_selectrandomnumber. It was not doing what I thought. Made my own fnc to get random numbers.

-fixed the skill settings. they were not being applied to spawned units/vehicles.

-the script is no longer CBA dependent. The demo mission is CBA dependent, but it is easily changed. The tasks just need to be replaced with something else.

-burydead param in SLP_init, can set the delay a until units sink into ground and is deleted, only works on units spawned by SLP.

-Groups are deleted once all units are dead

-fillcargo param in SLP_init. Vehicles and Armor can now have empty cargo positions filled with units(only works on vehicles and armor with cargo positions). You can set the percentage of seats you want filled 0=none,1=full. .5 would be 50% full or [.25,.75] will fill 25-75% of the empty cargo positions.

-seperated the _air array in units configs into _helo and _plane, now you can choose which type you want to randomly spawn, Default is helo.

-streamlined the debug hints to help find any problems

-updated readme

SLP_spawn v1.5.1

NEWEST VERSION FRONT PAGE

Edited by Nomadd

Share this post


Link to post
Share on other sites

small update:

-more optimizing on the script

-fixed debug hint showing all the time, now only shows when debug is enabled

-can now use debug markers on editor placed units\vehicles, example in demo

UPDATED link on first page

Share this post


Link to post
Share on other sites

I just tested the link, worked fine for me. Anyone else having problems with the link?

Share this post


Link to post
Share on other sites

Just posted a link on the first page to a new version of this script that works with ARMA3. I have not had a chance to fully test everything and I know the read-me needs to be updated. I put in a real simple demo mission with a few examples of how it can be used.

Share this post


Link to post
Share on other sites

Not sure anyone is still using this but here is the lastest update. I have tested and have not found any errors.

This will probably be my last update to SLP_spawn. I am going to focus on ARMA3 now that it is out, but I will ,of course, fix any problems that may arise.

Change log:

-added "task" that the spawned group is doing to the debug marker

-Fixed debug markers showing in lower left corner.

-made some changes to hints

-changed SLP_tasks to work easier between CBA and non-CBA missions

-cleaned up code

-various fixes

new link on front page

Edited by Nomadd

Share this post


Link to post
Share on other sites

Hi Nomadd, thanks for your efforts, your work will come in handy for some of my missions :)

I just wanted to suggest a little improvment for your script if you don't mind.

Having functions/commands taking more than 4~5 parameters are hard to use, even for experienced developers, due to the higher possibility of syntax errors (some missed "[" / "]" characters and alike) and errors made by not following the required order.

It would be much easier if you'd design your function ("SLP_spawn") just to take the most mandatory parameters to work, which should break down the number of parameters to few ones.

The rest should be set using setters, like

  • SLP_spawn_setSide
  • SLP_spawn_setPosition
  • SLP_spawn_setTask
  • ....

with the same parameters your current function takes.

If, for an example, the side/faction is not set, just set it using default values ("side player", "faction player") or [0,0,0] for the position.

If mandatory values aren't set, you could easily return false or anything else after SLP_spawn to signal an improper use.

I know this would take some effort to split the code into different functions but in the end result it would ease the usage and further help to improve overall readability - devide and conquer :D

Share this post


Link to post
Share on other sites

I would like to simplify SLP as much as possible. With ARMA3 I will look into making it easier to use. I mainly made this for my own personal use. I guess I am so use to it, I don't think much about it.

Share this post


Link to post
Share on other sites

HOTFIX

-debug was saying SLP had aborted but it had not. I missed it during my testing. SLP is working fine, just wrong hint being shown

-remove hint I was using during testing, missed that one also

New Version

v2.1

Front Page

Share this post


Link to post
Share on other sites

New Version

v2.2

changelog

-various changes

-fixed armor not spawning crew but just regular units

NEW

-added _boat array in SLP_units_config. You can now spawn boats. To spawn a boat:

0=["trg1",[0,2],[trg1,50],[],[],[],[1,1,"boat"],["patrol",300]] spawn SLP_spawn;

you can use "helo","plane",or"boat" , if you put nothing then the default is "helo"

-added examples of using UPS in the SLP_tasks, Thanks to ssechaud for the suggestion

0=["trg1",[0,2],[trg1,50],[],[],[],[1,1,"boat"],["UPSMON","mrkname"]] spawn SLP_spawn;

-included demo mission on Chenarus to show boats

Couple of notes, Normal "patrol" does not work with boats. Boats will work when using UPSMON.

NEWEST VERSION FRONT PAGE

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×