Jump to content
Sign in to follow this  
HerrVorragend

Spawn enemy AI (hostile to every side (west, east and indie))

Recommended Posts

Hello!

I want to create enemy groups which attack all sides (opfor, blufor, and independent) but not eachother!

I'm creating units like this, but i can only create them 4 blufor, obfor, etc...

Code:

_group = createGroup indipendent;

_unit = _group createUnit ["I_officer_F", _pos, [], 3, "NONE"];

How can i set the units as enemys for all sides without shooting eachother?

Thanks!

Share this post


Link to post
Share on other sites

Go into the intel portion of the editor and change Independents friendly to: Nobody

hmm. I don't think it's possible... without an addon. If that.

Share this post


Link to post
Share on other sites

It is possible. Do you know the Wasteland-Mission from SA-Matra.

Spawned AI is allways hostile to every side.

EDIT: Maybe you can set a group hostile to a side?

Share this post


Link to post
Share on other sites

It needs to have a side though. You cannot make sideless units (AFAIK). Try this:

[color=#FF8040][color=#1874CD]_aiUnit[/color] [color=#191970][b]spawn[/b][/color]
[color=#8B3E2F][b]{[/b][/color]
   [color=#191970][b]while[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#191970][b]alive[/b][/color] [color=#000000]_this[/color][color=#8B3E2F][b]}[/b][/color] [color=#191970][b]do[/b][/color]
   [color=#8B3E2F][b]{[/b][/color]
       [color=#191970][b]scopeName[/b][/color] [color=#7A7A7A]"unitAliveScope"[/color][color=#8B3E2F][b];[/b][/color]

       [color=#8B3E2F][b]{[/b][/color]
           [color=#191970][b]if[/b][/color] [color=#8B3E2F][b]([/b][/color][color=#000000]_this[/color] [color=#191970][b]distance[/b][/color] [color=#000000]_x[/color] [color=#8B3E2F][b]<[/b][/color] [color=#FF0000]200[/color][color=#8B3E2F][b])[/b][/color] [color=#191970][b]then[/b][/color]
           [color=#8B3E2F][b]{[/b][/color]
               [color=#000000]_this[/color] [color=#191970][b]doTarget[/b][/color] [color=#000000]_x[/color][color=#8B3E2F][b];[/b][/color]
               [color=#000000]_this[/color] [color=#191970][b]doFire[/b][/color] [color=#000000]_x[/color][color=#8B3E2F][b];[/b][/color]
               [color=#191970][b]waitUntil[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#191970][b]sleep[/b][/color] [color=#FF0000]3[/color][color=#8B3E2F][b];[/b][/color] [color=#8B3E2F][b]![/b][/color][color=#191970][b]alive[/b][/color] [color=#000000]_this[/color] [color=#8B3E2F][b]|[/b][/color][color=#8B3E2F][b]|[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#000000]_this[/color] [color=#191970][b]distance[/b][/color] [color=#000000]_x[/color] [color=#8B3E2F][b]>[/b][/color] [color=#FF0000]200[/color][color=#8B3E2F][b]}[/b][/color] [color=#8B3E2F][b]|[/b][/color][color=#8B3E2F][b]|[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#8B3E2F][b]![/b][/color][color=#191970][b]alive[/b][/color] [color=#000000]_x[/color][color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color]
               [color=#191970][b]breakTo[/b][/color] [color=#7A7A7A]"unitAliveScope"[/color][color=#8B3E2F][b];[/b][/color]
           [color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color]
       [color=#8B3E2F][b]}[/b][/color] [color=#191970][b]forEach[/b][/color] [color=#8B3E2F][b]([/b][/color][color=#000000]_this[/color] [color=#191970][b]nearEntities[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"Man"[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]350[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b])[/b][/color][color=#8B3E2F][b];[/b][/color]
   [color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color]
[color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color][/color]

Kudos to Killzone_Kid for his SQF to BBCode Converter.

That way, the unit recognizes any other unit closer than 350 m and will fire at it as long as it's closer than 200 m. (Don't forget to spawn the _aiUnit first.)

Share this post


Link to post
Share on other sites

Ahh okay. Shoot Samatra a Pm asking how it's done :cool:

---------- Post added at 00:40 ---------- Previous post was at 00:39 ----------

Oops, ninja'd

Share this post


Link to post
Share on other sites

I don't think the players in wasteland really are on different sides.

They're most likely all on the same side and/or they're all set as renegades, so the AI attacks them no matter what. Both works in that case.

Share this post


Link to post
Share on other sites
I don't think the players in wasteland really are on different sides.

They're most likely all on the same side and/or they're all set as renegades, so the AI attacks them no matter what. Both works in that case.

No, 'cause you can select the side in mission browser.

Share this post


Link to post
Share on other sites

Read again:

I don't think the players in wasteland really are on different sides.

They're most likely all on the same side and/or they're all set as renegades, so the AI attacks them no matter what. Both works in that case.

Share this post


Link to post
Share on other sites

They can always be moved by script after they get ingame, so in the game's logic, they're enemies.

Share this post


Link to post
Share on other sites
They can always be moved by script after they get ingame, so in the game's logic, they're enemies.

Aha... didn't knew that! Let me give it a shot.

Thx!

Share this post


Link to post
Share on other sites
[...] or they're all set as renegades, so the AI attacks them no matter what.

Not entirely true. AI units won't shoot at renegade civilians. That's not gonna happen as civilians are not an armed side. Plus as you all might know, civilians are the only side running from shots.

I guess it's sort of an ethical boundary, just as in some games you can't kill children right away.

Nevermind, seems like I was doing something wrong there.

Edited by waltenberg

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  

×