Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
UrbanXFX

ranged ambushes

Recommended Posts

How do i make AI attack from a distance, lets say they are on a hill and i tell them to attack a base at the bottom of the valley but they keep moving in but i want them to stay in that position to attack them with RPG and MG fire.

"This video is an example"

http://www.youtube.com/watch?v=hDCEnwnyTt4

I'm trying to make something that looks a little like that.

-UrbanXFX

Share this post


Link to post
Share on other sites

Oh my god... I never knew about the enableAttack command. I can't tell you how many times I've been frustrated by AI leaders sending group members on one-man suicide missions, but I just figured there wasn't anything I could do about it. Thank you for enlightening me, CarlGustaffa.

Share this post


Link to post
Share on other sites

How do i use enableAttack and suppressFor on AI groups?

Share this post


Link to post
Share on other sites

I never saw suppessFor, but anyway, do you have them behind sandbags or some other kind of cover?

It can help to use "this disableAI "move";" to keep them in place, and then use enableAI after a trigger eg. a not present trigger or a !alive unitname trigger.

I think also disableAI "target" will stop the leader from assigning targets to everyone.

Edited by Militantsausage

Share this post


Link to post
Share on other sites

I believe disableAI "MOVE" also disables rotation. So an AI can only return fire at the current cone he is looking.

In a SP mission I use this at the assault waypoint for my weapons squad:

{_x suppressFor 240} forEach [uSK6, uSK7]

where uSK6 and uSK7 are the machinegunners.

I set enableAttack as part of units init. May not work directly for you, but my full init for weapons squad leader is:

this forceSpeed 3; {_x setUnitPos "DOWN"; _x disableAI "MOVE"; commandStop [_x]; _pos = _x modelToWorld [0,100,50]; _x doWatch _pos} forEach units this; (group this) enableAttack false

The stopping is just part of waiting on the beach until the transport leaves, there are scripts that kick in later to cancel it. Probably not relevant for your implementation.

Share this post


Link to post
Share on other sites

No, actually they can turn around fine, but they cannot relocate to another position.

I would say disableAI isn't ideal, because then they do not act like real soldiers, but for a long range attack it shouldn't matter too much.

Also you can use doStop, it doesn't stop them from moving completely but makes the unit leave the formation, if you use it with enableattack, you should, in theory, have them moving around to cover but not holding their formation or attacking.

Share this post


Link to post
Share on other sites

No, I just tried. Put your own init to

this allowDamage false

and your enemy init to

this disableAI "MOVE"

Once you walk into his "cone of fire" (about ±30°?) he will shoot, but he won't turn to face you. He will turn his head and look at me, but he won't turn his body so he can shoot at me. This was tested with latest beta.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×