Jump to content
Sign in to follow this  
PirateGaming

Ai reinforcement spawning - Help needed

Recommended Posts

Hello, and thank you for checking my thread. I'm working on a coop mission and i haven't done anything with the A2 editor in a while, so please go easy on me. Basically ll i'd like is for a script which spawns AI in groups of 4 to 6 depending on how many AI are active/alive. An example would be, 25 AI attack a town, 5 of them die, and 5 respawn a fair distance away with way-points to their objective(s), then 3 die but no forces are re-spawned until it hits a sort of 'critical mass'. If anybody can point me in the right direction with a script or something similar (no addons please) it woud be greatly appreciated.

A fair note of warning, i am using a framework built somewhat for TvT but still includes the headless client giving the AI a general.

Share this post


Link to post
Share on other sites

Here's a mission I've just whipped up for you...

https://www.dropbox.com/sh/am3mz8o6z7djx7t/AABbYp7XHSwvU2lwMoydwFp9a

Drop the mission into your C:\Users\ ... \Documents\ArmA 2\(YourPlayerName)\missions folder and open it in the editor. Be sure to activate the Markers tab (shortcut F6) to see the mission triggers.

For the trigger with the condition "MAN" countType thisList < 2, you can change the number to what you want. In your case, that would probably be 21. For the On Act field of the same trigger, the unit type TK_INS_Soldier_EP1 can be changed to whatever you like. Here's the OA class name list... https://community.bistudio.com/wiki/ArmA_2_OA:_Infantry#Takistan_Militia and of course Google will reveal other classname lists for ArmA2, and addons usually have a readme with class names as well.

That should be enough to get you started.

Edited by James McKenzie-Smith

Share this post


Link to post
Share on other sites

Thank you so much, i really appreciate the help, If i encounter any problems, ill let you know, btw this will work in MP correct?

---------- Post added at 19:30 ---------- Previous post was at 19:11 ----------

I got to see it in the editor and in game, I am a little new to this sort of thing, and i was hoping to remove the notification and if the enemies are allowed to have multiple waypoints. The mission im planning will have about 50 AI attacking 3 fotified FOB's with blufor defending and falling back into 2 town and one FOB then back to HQ. Can separate fireteams have separate waypoints?

Share this post


Link to post
Share on other sites

To delete the warning, click on the 'Effects' tab at the bottom of the trigger's menu. On the Edit Effects menu that pops up, just delete the text in the text block at the bottom. Just as a note, when you work with triggers, it is sometimes good to put some sort of text in the block so that at least you can tell if the trigger is firing properly. The text can be deleted when you are finished.

To get the new units to move to a new waypoint, use https://community.bistudio.com/wiki/addWaypoint for info.

Also, replace the On Act of the aforementioned trigger with this:

null=[] spawn {"TK_INS_Soldier_EP1" createUnit [getMarkerPos "ENEMYSPAWNAREA", grpNull, "_reinf = this"]; _group = createGroup east; _reinf join _group; "TK_INS_Soldier_EP1" createUnit [getMarkerPos "ENEMYSPAWNAREA", _group]; "TK_INS_Soldier_EP1" createUnit [getMarkerPos "ENEMYSPAWNAREA", _group]; "TK_INS_Soldier_EP1" createUnit [getMarkerPos "ENEMYSPAWNAREA", _group]; "TK_INS_Soldier_AR_EP1" createUnit [getMarkerPos "ENEMYSPAWNAREA", _group]; _wp1 = _group addWaypoint [getMarkerPos 'ENEMY_WAYPOINT', 25]; [_group, 0] setWaypointType "MOVE"; _wp2 = _group addWaypoint [getMarkerPos 'ENEMY_WAYPOINT2', 25]; [_group, 1] setWaypointType "MOVE";}

Note a couple of things: First, I corrected the spelling of 'ENEMY_WAYPOINT'; you will have to do so on the marker in the mission. Also, place a second marker called ENEMY_WAYPOINT2 for the enemies' second waypoint. Also, observe the numbers in red above. Those are radii of the waypoints, which is an easy way of adding an element of randomization to enemy movement. Change it to what suits you. Large numbers work well in countryside, a little smaller is perhaps best in built up areas. To add another waypoint, you would need to add the line...

_wp3 = _group addWaypoint [getMarkerPos 'ENEMY_WAYPOINT3', 25]; [_group, 2] setWaypointType "MOVE"

...after the last semicolon ( ; ) but before the last bracket ( } ). You will also need to add another marker somewhere, called 'ENEMY_WAYPOINT3.

Edited by James McKenzie-Smith

Share this post


Link to post
Share on other sites

Thanks a ton, I'm going to go ahead and implement then test it, if i encounter any problems, I'll let you know! Also, I'm using ACE RU forces. This may be a bit extensive but is it possible to make sure they don't get scopes on their AK's?

==== Edit ===

Alright if it is possible to add one final feature which is kind of important, for the enemy soldiers to only start moving after BLUFOR reach their defensive position, sort of like a trigger and a synchronize to a waypoint

Edited by PirateGaming

Share this post


Link to post
Share on other sites

Thanks a ton for the help, also if you were curious this is the 'layout' of the mission: http://gyazo.com/dd3673ad494d9c9605e186f6ce90eb95

Blufor is supposed to hold their front most position and then fall back to the 2 towns and hold their ground as they get overwhelmed by waves of AI. Anyways, do you think it would be possible to setup a trigger that once activated will permanently activate the spawning of AI?

Share this post


Link to post
Share on other sites

Make the condition of the trigger that we are working on to be something like:

OPFORACTIVATED && "MAN" countType thisList < 2

Then, make another trigger, perhaps activated by bluefor entering the area to be defended, and an On Act with this:

OPFORACTIVATED = true

Add a time delay for people to get into place. As an alternative, have three triggers so that all positions must be entered in order for enemy reinforcements to be activated, in which case the original trigger's condition would look something like this:

OPFORACTIVATED && OPFORACTIVATED2 && OPFORACTIVATED3 && "MAN" countType thisList < 2

The conditions OPFORACTIVATED, OPFORACTIVATED2, and OPFORACTIVATED3 would each be activated by separate triggers. Finally, consider having a radio trigger as well, that the players can activate once they are in position so as to avoid any excessive down time if they enter their defensive perimeters quicker than you expect. The On Act for such a trigger would look like this:

OPFORACTIVATED = true; OPFORACTIVATED2 = true; OPFORACTIVATED3 = true;

Share this post


Link to post
Share on other sites

Okay, im really confused, why not just make one trigger with all this info? Shouldn't activation be set to blufor? The time delay shouldn't be a problem as the AI will spawn a good ~500 meters away. Like with normal way-points just set the side which activates the trigger and sync the trigger to the AI's first way-point and they'll start going.

Share this post


Link to post
Share on other sites

The Opfor activated trigger is designed exclusively to regulate the spawning of opfor units. If you have just one trigger set to activate by 'anyone' being present, it will spawn friendly units as well as enemy, so the Opfor needs it's own trigger there. The Blufor triggers are designed merely to tell the game that the reinforcement system should be activated once the friendly units are in position, and only then. Setting it to 'anyone' would cause the reinforcements to be activated by Blufor OR the odd civilian or stray enemy. You probably don't want that.

If you need to tell the enemies already on the ground to hold back while friendlies move to fall back positions, then that's a whole different issue, and frankly one that is best solved in-game with effective machinegun employment. :)

You probably could do it all in one trigger or using a sqf file or whatever. I do find that separate triggers are easier to debug, and my workflow will therefore influence my suggestions to a certain degree.

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  

×