Jump to content
Sign in to follow this  
Helmut_AUT

"Survival Type mission" - need help with some script

Recommended Posts

Hi Guys

I'm trying to create a mission where the player is attacked from an endless stream of randomly spawned enemies and has to hold out until his transport arrives. I think most of us have played such missions in other games, and while not entirely realistic they are quite fun.

The story setup could be that the Player's Units (I'm thinking a Platoon-Size Force with High Command enabled) has to protect the former Chenarus President and his Wife who are fleeing the country after a takeover of power by the ChDKz

The action would be in a coastal town, with the player "with his back to the ocean" and waiting for transport boats.

Now here's the question:

To create the incoming enemy hordes I can use the Ambient Combat Module and have it spawn RU or ChDKz units in a random distance and intensity from the player. Not a problem. But when the ACM spawns units, they are in normal "patroling" mode and will move around randomly. I need the spawned units to head for the player position immediately.

So I need a code or trigger implementation that picks up the units spawned by ACM (of which I know no name or ID), then deletes all their waypoints and gives them a new waypoint near the player. Could I do that with a repeat-trigger "OPFOR preset" or something? I seem to remember that a trigger has a list of units which activated it, so in theory shouldn't every spawned unit be able to be handed by that trigger?

Thanks for the help.

Share this post


Link to post
Share on other sites

yeah if you create a trigger that is activated by opfor, then in the onactivation you could put

{_x domove getpos target} foreach list this;

i've never actually tried this but in theory it should work :P

Share this post


Link to post
Share on other sites

So in the case above, you name the marker where the player is 'target'?

Or name the actual player?

Share this post


Link to post
Share on other sites

well no the target would be the name of the player, eg unit1. i wasn't sure whether triggers were only activated on the server but in hindsight i think they are activated on all clients, so you could just replace "target" with player (although in MP game you'd have to specify the one unit obviously).

yeah i dont really use triggers so dont know much about them :P

Share this post


Link to post
Share on other sites
yeah if you create a trigger that is activated by opfor, then in the onactivation you could put
{_x domove getpos target} foreach list this;

i've never actually tried this but in theory it should work :P

this code is wrong the last bit, works perfect but you need the code like this:

{_x domove getpos target} foreach [b]thislist[/b];

Make a trigger 500x500 repeativily - activated by Opfor - timeout 10x10x10 then add that code into the activation then add loads of Opfor inside the trigger! they will start to head towards the unit named target!

Share this post


Link to post
Share on other sites

Okay, so the "foreach thislist" means it sets the command for the array of units that activate the trigger? Timeout 10 to make sure the unit is properly spawned and initialized by ACM I guess?

Will domove "overrule" any waypoints the unit might already have before reciving that order?

I'll test that, it seems like a neat and easy way to get a typical "defend the Alamo" mission going.

Share this post


Link to post
Share on other sites

ArmA2 .fsm < MicroAI < Waypoints Editor < Waypoints Commander < domove-command

Yes, domove "deactivate" other waypoints.

But i wrote a script for ArmA1 where a hill is endless attacked by enemy waves (they can be customize). I can send it to you, just PM me @Helmut_AUT

Share this post


Link to post
Share on other sites

Neo was so kind to send me his script, but it's quite advanced, maybe more than I can handle to adapt it. My editing knowledge is basically how to paste stuff into the init field (I did some more stuff years ago with OFP, but... way past)

While I really appreciate the offer of this script solution, there must be a more simple and elegant way to make this easier with A2's ACM module? I just need a way to start every ACM-spawned unit with that DoMove command.

Is there maybe a way to call a function at set time intervalls that returns a list of all OPFOR groups on the map? That would do.

Edited by Helmut_AUT

Share this post


Link to post
Share on other sites

If you want, i can set up my script for you. You just have to select the location and to build a base or something and playe the players (and briefing etc).

Share this post


Link to post
Share on other sites

I really appreciate the help, but I'd feel stupid creating a mission without knowing what I do. You are right that the ACM offers far less control, but for me I kind of like that because it brings some large randomness. And all ground patrols on RU side are okay for my purpose.

There must be an easy way to get all groups belonging to one side currently in the mission?

Share this post


Link to post
Share on other sites

Sure, place a trigger with Opfor present and multiple activation and name it. Now you can get every opfor unit via

list triggername

Forexample

{_x setdammage 1;}foreach list triggerwichhasallopforinit;

Share this post


Link to post
Share on other sites

That's what I tried at the start of this thread, but the Trigger only fires once and then doesn't reset as long as OPFOR remains present. Since the trigger encircles all the area, there is always OPFOR present, and as far as I know a multiple activation trigger requires it's condition to be false before it will be able to fire again.

I'd need something like a time-controlled loop, for example ever 30 seconds either the trigger needs to be reset so it can fire again - or isn't there some generic scripting call to query the engine for all units from one side currently alive?

Thanks that you are still trying to sort me out, even though I prefer the boneheaded way of doing it with ACM ;)

Share this post


Link to post
Share on other sites

Try this:

while {GameIsRunning} do {

{_x domove getpos player;}foreach list triggerwichhasallopforinit;

sleep 5;
};

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  

×