OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Sexy_Beast on 05 Sep 2004, 14:51:01

Title: hit and miss
Post by: Sexy_Beast on 05 Sep 2004, 14:51:01
im tired of getting head shot by Ai's 300m distance i there was a script in ofpec that would make Ai's miss but i cant remember the name of it  ???
Title: Re:hit and miss
Post by: Ace Productions on 05 Sep 2004, 15:11:07
I've prepared a small script to use in a mission I'm making so I thing it's time to BETA test it!  ;)
Title: Re:hit and miss
Post by: Mud_Spike on 05 Sep 2004, 15:16:52
The higher their skill, the better they aim, so lower it, that'll give you a break.

Also, you can set a unit's damage to a negative value, that'll make their aim alittle bit wobbley for some reason.
Try 'someEnemy SetDammage -1'.

Last, you could use HD (High Dispersion) weapons/mags.
All JAM weapons/mags come in both a standard and HD version.
Title: Re:hit and miss
Post by: Sexy_Beast on 05 Sep 2004, 18:34:38
i cant open ur file i need some thing named chopse.exe
Title: Re:hit and miss
Post by: General Barron on 05 Sep 2004, 20:50:00
Use notepad.
Title: Re:hit and miss
Post by: Ace Productions on 09 Sep 2004, 00:17:23
@Sexy_Beast

Did the scipt work as you expected?
Title: Re:hit and miss
Post by: Wadmann on 10 Sep 2004, 21:35:24
@ Ace Productions:

I have not tried your script as I am unsure as how to implement it. Is it used in conjuction with the "fired" eventhandler? IIRC the fired EH does provide the five five parameters used in your script (shooter, weapon, muzzle, mode, and shell) but how would one call your script? Something like:

Code: [Select]
this AddEventHandler ["fired", {[_x] exec "scriptname.sqs"}]


Thanks in advance for your reply.

                                                        Wadmann
Title: Re:hit and miss
Post by: Ace Productions on 11 Sep 2004, 22:49:04
Ok, here we go...

If your unit is called "MG42" you can write the following in the Init.sqs file, in a trigger, or in any script:

MG42 AddEventHandler ["fired",{_this Exec "scriptname.sqs"}]

If you are going to use it in the unit's init line then:

this AddEventHandler ["fired",{_this Exec "scriptname.sqs"}]

Good luck mate!



Title: Re:hit and miss
Post by: andywt on 13 Sep 2004, 21:10:43
Ace Productions, this is excellent.

Please can you explain in detail what each part of your script does?

Thanks in advance.
Title: Re:hit and miss
Post by: Ace Productions on 14 Sep 2004, 06:11:59
I'm glad you like it andywt.

Just give me a couple of days cause I'm updating it. That was just the initial idea. Different weapons will vary in inaccuracy and the inaccuracy will be base on the skill level you select for your unit.  8)
Title: Re:hit and miss
Post by: johnnyboy on 23 Sep 2004, 02:54:24
This script is clever (i.e., intercepting the bullet and resetting its pos and velocity a little randomly).

A technique I've used is attach an invisible infanrtry target to units in a loop that randomly moves (setpos) that invisible target around the player.  This makes the AI sometimes shoot at you and sometimes at the invisible target near you, simulating near misses.

If you use an invisible armored target, then you get RPGs, tanks and choppers firing on you, which can really get your heart going!

I'm using Lester's invisible target addon.
Title: Re:hit and miss
Post by: Ace Productions on 28 Sep 2004, 22:21:03
That's quite a nice idea actually!

Can you post a sample so we can try it out?
Title: Re:hit and miss
Post by: johnnyboy on 29 Sep 2004, 06:25:51
Here's a little sample mission for the editor, plus one script "attach_target.sqs".  In this script a civilian paces in front of two buses, while some soldiers shoot at an invisible target attached to the civilian.  He gets killed when the invisible target happens to get placed directly between him and the shooter.

After 30 seconds, a trigger moves an invisible armored target to the civilians position.  This causes the soldier AI to fire their laws.

The example assumes you have Resistance and the Invisible Targets addon by Lester (InvTargets.pbo).
Title: Re: hit and miss
Post by: andywt on 08 Mar 2013, 19:41:56
Please could someone post the scripts and/or the mission examples that were once in this thread.