Home   Help Search Login Register  

Author Topic: Making a soldier AI fire automatics,...how?  (Read 1656 times)

0 Members and 1 Guest are viewing this topic.

Offline Chammy

  • Members
  • *
  • I'm a llama!
Making a soldier AI fire automatics,...how?
« on: 30 Sep 2004, 11:50:39 »
I was wondering how I can make enemy or West AI fire an automatic in bursts or such?Like i have one with the usmc automatic squad weapon, how can I get him to fire off in short bursts?I saw an example mission made by GIMBAL for his MINIMI demonstration and noticed his AI was firing automatic.Anyone have any suggestions? :-[

Maclav

  • Guest
Re:Making a soldier AI fire automatics,...how?
« Reply #1 on: 30 Sep 2004, 15:38:57 »
this should work this way : unit fire [weapon,mode] but it doesn`t. You can try this script (more primitive, but works):
create 2 scripts fire.sqs :
s1 dotarget s1target
s1fire=true
[] exec "count.sqs"
#loop
s1 fire "hk"
?s1fire : goto "loop"
count.sqs
~2
s1fire=false

in this case, a soldier named s1 fires from HK at a target called s1target during 2 seconds. I don`t know why the solider doesn`t fire at the target, but he fires upwards.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Making a soldier AI fire automatics,...how?
« Reply #2 on: 30 Sep 2004, 15:46:06 »
The fire command just makes him fire in the air.   If you want a loon to fire at a target you must use the command doFire, preceded by a doTarget command.

You could streamline the script to something like this

stopFire=false

#loop
s1 doTarget s1target
s1 doFire s1target
~2
? stopFire : exit
goto "loop"

There is an invisible target addon, which sometimes proves useful in circumstances like this.

If you've seen something you like in a mission and want to know how it's done, unpbo the mission and look.
Plenty of reviewed ArmA missions for you to play

Maclav

  • Guest
Re:Making a soldier AI fire automatics,...how?
« Reply #3 on: 30 Sep 2004, 15:54:41 »
ok but how to make a "loon" fire at a target with bursts or not?
with dofire, he uses the available mode, with hk for example, he always fires using the automatic mode.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Making a soldier AI fire automatics,...how?
« Reply #4 on: 30 Sep 2004, 16:02:31 »
Ah, well, if I knew that I would have said so.   :p

HK doesn't have a burst mode, its just auto or single shot.   I don't even know how you could control which one of these he used.    

You could perhaps play with the delay in the script to fake short bursts ... maybe something like this

stopFire=false

#loop
? stopFire : exit
s1 doTarget s1target
s1 doFire s1target
~0.3
s2 doTarget objNull     <---- this line is a guess
~3
goto "loop"
Plenty of reviewed ArmA missions for you to play

Offline Chammy

  • Members
  • *
  • I'm a llama!
Re:Making a soldier AI fire automatics,...how?
« Reply #5 on: 30 Sep 2004, 22:24:59 »
Yikes! :-\

Well i'll try both to see.Hmm, unpbo a mission?  I never thought of that.I need to ask GIMBIL also, see what he thinks cause he's got that one exp  mission and has his loon firing at full auto.Well I'l try these and see what happens.Thnx.

Sneaker

  • Guest
Re:Making a soldier AI fire automatics,...how?
« Reply #6 on: 01 Oct 2004, 21:24:52 »
Quote
The fire command just makes him fire in the air.

If its a cutsence, thers an easy way to get around this, just use the switchmove command.

For example if your bloke is lying, use something like

guy switchmove "LyingStillV1"
~0.001
guy fire "M16"

then switchback to standard animation so he can continut or pause /loop a script to continue.  

or if hes standing

guy setunitpos "up"    **
guy switchmove "CombatOptics"
~0.001
guy fire "M16"
etc

** (so he doesnt go straight down after u set the animation, if theres enemy about )


This will make the bloke fire in the direction hes facing rather than firing in the air. Although i havent tested it thorouthly I have used it quite effectivly for things like cutscenes when you want to appear to be giving suppressing fire etc when theres no enemy present.  

If you use Toadlifes simple Face Direction script it will work even better, allowing you to face presicely and make ai do things like look like there actually shooting at those blue targets

[and without the need for invisible target addon]


Sorry i couldnt answer your main question, but this might help in some way.

Offline Chammy

  • Members
  • *
  • I'm a llama!
Re:Making a soldier AI fire automatics,...how?
« Reply #7 on: 27 Nov 2004, 09:59:18 »
Thanks a bunch guys!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Making a soldier AI fire automatics,...how?
« Reply #8 on: 27 Nov 2004, 20:27:02 »
A few points on doFire:

1. I does seem to work without first doing a doTarget
2. Giving the command once is enough for the AI to keep shooting if the target is not dead
3. If the target is in a vehicle they will not fire.  So for Bill to fire at Jim use: Bill doFire vehicle Jim  (vehicle Jim == Jim if he is not in a vehicle)

If you want a burst for a cutscene (exactly the problem I had a couple of weeks ago) and you don't mind not seeing the guy fire:
de_pbo  the file sounds.pbo
convert the relevant sound file from .wcc to .wav
convert the .wav to .ogg
put the file in the sound folder of your mission
specify the sound in description.ext
do a playsound in the script.

I did all that and then decided to stay with single shots!


Offline Chammy

  • Members
  • *
  • I'm a llama!
Re:Making a soldier AI fire automatics,...how?
« Reply #9 on: 23 Apr 2005, 01:00:22 »
No way, so you mean, I can just make a sound in ogg format and then just put it in the mission folder with a script and activation on to activavte it?    
 

Now with that said, I was wondering if you can help me here. I wanted to make more combat ambience or just some sounds that will trigger when I want thm to , OR , just add some extra sounds into OFP and choose them from the trigger catagory. any idea how?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Making a soldier AI fire automatics,...how?
« Reply #10 on: 23 Apr 2005, 08:47:34 »
Yes.

Read Bloodmixer's sound tutorial in the Ed Depot.
Plenty of reviewed ArmA missions for you to play

Offline Chammy

  • Members
  • *
  • I'm a llama!
Re:Making a soldier AI fire automatics,...how?
« Reply #11 on: 20 Jul 2005, 09:52:51 »
You know what, I just noticed that GIMBAL's loon isnt firing automatic, my bad guys, sorry, I noticed that the soldier was firing in very quick progression trigger pulls.  mean very quick. Hmm, ugh, I need more coffee.

Offline Blanco

  • Former Staff
  • ****
Re:Making a soldier AI fire automatics,...how?
« Reply #12 on: 21 Jul 2005, 00:41:39 »
If its a cutsence, thers an easy way to get around this, just use the switchmove command.

For example if your bloke is lying, use something like

guy switchmove "LyingStillV1"
~0.001
guy fire "M16"

then switchback to standard animation so he can continut or pause /loop a script to continue.  

or if hes standing

guy setunitpos "up"    **
guy switchmove "CombatOptics"
~0.001
guy fire "M16"
etc

** (so he doesnt go straight down after u set the animation, if theres enemy about )


This will make the bloke fire in the direction hes facing rather than firing in the air. Although i havent tested it thorouthly I have used it quite effectivly for things like cutscenes when you want to appear to be giving suppressing fire etc when theres no enemy present.  

If you use Toadlifes simple Face Direction script it will work even better, allowing you to face presicely and make ai do things like look like there actually shooting at those blue targets
Sorry i couldnt answer your main question, but this might help in some way.

Sneaker, I had the same idea a while ago and tried it exactly the same way you tells us but it never worked for me...

When I put put him in animation followed by a fire command, the unit will execute the switchmove command first, but after that the unit still fires straight up in the air.
The delay between the switchmove and the fire command doesn't matter because he will only fire when the switchmove animation is done, for  "LyingStillV1" thats more then 2sec.


Can you attach a working example please, because I can't figure out how this work.

 
Search or search or search before you ask.