Jump to content
sizraide

Make group of AI reveal to group of players

Recommended Posts

Hello, i'm creating a COOP mission.

I want a group of AI to reveal to a group of players
 

Quote

_players = players;

 

{

    _x enableAI "MOVE";

    _x reveal _players;

} forEach [a1,a2,a3,a4,a5];

sleep 3;

 

 

This is my script but it doesn't work.
 

I have this in the squad leader of the players group

Quote

players = group this;


I want to have a trigger where when players walk into it.
It runs a script and it unhides a few AI and immediately makes the AI aware of the group of players so the AI will immediately start shooting the group of players.

Share this post


Link to post
Share on other sites

You did

Object reveal group

But as pf biki there is not such syntax but there is

Group reveal object

  • Like 1

Share this post


Link to post
Share on other sites
44 minutes ago, sarogahtyp said:

You did

Object reveal group

But as pf biki there is not such syntax but there is

Group reveal object


It doesn't work for some reason

Share this post


Link to post
Share on other sites
48 minutes ago, sarogahtyp said:

You did

Object reveal group

But as pf biki there is not such syntax but there is

Group reveal object


If I replace _players with just player will it reveal each player to each ai in forEach?

Share this post


Link to post
Share on other sites

Perhaps you need to read sarogahtyp's reply a little more closely:

4 hours ago, sarogahtyp said:

You did

Object reveal group

But as pf biki there is not such syntax but there is

Group reveal object

 

Looking at the command reveal would explain his reply in detail.

Share this post


Link to post
Share on other sites
5 minutes ago, beno_83au said:

Perhaps you need to read sarogahtyp's reply a little more closely:

 

Looking at the command reveal would explain his reply in detail.

"If toWhom is a unit, unit's group is considered"

This means the player's group is considered?

so I can just type
_x reveal player;

and the player's group is already considered.

Share this post


Link to post
Share on other sites
4 hours ago, sizraide said:

I want a group of AI to reveal to a group of players


makes the AI aware of the group of players

 

Wait, which one is it? Do you want to reveal the players to the AI?

Share this post


Link to post
Share on other sites
Just now, beno_83au said:

 

Wait, which one is it? Do you want to reveal the players to the AI?

No, I want to reveal a group of players to a bunch of AI's

Share this post


Link to post
Share on other sites

Ok, in that case let's start with:

_players = players;

You've declared players as a group (in the leaders init) - https://community.bistudio.com/wiki/group. So _players is a group. Keep that in mind.

 

 

50 minutes ago, sizraide said:

"If toWhom is a unit, unit's group is considered"

This means the player's group is considered?

so I can just type
_x reveal player;

and the player's group is already considered.

 

toWhom is the first parameter, which here is _x. The group of a1, a2, etc, is considered, and in this case you are just revealing the player to the group of a1, then a2, then a3 and so on, because of how you've written it. But even in your original example you've just using a group (_players) instead of an object, so it was failing at that point. So........

toWhom reveal target

toWhom: Object or Group which receives revealing information
target: Object which is revealed

You need to write it so that an object or group has an object revealed to them:

{
	_aiGroup reveal _x;
} forEach (units _playerGroup);

With _aiGroup and _playerGroup defined correctly, that will reveal each unit in the player's group to the AI group.

Share this post


Link to post
Share on other sites
19 minutes ago, beno_83au said:

Ok, in that case let's start with:


_players = players;
 

You've declared players as a group (in the leaders init) - https://community.bistudio.com/wiki/group. So _players is a group. Keep that in mind.

 

 

 

toWhom is the first parameter, which here is _x. The group of a1, a2, etc, is considered, and in this case you are just revealing the player to the group of a1, then a2, then a3 and so on, because of how you've written it. But even in your original example you've just using a group (_players) instead of an object, so it was failing at that point. So........


toWhom reveal target

toWhom: Object or Group which receives revealing information
target: Object which is revealed
 

You need to write it so that an object or group has an object revealed to them:


{
	_aiGroup reveal _x;
} forEach (units _playerGroup);
 

With _aiGroup and _playerGroup defined correctly, that will reveal each unit in the player's group to the AI group.


How can I define it correctly?

Just placing _aiGroup = group this; and _playerGroup = group this; in the squadleaders init fields?

Share this post


Link to post
Share on other sites

There's a few ways, but probably the easiest is in the init of each group leader, as you've said. Doing it this way though, you need to define them as global variables: https://community.bistudio.com/wiki/Variables#:~:text=two main scopes%3A-,Global Scope,-A global variable. So just removing the _ from _aiGroup and _playerGroup is enough, as the _ treats them as local (explained in that link). I only used local variables to demonstrate what info needed to go where.

Share this post


Link to post
Share on other sites
39 minutes ago, beno_83au said:

There's a few ways, but probably the easiest is in the init of each group leader, as you've said. Doing it this way though, you need to define them as global variables: https://community.bistudio.com/wiki/Variables#:~:text=two main scopes%3A-,Global Scope,-A global variable. So just removing the _ from _aiGroup and _playerGroup is enough, as the _ treats them as local (explained in that link). I only used local variables to demonstrate what info needed to go where.


Got it, it works.

 

Thanks!

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

×