OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: cirkut5732 on 21 Jul 2005, 01:33:35
-
Hi I have loon1 executing loon2 in my mission.
I set the damage of loon2 to almost dead, (So one shot will kill him)
but when loon1 fires at him, He uses his whole clip, I want one shot only!!
Is there a command to give a loon just 1 bullet???
-
It's do-able but you have to keep in mind that a unit can miss, there is a script that could be usefull for that, wait a minute I see if I can find it back...
...
Here you go
http://www.ofpec.com/editors/resource_view.php?id=737
You can modify it to fit your needs.
I've used it in an unfinished mission, it a great script.
-
Thanks again Blanco!
The loon shouldnt miss because the other loon is standing not a foot from him but I guess it is possible even at that range. Ive seen some loons do some real crazy shit!!!!
-
Ok, but who says he's aiming for the head?
I've used it in a cutscene, the executioner had a handgun and I had to make sure it works everytime. ,
I've added an eventhandler to the executioner:
unit1 addEventHandler ["fired",{_this exec "yourscript.sqs"}]
Yourscript.sqs looks like this :
_executioner = this select 0
~0.1
?!alive victim : _executioner removemagazines "yourweapon"; _executioner removeeventhandler ["fired",0];exit
exit
Make sure he doesn't have grenades
:P
-
Give loon2 (the victim) an eventhandler:
loon2 addEventHandler ["killed",{loon1 setCombatMode "BLUE"}]
When loon2 dies loon1 will cease firing. This way you should be able to ensure that loon1 only fires as many bullets as he needs to kill loon2 (if he needs one, he will fire one shot only).
If the eventhandler reacts to slow (sometimes dead units are not registered at once) exchange the eventhandler to
loon1 addEventHandler ["hit",{loon2 setCombatMode "BLUE"}]
Or you could give loon2 an eventhandler "hit" and set him to setDamage 1 when it executes or...
Actually the possibilities are endless. That way you donÂ't need to mix with the contents of the loonÂ's magazines.
-
Actually thats a more gentle way then removing his magazines :)
-
Sorry to keep bugging you guys but I cant seem to get anything to work for this.
Do i put the code right before this code..
terror2 dofire hostage
or do I use the event handler after the code like this
eventhandler code
terror2 dofire hostage
Or can I put this anywhere in my script
I also tried a script on here called SniperShots.sqs with no luck either
Im using a resistance loon with its default weapon witch is a UZI
Thanks again for the time guys!!!
-
Nevermind guys. I got it working.
Thanks again!!!!