Home   Help Search Login Register  

Author Topic: Psst. Garcia (re: finding angle)  (Read 674 times)

0 Members and 1 Guest are viewing this topic.

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Psst. Garcia (re: finding angle)
« on: 08 Jul 2005, 00:18:57 »
Sorry, I guess you marked the problem as solved, but it's really not.  Reading the vector after launch gives you a decent idea of the trajectory, but not a perfect one.
The shell's launch vector is written to a series of registers before firing, and at firing, the registers are red and set to -1.  These are:
CoCIFU%x
CoCIFU%y
CoCIFU%z
CoCIFU%ToF
(ToF is the fuze setting and largely unused in UA 1.0)
You can find what number to put in the % by using
unit call CoCfIFFindUnit
(or maybe [unit] call ....
that will return the unit name (e.g., CoCIFU0).  Append X Y Z to it, and you'll get the vector you seek.

Alternatively, UA loads a function into memory that points the gun in the direction it needs to go: CoCfIFTargeting.  You could also copy this function (Targeting.sqf I think) to the mission directory, and add in a broadcast line or two, then on IF start, loadfile it into CoCfIFTargeting.

Dinger/Cfit

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Re:Psst. Garcia (re: finding angle)
« Reply #1 on: 08 Jul 2005, 02:10:18 »
ToF = Time of flight...does that mean that if ToF IS used, it determines the time it takes from the shell is fired until it hits the ground? And if that is what it does, is there some way to use it in any other script? :) Thanks for the answer btw ;) I solved the other thread cause UNN gave me and idea that works for me, and cause my first idea wouldn't work even with the the angle of the gun :-\

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Psst. Garcia (re: finding angle)
« Reply #2 on: 08 Jul 2005, 14:20:05 »
Actually, I'm pretty sure ToF is recorded whether it's "used" or not -- it's the basis of the time fuze setting in UA 1.1 and other projects.
UA rigs things so that TOF is a simple calculation, but outside of UA projectiles, it won't work. Sorry.

My objection to Unnamed's solution is that, in my experience, reading the velocity vector is fairly imprecise in elevation -- but if you only need a general direction, good enough. In addition, in MP, the vector oscillates fairly heavily (often at 0,0,0 so you'll get divide/zero errors). That said, I'm not certain that CoCIFU%x, y and z are PV'd, so you'd probly have to transport them too.
Dinger/Cfit

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Re:Psst. Garcia (re: finding angle)
« Reply #3 on: 08 Jul 2005, 15:42:11 »
Well, I'm basically not using much of UNNs script...I just use the fired EH and first part of the script ::) The scripts "work" is to check when the shell is about to hit (you may remember I posted this at the CoC forum, but never got it to work), so I got a distance check, and when the shell is 1600 m from the target, people in the target area will shout stuff like "incoming" :P (except if there's only 1 person in the target area, as there wouldn't be much use shouting incoming to yourself). Though, it would be best if I could find the time of flight before the gun fires, cause then I would be able to use this script better on shorter ranges...1600 m sounds very long, but with the howiters it doesn't take the shell a long time to reach the target...so if the range is, lets say 700 m, then the shell would most likely hit about the same time as the guy start shouting, cause the distance check (using the @, not any loop) actually uses some time to actually check the distance, so even though it should activate just as the gun fires, it uses to long time to go through the information in the start...and I have to have a small delay before the distance check too, to move a trigger to the target area, then wait a bit, then check whos in the area, exit the script if theres only 1 or less there, and then chose random persons for the different sounds etc...and in that small delay the shell goes a loooong way :-\ sooo...having the ToF available would make this a lot better ::)

(god damn, gotta get more sleep, don't even remember half of what I just wrote :-\)

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Psst. Garcia (re: finding angle)
« Reply #4 on: 10 Jul 2005, 02:49:24 »
Yeah, okay, the target location you can find by looking at CoCIFA%t0 -> CoCIFA%T5, (and you can get the variable stem by any unit in the group by calling  unit call CoCfIFFindGroup .
The TOF should be published. The default setting is 30 seconds, so ignore that.... In fact, you could have a script that looks for a non-30, non- -1 TOF and kicks into action, waits for the TOF to change to default and starts counting from there.
Dinger/Cfit