Home   Help Search Login Register  

Author Topic: Need help with some stuff  (Read 567 times)

0 Members and 1 Guest are viewing this topic.

SeXyWombat

  • Guest
Need help with some stuff
« on: 21 Nov 2004, 09:44:04 »
I have a few questions:

1. How to make normal unit fire its firearm (ie. M16) with "Fire" command without the unit actually aiming at the sky when shooting ? I want the soldier to aim his weapon at an object (ie. house) and start shooting at it.

2. How to make units in Aware and Combat mode walk instead of running ? Is there a command for it ? Or at least good workaround ?

3. How to make unit crouch without using "switchmove" ?

4. How can I detect bullets (shot by given side, west/east/res) flying in a given distance from a unit (ie. I want the script to detect every bullet flying in less than 10 meters from a unit) ?

bored_onion

  • Guest
Re:Need help with some stuff
« Reply #1 on: 21 Nov 2004, 14:46:52 »
1) um there is the dofire command but im not sure you can fire at objects. however, you could stick a loon near the house and make him fire at that

2) in the waypoint box set the speed in the drop down menu to "limited" that should do the trick there is a command "setspeedmode" but thats the simplest way

3) "setunitpos" could be the answer but im not sure whether you can make them crouch two accepted values are "up" and "down"

4) the "nearestobject" has something to do with that. i made a once to detect a bullet. ill try and find it.

EDIT:
here it is, find the file in this thread called 'missile.zip' and mess about with it to see what you can do:

http://www.ofpec.com/yabbse/index.php?board=9;action=display;threadid=19327
« Last Edit: 21 Nov 2004, 14:49:53 by bored_onion »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Need help with some stuff
« Reply #2 on: 21 Nov 2004, 18:54:05 »
1. Get the Invisible targets AddOn and make the AI target one of those targets...

3. You can't... (afaik)

4.Why??
I had an discussion of this sort here a while back...
This is actually very hard as the nearestObject is not the most intelligent function, not to mention that the OFP bullets live only 2-3 seconds...
The nearestObject probably wouldn't detect the bullet, due to couple of facts like the bullets speed, which is so high that the environment in which an sqs loop trying to detect the bullet should be absolutely lag free...

Other way of doing this would be adding a fired eventhandler to ALL units on the map which would each execute a scripts that would 'follow' the bullet through it's life-time constantly checking wether it's distance to the given unit is 10 or less meters... Of course, if the given unit could be any unit on the map this would be impossible to do...
Not to mention the cataclysmic strain on CPU when lot's of units would be firing  :-X

bored_onions example works on missiles because the missiles tend to travel 'a bit' slower than bullets ::)
For example 'capturing' a bullet from a script executed by fired EventHandler is almost impossible...
If the game lags a bit the bullet 'escapes' the nearestObject...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

bored_onion

  • Guest
Re:Need help with some stuff
« Reply #3 on: 21 Nov 2004, 22:05:03 »
i have used the camera on bullets although its tempremental and if you fire into the air its troublesome cos the bullet doesnt stop:P

once i get my flashpoint computer back up ill see if i can jiggle it and make it a bit more versatile...
« Last Edit: 21 Nov 2004, 22:06:09 by bored_onion »

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Need help with some stuff
« Reply #4 on: 21 Nov 2004, 23:10:14 »
4. How can I detect bullets (shot by given side, west/east/res) flying in a given distance from a unit (ie. I want the script to detect every bullet flying in less than 10 meters from a unit) ?

Oddly enough, I remember doing something like this a while ago... check it out here:

http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=13608;start=0

It is possible, but it is also very, very heavy on the CPU. Nearestobject is a very "expensive" function as is, but since bullets travel so fast, you would need to check it as fast as you possibly could. In a nutshell, you need a line like this in a script:

Code: [Select]
@(_unit distance (nearestObject [_this, "BulletName"])) <= 10
But that would only work with one specific type of bullet. If you wanted more bullet types, you would need to use a function like my nearestObject function (in the function library). However, that would mean you are doing 5x the amount of nearest object calls (if you had 5 bullet types), which could possibly crash ofp if you had lots going on.

I think HateR_Kint's suggestion using eventhandlers would be the better way to do this, but it is more complicated to script, and would also be laggy with lots of bullets.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!