OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Resources Beta Testing & Submission => Topic started by: GeneralCoder on 14 Apr 2003, 17:38:23

Title: Fire dispersion script for AI
Post by: GeneralCoder on 14 Apr 2003, 17:38:23
Hi I made a script wich makes AI(super AI) less accurate.
(I just hate when they shoot me from 200meters whit one shot)
Heres the example mission below if you are intrested.

And I know some made allready this but... well you can decide wich one's better to use Im not saying anything.
Title: Re:Fire dispersion script for AI
Post by: Yahoo on 14 Apr 2003, 18:21:02
Wow  :o :o :o this script kicks a**se precisly what i have been waiting for thank you thank you thank you plus i couldn't detect any errors

 ;D 8) ;D ;)
Title: Re:Fire dispersion script for AI
Post by: GeneralCoder on 15 Apr 2003, 11:54:51
Wow  :o :o :o this script kicks a**se precisly what i have been waiting for thank you thank you thank you plus i couldn't detect any errors

 ;D 8) ;D ;)

Nice to hear that I did't do it for nothing  :)

But theres one thing you should know. Becose I just noticed that if you but this script to a machinegunner (the mounted mgs) the accuracy doesn't decrease much becose the mg's bullet is too fast or shometing. I gotta look for this if there's anything to do.
Title: Re:Fire dispersion script for AI
Post by: Yahoo on 15 Apr 2003, 16:15:41
Yeah i know i meant to mention that but too exicted plus could you change it so that hand held rocket launchers+grenade launcher are not affected or affected as severily
Title: Re:Fire dispersion script for AI
Post by: GeneralCoder on 15 Apr 2003, 20:24:16
Yeah i know i meant to mention that but too exicted plus could you change it so that hand held rocket launchers+grenade launcher are not affected or affected as severily

Ok now the launchers are more accurate becose dispersion is counted from their speed. But tell if u need them to be even more accurate.
And about that problem what I meantioned earlier.. I dont think there's nothing to do about it, but I think it's good as it is becose other wise the game would become too easy.

I updated the attachment.
Title: Re:Fire dispersion script for AI
Post by: Yahoo on 15 Apr 2003, 20:34:37
Quote
Ok now the launchers are more accurate becose dispersion is counted from their speed. But tell if u need them to be even more accurate.


just a 30% increase needed then they should be fine  
 
plus could you do it so that the taqnks aren't affected as badly cos they can hardly hit anything with any of there guns and especially there machinegun
Title: Re:Fire dispersion script for AI
Post by: Yahoo on 18 Apr 2003, 14:44:04
BUMP
Title: Re:Fire dispersion script for AI
Post by: GeneralCoder on 18 Apr 2003, 23:07:54
just a 30% increase needed then they should be fine  
 
plus could you do it so that the taqnks aren't affected as badly cos they can hardly hit anything with any of there guns and especially there machinegun


I though it was good that they wont hit that much.  :)
Ok I see what I can do but I cant get hold of the code right now so you have to wait a couple days.
Title: Re:Fire dispersion script for AI
Post by: Yahoo on 19 Apr 2003, 11:29:18
No sorry about that i meant there machine gun

and i would make all these changes my self but i am a scripting n00b
Title: Re:Fire dispersion script for AI
Post by: GeneralCoder on 26 Apr 2003, 19:07:44
No sorry about that i meant there machine gun

and i would make all these changes my self but i am a scripting n00b
Sorry for late reply but I've been busy. Is this script what I attached ok? It works for me. :)
Title: Re:Fire dispersion script for AI
Post by: Yahoo on 26 Apr 2003, 19:22:07
Yep it works fine  8) want my advice then submit it as  to the Editors Depot ;)

Title: Re:Fire dispersion script for AI
Post by: O Neil on 29 May 2003, 00:18:51
Hey, just thought i'd but in and say that this script RULES !

O Neil ;)
Title: Re:Fire dispersion script for AI
Post by: Yahoo on 29 May 2003, 00:31:45
I think it is better then the athoer one that is/was in development using setpos
Title: Re:Fire dispersion script for AI
Post by: General Barron on 16 Jul 2003, 22:06:10
Funny, I was working on yet another script like this. Only mine will be much better when it's finished  :P

Just thought I'd mention that there is a command that will find the speed of an object, without manually finding the magnitude of the velocity vector. Its the: speed object command.

Just thought I'd point that out. I figure it might make the script run just an eency weency bit faster, which might make a difference if you have a couple hundred units all firing off their weapons at the same time.
Title: Re:Fire dispersion script for AI
Post by: GeneralCoder on 21 Jul 2003, 21:20:51
Funny, I was working on yet another script like this. Only mine will be much better when it's finished  :P

I really hope so becose this doesn't please me much. The setvelocity part executes too late probably becose Nearestobject is so slow... so do you have any idea to solve that?
Title: Re:Fire dispersion script for AI
Post by: GeneralCoder on 23 Jul 2003, 17:36:00
Ok here's new version wich uses the speed function. It might be better dunno.
Title: Re:Fire dispersion script for AI
Post by: CptBravo on 25 Jul 2003, 21:35:30
Hey General,

I have a new b question .. I am using a creat units script. How do I add this script to the created units?? I want to add it to certain units.

The demo mission was impressive!
Title: Re:Fire dispersion script for AI
Post by: CptBravo on 25 Jul 2003, 22:21:12
Its the spray script that I am trying to add to each individual created unit.

Here is what I have:

;begin script

_pos = _this select 0
_grp = _this select 1

"sdoc_uce_russianOfficer" createunit [getpos _pos,_grp,"",1,"LIEUTENANT"]
"sdoc_uce_russianMedic" createunit [getpos _pos,_grp,"",0.5,"SERGEANT"]
"sdoc_russianMachinegunnerRPK74" createunit [getpos _pos,_grp,"",0.2,"CORPORAL"]
"sdoc_uce_russianHvyGrenadier" createunit [getpos _pos,_grp,"",0.2,"CORPORAL"]
"sdoc_uce_russianGrenadier" createunit [getpos _pos,_grp,"",0.2,"CORPORAL"]
"sdoc_uce_russianRPGsoldier" createunit [getpos _pos,_grp,"",0.2,"CORPORAL"]
"sdoc_uce_russianSniper" createunit [getpos _pos,_grp,"",0.8,"CORPORAL"]
"sdoc_uce_russianSoldier" createunit [getpos _pos,_grp,"",0.2,"PRIVATE"]
"sdoc_uce_russianSoldier" createunit [getpos _pos,_grp,"",0.2,"PRIVATE"]
"sdoc_uce_russianSoldier" createunit [getpos _pos,_grp,"",0.2,"PRIVATE"]
"sdoc_uce_russianSoldier" createunit [getpos _pos,_grp,"",0.2,"PRIVATE"]
"sdoc_uce_russianSoldier" createunit [getpos _pos,_grp,"",0.2,"PRIVATE"]
~1
_units = units _grp
_grp setformation "LINE"
_grp setbehaviour "AWARE"
_grp setcombatmode "GREEN"
"_x allowfleeing 0" foreach _units

#loop
?(("Alive _x" count _units) == 0): "deletevehicle _x" foreach _units; exit
~random(10) + 10
goto "loop"

Where does your script go??

Any help is grrrrrrrreatly appreciated!

Title: Re:Fire dispersion script for AI
Post by: GeneralCoder on 26 Jul 2003, 16:55:07
Hey General,

I have a new b question .. I am using a creat units script. How do I add this script to the created units?? I want to add it to certain units.

The demo mission was impressive!

Put this to their init string: (between the " and ")
this addeventhandler["fired",{_this exec"fired.sqs"}]
like this: (note there's { and } instead of ")

"sdoc_uce_russianSoldier" createunit [getpos _pos,_grp,{this addeventhandler["fired",{_this exec"fired.sqs"}]
},0.2,"PRIVATE"]

Title: Re:Fire dispersion script for AI
Post by: CptBravo on 29 Dec 2003, 03:15:55
Quick ? please :)

How do you adjust the accuracy of firing? Is there a certain line in the script whenre you can increase reduce the accuracy? ANd is there anyway to make only applicable to certain groupes instead of sides?


Thanks
Title: Re:Fire dispersion script for AI
Post by: Blanco on 18 Mar 2004, 21:00:49
I think it's in this line :


_disp = (_speed * (0.01 - (skill _shooter)/100) )


0.01...it's 10% less accuracy, I think...





Title: Re:Fire dispersion script for AI
Post by: Chammy on 14 May 2004, 18:34:53
I know this is a stupid question but did you guys take a class or study Java script book to know how to do all of this? Cause I have been trying to figure out how to do all this scripting and I am still stumped, thanks to my ADD and short attention span.Oh yeah, im trying out the script right now. ;D
Title: Re:Fire dispersion script for AI
Post by: General Barron on 14 May 2004, 19:30:35
Kinda off topic, don't you think?

Anyway, for me, learning OFP scripting was fairly easy, because I already had experience programming on my TI calculator, and a little in Java/Visual Basic. But prior programming experience isn't required to learn scripting. I didn't even WANT to learn scripting at first, but I started wanting to do things I couldn't do in the editor, so I started downloading other people's scripts, and using those in my missions. Then I started looking at those scripts, seeing how they were done, and modifying them a little bit to get them to do something else. The first script I ever looked at was one that ejects a squad from a helo.

For you to learn, you first need to get the very basics of scripting down. How to do "goto"s, how to use delays, how to make a loop, how to read the command reference, etc etc etc. Hopefully you have been putting commands in units 'init fields' and in the activation fields of triggers, waypoints, etc. From there, it is easy to see that scripting is basically writing a series of those commands, and adding loops and if-then conditions in there.

Most importantly, you need a desire to create. What drives me to get better and better at scripting, is that I am always thinking of something new to script, and usually I have to come up with a creative way to do it. As long as you have the will, you will have the way.
  *END CHEESE*

Title: Re:Fire dispersion script for AI
Post by: DBR_ONIX on 15 May 2004, 17:21:31
Sorry for the continuing OT, but I found out, the best thing for learning scripting is the DePBO tool ;)
(www.ofp.info utilites section)

Open up mission, look at they're scripts, download scripts from places like here, look at them, even better if they're commented
Try to work out what each bit does
Or, talk to scripters on something like MSN (I'd be happy to help ya, if you want) or ICQ (Don't have ICQ myself, only MSN)

Anyway, the script is good, it could be made quicker if the nearest object is made into a function (*.sqf)
Aparently.. Never wrote one my self, but there's tutorials in the eds depot about them

Nice script though :)
- Ben
Title: Re:Fire dispersion script for AI
Post by: 456820 on 06 Feb 2005, 12:40:14
im not sure if its working for me the demo mission does but if i try and put it in my own mission it doesnt seem to effect the ai i copied the trigger from the demo mission and put it in my own then put the scripts into my folder
Title: Re: Fire dispersion script for AI
Post by: andywt on 22 Feb 2013, 16:48:12
Does anyone have this example mission please?

If so, please could they provide a link.