OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Serial Killer on 11 Nov 2005, 10:11:51
-
How can I change unit's firing mode?
-
Is this what you want?
http://www.ofpec.com/editors/comref.php?letter=S#setCombatMode
-
No. I mean the gun. I want the A.I. to change its firing mode to burst.
-
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..
-
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:
murderer2 fire ["M16","Burst"]
murderer2 fire ["AK74","Burst"]
-
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:
this addEventHandler ["fired", {_this exec "firemore.sqs"}]
firemore.sqs:
_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
-
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
-
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
-
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
-
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?