Home   Help Search Login Register  

Author Topic: How to change unit's firing mode?  (Read 1087 times)

0 Members and 1 Guest are viewing this topic.

Serial Killer

  • Guest
How to change unit's firing mode?
« on: 11 Nov 2005, 10:11:51 »
How can I change unit's firing mode?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:How to change unit's firing mode?
« Reply #1 on: 11 Nov 2005, 12:35:35 »

Serial Killer

  • Guest
Re:How to change unit's firing mode?
« Reply #2 on: 11 Nov 2005, 15:45:37 »
No. I mean the gun. I want the A.I. to change its firing mode to burst.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:How to change unit's firing mode?
« Reply #3 on: 11 Nov 2005, 18:08:14 »
That's controlled mainly by things in the config, so even if you can get the AI to change the mode to burst it will not use it..

But anyhoo, try using selectWeapon and "burst" although I'm sure it will not work..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:How to change unit's firing mode?
« Reply #4 on: 11 Nov 2005, 18:28:49 »
Try fire:

unit fire array

Operand types:
unit: Object
array: Array
Type of returned value:
Nothing
Description:
Unit will fire from given weapon. Argument has format [muzzle, mode, magazine] or [muzzle, mode].

Example:
soldierOne fire ["throw","SmokeShell","SmokeShell"]

One of the modes for some wepaons is burst, as follows:

Code: [Select]
murderer2 fire ["M16","Burst"]
murderer2 fire ["AK74","Burst"]
« Last Edit: 11 Nov 2005, 20:27:45 by THobson »

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:How to change unit's firing mode?
« Reply #5 on: 11 Nov 2005, 19:35:57 »
Does using fire with a firing mode really work? I recall having some problems with it, and ending up using a loop which forces the unit to fire repeatedly. I might not remember it correctly and I can't test it now because I should first boot another OS which I am not willing to do now...

 :joystick:

Ooh look what meh found from a Windows partition:

Code: [Select]
this addEventHandler ["fired", {_this exec "firemore.sqs"}]
firemore.sqs:

Code: [Select]
_fire = 0

#riflefire
~1
(_this select 0) fire [_this select 1]
_fire = _fire + 1
? _fire < 10 : goto "riflefire"

Can someone confirm does that work, and how?

 ;D

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:How to change unit's firing mode?
« Reply #6 on: 11 Nov 2005, 20:24:05 »
The two lines of code I included in my previous post are taken from an actual script that does what I want it to do.

Note that the command fire works in two different ways.  See:
http://www.ofpec.com/editors/comref.php?letter=F#fire
« Last Edit: 11 Nov 2005, 20:27:27 by THobson »

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:How to change unit's firing mode?
« Reply #7 on: 12 Nov 2005, 14:26:22 »
Looking at the script I posted yesterday... hmm I suspect it's not very good. But it's a start if someone wants to force AI to fire more after firing the first shot...

:)

THobson, how do you exactly make AI's to shoot at a target using a certain firing mode and maintaining full control when the AI fires his weapon? It is not that obvious because testing with doTarget and doFire gives only a headache. Because they are only orders for the AI, not immediate commands to pull the trigger.

I have a flashback that I managed to do this in the past but I can't find any evidence from my HDD...

 :P

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:How to change unit's firing mode?
« Reply #8 on: 12 Nov 2005, 14:45:12 »
Quote
THobson, how do you exactly make AI's to shoot at a target using a certain firing mode and maintaining full control when the AI fires his weapon?
I have no idea.  Telling the unit to fire in the way I show above causes them to fire in the air.  If this is for a cutscene then give the unit that is firing a {fired} Event Handler that does bad stuff to the target.  You obviously cannot have the shooter in camera when this happens unless you want it to be like a warning shot - in which case you don't need the EH

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:How to change unit's firing mode?
« Reply #9 on: 12 Nov 2005, 15:42:54 »
Yeah well that's what I meant with my first post in this thread with having a problem with fire... my approach was to let the AI first start shooting at a target and then make him fire few extra rounds which will also be fired in the direction of the target. I recall I got that to work but where is that test mission I am just wondering... or was it just a dream?