Jump to content
PCanas

Non-Reacting AI & AI Respawning

Recommended Posts

Greetings! :)

 

I'm making a shooting range with 4 "lanes" of static targets (balloons) and another 4 of moving infantry.

In the case of infantry, it will have about 4 or 5 units per "lane", each with a set fo waypoints, most of them just a back and forth pattern (A <-> B), and maybe one on a square pattern.

 

 

Now the problems...

 

1- The ballons will obviously be destroyed when hit. I need them to respawn on position.

2- The infantry will obviously react when beeing shot or when they see a player. I need to avoid this.

3- The infantry will also die when hit by the shot... obviously 😄

 

So... I have to make a script (do I?)... of which I know nothing about...

 

Basically I need:

- AI that doesn't react to anything, just keeps going through it's waypoints, even if WW 3 starts next to it.

- AI that respawns on their original starting position and restarts their specific waypoints.

- Balloons that respawn on their position (Z coordinates important here, since they'll be on top of something)

- And the cherry on top: make all this available through an option on the action menu that shows up when get close to a certain item. (per lane)

 

All this is on a MP mission that will be run on a dedicated server.

 

Thank you for the help :)

Share this post


Link to post
Share on other sites

I got the ballons spawn kinda solved...

 

If I use this

 

Quote

"Land_Balloon_01_air_F" createVehicle getMarkerPos "b_1_1";
"Land_Balloon_01_air_F" createVehicle getMarkerPos "b_1_2";
"Land_Balloon_01_air_F" createVehicle getMarkerPos "b_1_3";
"Land_Balloon_01_air_F" createVehicle getMarkerPos "b_1_4";

 

I get the balloons to respawn, but they respawn about 1 or 2 m right to the marker, except for the last, that goes left of the marker.

They're supposed to spawn on top of a barrell.

I'm using epty markers as... well, markers.

 

Suggestions?

Share this post


Link to post
Share on other sites

For you AI units, you can place some markers for path and script. Here I spawn on a trigger (radio A or else). Example:


 

0 = thisTrigger spawn {
  for "_i" from 0 to 10 do {
     _man = creategroup civilian createUnit ["O_Soldier_F",getpos _this,[],0,"none"];
     [_man] join _man;
     {_man disableAI _x} forEach ["fsm","checkvisible"];
     _wp = group _man addWaypoint [getMarkerPos "mk1",0];
     _wp setWaypointBehaviour "CARELESS" ;
     sleep 1
  }
}

 

 

Share this post


Link to post
Share on other sites
23 hours ago, pierremgi said:

For you AI units, you can place some markers for path and script. Here I spawn on a trigger (radio A or else). Example:


 


0 = thisTrigger spawn {
  for "_i" from 0 to 10 do {
     _man = creategroup civilian createUnit ["O_Soldier_F",getpos _this,[],0,"none"];
     [_man] join _man;
     {_man disableAI _x} forEach ["fsm","checkvisible"];
     _wp = group _man addWaypoint [getMarkerPos "mk1",0];
     _wp setWaypointBehaviour "CARELESS" ;
     sleep 1
  }
}

 

 

 

Can you describe what exactly that does? I know very little of scripting.

 

Also, another piece of info I think is important: the infantries are individuals, not a team. So, even if the range has 4 soldiers, they're 4 separate entities, each with his waypoint.

The respawn would be better if available from an action menu on an object (a sign, for example).

Share this post


Link to post
Share on other sites
On 8/9/2020 at 2:19 PM, beno_83au said:

https://community.bistudio.com/wiki/createVehicle and look down under Alternative Syntax. The "Special" parameter could help you out with placement. Either that, or spawn them at [0,0,0] then move them afterwards. Otherwise they will be created in a clear/empty position.

 

I'm using this

 

"Land_Balloon_01_air_F" createVehicle getMarkerPos "b_1_1", 0, "CAN_COLLIDE";

I don't get any error, but the balloons still spawn about 2m to the left/right where they were supposed to...

The Z of the marker is 0, could that be the problem?

Share this post


Link to post
Share on other sites
2 hours ago, PCanas said:

 

Can you describe what exactly that does? I know very little of scripting.

 

In on act field of a trigger (can be set to TRUE or radio A or whatever you want as condition), you write this code.

On activation (so, at start if you replaced this by TRUE in cond. field) , units will spawn:

- type "O_soldier_F" but you can choose what you want (even randomize the class from an array of classes);

- side is determined by the group created (I know I did that in one line);

- you need to make this unit join its group (or itself) to make its side effective. If not, the side is the default side of the type of unit (see explanation in createUnit)

- units are spawning on position of the trigger, but you can offset that with a little formula;

   instead of getpos _this (_this refers to thisTrigger), you can write :    _this getPos [10* (-i mod 4), 45];

   where _this is still the trigger, 10*_i will add 10 m between each units, mod 4 is here for modulo so 5 is same as 0, 6 as 1... and 45 is the azimuth of the line from trigger. you can also add several triggers like this one.

- I added a waypoint for this (unique unit) group to make it move to marker ('"mk1" here). You can add all markers/waypoints you want, and even cycle for the last one.

I slept 1 sec for spacing spawn. Feel free to change that.

 

Also I created 11 units (0 to 10) I didn't care for any figure. You can randomize  for "_i" from 0 to (floor random 12) + 2 do {....

CARELESS makes the units quite and non-aggressive against enemies (except throwing grenades because it's a lack in Arma's engine)

I also disabled AI capabilities for running FSM (Arma engine), and their ray-casting, just to avoid some extra behaviors.

 

For respawn, what I suggest you is to delete the corpses and rearm the trigger (so, it should be repeatable and de-act-able)

Share this post


Link to post
Share on other sites

Speaking specifically to the alternative syntax, look at the description and look at the examples of it's use (#3 and #4). All the parameters must be contained within an array:

 

createVehicle ["2S6M_Tunguska", getMarkerPos "marker1", ["marker2", "marker3"], 0, "NONE"];

 

And while markers, placement and special are optional, you have to include them if you want to use one of the later variables. So you can't leave out placement and then include special. E.g:

 

["2S6M_Tunguska", getMarkerPos "marker1", "NONE"] - NO

["2S6M_Tunguska", getMarkerPos "marker1", [], 0, "NONE"] - YES

 

So your code would need to look like this:

createVehicle ["Land_Balloon_01_air_F", getMarkerPos "b_1_1", [] , 0, "CAN_COLLIDE"];

 

 

You can also put it all in a forEach loop:

{
 createVehicle ["Land_Balloon_01_air_F", getMarkerPos _x, [] , 0, "CAN_COLLIDE"];
} forEach ["b_1_1","b_1_2","b_1_3","b_1_4"];

 

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

×