OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: B2KDragon on 19 Jun 2011, 23:46:25

Title: In game unit spawning, and set goto area and attack on spawn.
Post by: B2KDragon on 19 Jun 2011, 23:46:25
Ok, short and to the point as always.

I THINK I have the unit spawning figured out, but it wouldn't hurt if someone can give me a few pointers on making a in game unit spawner.

I also need a way to get them to once spawned, goto a specific area and engage the enemy.

To put it in perspective, I have a team come back to base from a basic recon. They land and head to the ammo dump. Long and behold they are being hit by arty, this is now the point were I want the enemy to start spawning in at different areas around the base.

Just infantry will do fine, but... for that extra shiz I think a tank or two on random spawning would come in quite nice as well. Add a bit of flare and unexpectedness.

I need there to be about... 5 waves? With about 30-40 men in each wave. As well as a random tank appearing on any of those waves at.. well... random XD.

Help is very much appreciated.

Will be happy to get this mission FINALLY down and tested.

-Dragon.
Title: Re: In game unit spawning, and set goto area and attack on spawn.
Post by: F2kSel on 20 Jun 2011, 23:51:58
There are plenty of spawn scripts doing the rounds, couldn't you look at using one of those?
Title: Re: In game unit spawning, and set goto area and attack on spawn.
Post by: B2KDragon on 21 Jun 2011, 00:31:07
Hmmm.

I looked all over, I guess I am not looking in the right places.

Will try again, but I cannot seem to find anything at this time. Or when I posted.
Title: Re: In game unit spawning, and set goto area and attack on spawn.
Post by: F2kSel on 21 Jun 2011, 00:44:32
Perhaps something on this page would work, I must admit I haven't tested any of them as I'd rather mess about myself.  http://www.armaholic.com/list.php?c=arma2_files_editing_scripts (http://www.armaholic.com/list.php?c=arma2_files_editing_scripts)
Title: Re: In game unit spawning, and set goto area and attack on spawn.
Post by: B2KDragon on 26 Jun 2011, 23:59:19
Gona have to buck this here thread for a sec.

I went through a few old missions myself and another buddy of mine worked on. We actaully had a spawning script in there, only issue is it don't want to work.

Code: [Select]
g1_0 = createCenter East;
g1_0 = createGroup EAST;
_leader = g1_0 createUnit ["TK_INS_Soldier_TL_EP1", [(getMarkerPos "spawn") select 0,(getMarkerPos "spawn") select 1,0], [], 3, "FORM"];
_unit = g1_0 createUnit ["TK_INS_Soldier_MG_EP1", [(getMarkerPos "spawn") select 0,(getMarkerPos "spawn") select 1,0], [], 3, "FORM"];
_unit = g1_0 createUnit ["TK_INS_Soldier_EP1", [(getMarkerPos "spawn") select 0,(getMarkerPos "spawn") select 1,0], [], 3, "FORM"];
_unit = g1_0 createUnit ["TK_INS_Soldier_EP1", [(getMarkerPos "spawn") select 0,(getMarkerPos "spawn") select 1,0], [], 3, "FORM"];
_unit = g1_0 createUnit ["TK_INS_Soldier_EP1", [(getMarkerPos "spawn") select 0,(getMarkerPos "spawn") select 1,0], [], 3, "FORM"];
_unit = g1_0 createUnit ["TK_INS_Soldier_EP1", [(getMarkerPos "spawn") select 0,(getMarkerPos "spawn") select 1,0], [], 3, "FORM"];
_unit = g1_0 createUnit ["TK_INS_Soldier_EP1", [(getMarkerPos "spawn") select 0,(getMarkerPos "spawn") select 1,0], [], 3, "FORM"];
_unit = g1_0 createUnit ["TK_INS_Bonesetter_EP1", [(getMarkerPos "spawn") select 0,(getMarkerPos "spawn") select 1,0], [], 3, "FORM"];
_unit = g1_0 createUnit ["TK_INS_Soldier_AR_EP1", [(getMarkerPos "spawn") select 0,(getMarkerPos "spawn") select 1,0], [], 3, "FORM"];
_leader = leader g1_0;

_wp0 = g1_0 addWaypoint [getMarkerPos "twp1_0", 0];
_wp0 setWaypointType "SAD";
_wp0 setWaypointBehaviour "COMBAT";
_wp0 setWaypointCombatMode "RED";
_wp0 setWaypointFormation "Column";
_wp0 setWaypointSpeed "NORMAL";
_wp0 setWaypointStatements ["true", ""];

_wp1 = g1_0 addWaypoint [getmarkerpos "twp1_1", 0];
_wp1 setWaypointType "CYCLE";
_wp1 setWaypointBehaviour "COMBAT";
_wp1 setWaypointCombatMode "RED";
_wp1 setWaypointFormation "Column";
_wp1 setWaypointSpeed "NORMAL";
_wp1 setWaypointStatements ["true", ""];

Gimme your thoughts ladies and gentlemen.

I have it linked to a trigger that once Blufor have seized it they SHOULD spawn in, they won't spawn though.
Title: Re: In game unit spawning, and set goto area and attack on spawn.
Post by: F2kSel on 27 Jun 2011, 00:56:07
It works fine here.

script saved as spawn.sqf
Called with    null=[] execvm "spawn.sqf"  and three markers  name "spawn","twp1_0" and "twp1_1"  remove the quotes when naming the markers.

If it still won't work place a hint in the script to see if it's running hint "working";

I did play around with the BIS_Spawn_Group function.

http://www.sendspace.com/file/ceb0j8 (http://www.sendspace.com/file/ceb0j8)

This basically spawns groups without the need to know all the units they are made up from.
There is a text file included that lists the what the groups can be made up from.
It may be of some use.
Title: Re: In game unit spawning, and set goto area and attack on spawn.
Post by: B2KDragon on 27 Jun 2011, 13:35:10
Facehoof...

I forgot, I had the guy running around with on the test area as setcaptive... Derp.

Right, I got that all sorted and I will deffinatly look at that stuff, thanks for the help.