Jump to content
Sign in to follow this  
Easelm

Spawning Enemies at different specific locations.

Recommended Posts

Yes, before you type or comment, I have looked, found a lot of things for my request, but, sadly they are crap. They do not give out specific detail in 'how' to get the enemies spawning. I would also like to set their waypoints and set an automatic different name to script them.

If the automatic different name isn't possible, I will go with the waypoints and spawning enemies. I pretty much know how to script explosives, but I would like to have enemies spawning for fun, non-stop action.

About "how to get them to spawn", is it triggered by a Game Logic? If so, could someone elaborate on how to do that? I have been searching for the script I want for hours, but I have had no luck.

Share this post


Link to post
Share on other sites

This might help....but there is some reading and understanding involved. If you can script explosives then you should know about triggers and executing scripts already.

ArmA_2:_Editor_Modules .. you need the "functions library".

BIS_fnc_spawnGroup

addWaypoint

Hope it helps.

EDIT: This looks like what you want... it was 10 posts down from yours! http://forums.bistudio.com/showthread.php?t=118665

Edited by twirly
Added stuff

Share this post


Link to post
Share on other sites

Doubtful. If I know how to script explosives, I wouldn't know how to do anything else without actually having to be into this Arma2 OA editing, especially if it is something new to me, such as spawning functions. I just started a few days ago, so I am still reviewing tons of essentials.

And I just noticed that the thread you linked was a few topics down, but note, I was using the search function and it didn't show up.

But anyway, I will notify everyone if I still need help by bumping this thread, thanks for your help.

Share this post


Link to post
Share on other sites

It's going to take a while and lots of hair pulling... but hang in there. You'll get out of it what you put into it. Good luck.

Share this post


Link to post
Share on other sites

I could get the hang of it if there was a simple example. The thread you linked isn't "new" friendly to me.

Share this post


Link to post
Share on other sites

Mate it's going to take you more than 3 minutes to get the hang of it. That's for sure!

Will generate a small example for you...hang on five.

EDIT: OK... try this little example mission here.

Edited by twirly

Share this post


Link to post
Share on other sites

*Hanging on tightly*

Of course it is going to take me awhile to get the hang of it, but if I see an example, I can easily get the hang of what I am requesting. :P

Share this post


Link to post
Share on other sites

Here is an example from one of my missions.

// Array of markers pre placed in the editor at diffrent locations.

_markers = ["m1", "m2", "m3","m4","m5","m6","m7","m8","m9","m10","m11","m12","m13","m14","m15","m16","m17","m18","m19""m20""m21","m22","m23","m24","m25"];

/// Pick some random positions out of our markers to spawn the bad guys
   _pos = (getMarkerPos (_markers select (floor(random(count _markers)))));
   _pos2 = (getMarkerPos (_markers select (floor(random(count _markers)))));
   _pos3 = (getMarkerPos (_markers select (floor(random(count _markers)))));
   _pos4 = (getMarkerPos (_markers select (floor(random(count _markers))))); 

// Spawn the groups        
   grp1 = [_pos, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
   grp2 = [_pos2, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
   grp3 = [_pos3, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
   grp8 = [_pos4, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;

// Place three of the groups into building positions. 

grp1 execVM "PlaceInBuilding.sqf";
grp2 execVM "PlaceInBuilding.sqf";
grp3 execVM "PlaceInBuilding.sqf";

// Have the last group start patroling from the center of the area (Marker 24) 

[grp8, getMarkerPos "m24",75 ] call bis_fnc_taskPatrol;

Commands you should look at:

http://community.bistudio.com/wiki/Category:ArmA_2:_Functions

http://community.bistudio.com/wiki/addWaypoint

Share this post


Link to post
Share on other sites
Here is an example from one of my missions.

// Array of markers pre placed in the editor at diffrent locations.

_markers = ["m1", "m2", "m3","m4","m5","m6","m7","m8","m9","m10","m11","m12","m13","m14","m15","m16","m17","m18","m19""m20""m21","m22","m23","m24","m25"];

/// Pick some random positions out of our markers to spawn the bad guys
   _pos = (getMarkerPos (_markers select (floor(random(count _markers)))));
   _pos2 = (getMarkerPos (_markers select (floor(random(count _markers)))));
   _pos3 = (getMarkerPos (_markers select (floor(random(count _markers)))));
   _pos4 = (getMarkerPos (_markers select (floor(random(count _markers))))); 

// Spawn the groups        
   grp1 = [_pos, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
   grp2 = [_pos2, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
   grp3 = [_pos3, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
   grp8 = [_pos4, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;

// Place three of the groups into building positions. 

grp1 execVM "PlaceInBuilding.sqf";
grp2 execVM "PlaceInBuilding.sqf";
grp3 execVM "PlaceInBuilding.sqf";

// Have the last group start patroling from the center of the area (Marker 24) 

[grp8, getMarkerPos "m24",75 ] call bis_fnc_taskPatrol;

Commands you should look at:

http://community.bistudio.com/wiki/Category:ArmA_2:_Functions

http://community.bistudio.com/wiki/addWaypoint

This is exactly what I am talking about. You linked me the script, but you didn't show how to activate the script. If you say its by a trigger, please give me an example. I wrote in "On Act." the script, but nothing happened. I also spawned the markers. It would be greatly appreciated. If I am coming on too strong, well, I'm trying to get through people here.

Share this post


Link to post
Share on other sites

@Easelm... I had added an example mission to my post above for you... not sure if you saw it or not.

Share this post


Link to post
Share on other sites

You edited your post, kinda easy to look over. Anywho, I didn't specify that I am using Arma 2 Operation OA, my bad. It shouldn't have much of a difference, should it?

Share this post


Link to post
Share on other sites
You edited your post, kinda easy to look over. Anywho, I didn't specify that I am using Arma 2 Operation OA, my bad. It shouldn't have much of a difference, should it?

No difference in this case.

Share this post


Link to post
Share on other sites

Alright. Except when I try to load the mission in the editor, it says, "You cannot play/edit this mission; it is dependent on downloadable content that has been deleted.armcha_binocs"

Edited by Easelm

Share this post


Link to post
Share on other sites

Hello Easelm,

Here are some good scripts:

AI respawn group patrol area using UPS

http://www.armaholic.com/page.php?id=6540

AI vehicle respawn patrol area using UPS

http://www.armaholic.com/page.php?id=6543

Heres how UPS works:

http://kronzky.info/ups/index.htm

Very easy to implement, I can send you a mission that I built using these scripts, with these you

can make a mission that is a constant run n gun, or battle if you will.

All you do is:

-setup an area (marker) you want the AI to go to

-setup a marker the AI will respawn at

then

-create groups or units you want to respawn and move to that area just -add the script

code into the unit or squad (group) squad leader initilization line.

Other options is

-you can setup the time it takes them to respawn,

-you can setup the number of times they will respawn

pretty easy.

any questions let me know, I built many missions using squads, vehicles, plans, ect,.

from big ones with objectives, to small ones for just run n gun fun like deathmatch or

team death match type missions.

Share this post


Link to post
Share on other sites
Alright. Except when I try to load the mission in the editor, it says, "You cannot play/edit this mission; it is dependent on downloadable content that has been deleted.armcha_binocs"

Try again.... I took out the reference to the "binocs".

Share this post


Link to post
Share on other sites
Try again.... I took out the reference to the "binocs".

Thanks. Worked like a charm. And you understood my problem fully, I appreciate it. I have some more questions. Is there any way to assign the new groups a name so you can script them; As well as taking away their ammo and if possible, loop the script so they will spawn on a timer? If it is too much to have thoughts about, it is okay. Really, I am happy to even have the correct script.

Edited by Easelm

Share this post


Link to post
Share on other sites
Mate it's going to take you more than 3 minutes to get the hang of it. That's for sure!

Will generate a small example for you...hang on five.

EDIT: OK... try this little example mission here.

Tried your sample. Really like it.

However, when I attempt to change the WEST to EAST, it doesn't work. I've gone over the script a dozen times. I'm obviously missing something because there isn't much to it.

The really cool part is that I put another line in the script to call specific enemy units, much like the wiki page shows. Did not work until I made the enemies WEST... when I shot them, I got the "blue on blue" message.

any help?

Share this post


Link to post
Share on other sites
Is there any way to assign the new groups a name so you can script them

Yes. Give them a GLOBAL name (without the underscore). Then you can refer to the group using this name in other scripts. In this case below it is westgrp1.

//spawn a WEST group with 5 random units...
westgrp1 = [getPos hpad1, WEST, 5] call BIS_fnc_spawnGroup;

Next...

As well as taking away their ammo

To take away the groups (westgrp1) ammo.....

for "_i" from 0 to ((count units westgrp1)-1) do {
   _unit = units westgrp1 select _i;
   {_unit removeMagazine _x} forEach magazines _unit;
   sleep 0.01;
};

For the timer it depends how you want to do things.... there's a few ways... but you most probably need to use a loop with a big sleep. You have the loop structure above.

Start opening scripts and try to read and understand them. Try to see what they do. Familiarize yourself with the scripting commands.

The best advice is probably to not to be too ambitious. You will simply end up frustrated.

Do you have -showScriptErrors added to your games shortcut? This is very important in order to see where your scripts are screwing up.

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites
Tried your sample. Really like it.

However, when I attempt to change the WEST to EAST, it doesn't work. I've gone over the script a dozen times. I'm obviously missing something because there isn't much to it.

The really cool part is that I put another line in the script to call specific enemy units, much like the wiki page shows. Did not work until I made the enemies WEST... when I shot them, I got the "blue on blue" message.

any help?

To spawn the "EAST" enemies, you will need to at least have one OPFOR or w/e enemy present.

Share this post


Link to post
Share on other sites
when I attempt to change the WEST to EAST, it doesn't work.

Add an EAST soldier to the map with this in his init....

deleteVehicle this;

...or in your init.sqf use...

_sideHQ = createCenter EAST;

Share this post


Link to post
Share on other sites
Yes. Give them a GLOBAL name (without the underscore). Then you can refer to the group using this name in other scripts. In this case below it is westgrp1.

//spawn a WEST group with 5 random units...
westgrp1 = [getPos hpad1, WEST, 5] call BIS_fnc_spawnGroup;

Next...

To take away the groups (westgrp1) ammo.....

for "_i" from 0 to ((count units westgrp1)-1) do {
   _unit = units westgrp1 select _i;
   {_unit removeMagazine _x} forEach magazines _unit;
   sleep 0.01;
};

For the timer it depends how you want to do things.... there's a few ways... but you most probably need to use a loop with a big sleep. You have the loop structure above.

Start opening scripts and try to read and understand them. Try to see what they do. Familiarize yourself with the scripting commands.

The best advice is probably to not to be too ambitious. You will simply end up frustrated.

Do you have -showScriptErrors added to your games shortcut? This is very important in order to see where your scripts are screwing up.

Thanks for your help. I am reviewing the command list, as well as adding some other things. I appreciate your help. Peace out. I will figure out the looping enemies spawn myself. :)

Share this post


Link to post
Share on other sites

Cool. It's been ten years for me and I'm still looking stuff up everyday! It's the nature of the beast!

Share this post


Link to post
Share on other sites

Hmm, for the global name, do I actually have to add another scripts name to make it work?

I have Bombers.sqf:

Boom = "M_AT10_AT" createVehicle getpos vehicle NAMEHERE;

^ Works, just need to get the group to explode for a test.

Or does it work globally without adding the script, like so:

grp1 execVM "Bombers.sqf";

---------- Post added at 05:06 AM ---------- Previous post was at 04:59 AM ----------

EDIT:: I got the looping to work. <3 Just need to know the above.

Share this post


Link to post
Share on other sites
just need to get the group to explode for a test

_bomb = "Bo_GBU12_LGB" createVehicle getPos leader westgrp1;

EDIT: Added some more.....

This is probably what you need.

For "bomb.sqf".....

_unit  = _this select 0;

_bomb = "Bo_GBU12_LGB" createVehicle getpos _unit ;

For the trigger....

nul = [thislist select 0] execVM "bomb.sqf";

Edited by twirly

Share this post


Link to post
Share on other sites

Ohh.. that was soo priceless to watch them all explode just for a test run. Thanks again, peace out for real. Hope to see you around soon.

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  

×