Home   Help Search Login Register  

Author Topic: Set The Velocity Of An Object, and set Distances  (Read 2910 times)

0 Members and 1 Guest are viewing this topic.

teeBore

  • Guest
Re:Set The Velocity Of An Object, and set Distances
« Reply #15 on: 25 Feb 2003, 07:03:19 »
Hey RunAwaySci, if you still have a question about speed and velocity in OFP, I'll be glad to help you broi cos I have it pretty much figured. I just don't exactly know what you are asking.

No offende LCD but why r u aint help da man who ask da question, probly cos r u not spekin englais my frien?

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Set The Velocity Of An Object, and set Distances
« Reply #16 on: 25 Feb 2003, 12:27:27 »
@ teebore - just wait a sec  :P - read wat u write and read my latest posts

Quote
I just don't exactly know what you are asking.

No offende LCD but why r u aint help da man who ask da question, probly cos r u not spekin englais my frien?

Quote
probly cos r u not spekin englais my frien?

both from teebore

im on da same situation - i donno wat he wants :P

Quote
distance wat ?  

u got da distance command

wat u exactly need on distances ?

(from me)

bout da englih thingy - im stil beter dan u :P
- and 2 think english is my 3rd lang

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

teeBore

  • Guest
Re:Set The Velocity Of An Object, and set Distances
« Reply #17 on: 28 Feb 2003, 05:12:42 »
yeah sorry LCD, I didn't take the 30 minutes needed to decipher your posts, so I didn't take them into account. ;)

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Set The Velocity Of An Object, and set Distances
« Reply #18 on: 28 Feb 2003, 18:01:23 »
lol

dere is special dictionary ;D

from LCDish 2 Tombish and den u need 1 from Tombish 2 ny oder lang ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

RunAwayScientist

  • Guest
Re:Set The Velocity Of An Object, and set Distances
« Reply #19 on: 01 Mar 2003, 23:33:27 »

   Alright dudes, stop sniffing the same Cartel.

        Lemme explain what I'd like in a litte more detail (Sense).

       What I want, is to be able, to tell a driver of a car, to follow another car, at a certain distance from it.

       An example of this, is in the game itself. Remember those nice fire fights, where you stuck close to your leader? He cussed you out and to return to formation? The yellow box dancing around your leader?

     In Even More Sense: When in a formation, a unit under command of the leader stays in (Formation). A certain distance away from the leader. How do you do this?

      In othere words, what I'd like:

    - A Police Car to ram a suspects car.

    -Hence, the distance required for the Police Car to stay away from the Suspect is 0.

    -Meaning, the Police car will try to keep a distance of 0, between him and the Suspect.

      -Because it's 0, the Police car will try to drive directly ontop of the car, meaning that it'll ram it.

    Think about it, if you set Car2's required distance to Car 1 to 5, that means it'll follow 5 Meters behind. But what if it was 0? Then Car2 would drive right into Car1.

      Understand? If not, stop taking cartel, get help, buy a new wife, sell your kids, eat milk, drink chocolate, and above all...Don't get glad, get Happy!!

     -RunAwayScientist

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Set The Velocity Of An Object, and set Distances
« Reply #20 on: 02 Mar 2003, 07:34:40 »
dere is no way 2 do it exactly but u can try dat (wil b more or less)

Code: [Select]
_car = _this select 0
_destcar = _this select 1
_distance = _this select 2

#loop
if  (_car distance _destcar > _distance) then {
_car stop false;
_car move getpos _destcar;
}
else {_car stop _true}
if (_car distance _destcar < (_distance+5)) then {_car setspeedmode "limited"} else
{
if (_car distance _destcar > (_distance+20)) then {_car setspeedmode "full"} else {_car setspeedmode "normal"}
}
~1
goto "loop"

hop i didnt make ny syntax erors ;D

LCD OUT
« Last Edit: 02 Mar 2003, 07:36:11 by LCD »
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Quantum69

  • Guest
Re:Set The Velocity Of An Object, and set Distances
« Reply #21 on: 03 Mar 2003, 05:30:58 »
Heres the script I threw together that may work for you:

; used to place aircraft at a given altitude and speed
;
; input: [object, altitude, speed] (based off map placed heading)
;
; Quantum69
;
_ac = _this select 0
_alt = _this select 1
_spd = _this select 2

_x = (getpos _ac) select 0
_y = (getpos _ac) select 1
_z = (getpos _ac) select 2

_ac setpos [_x, _y, _alt]

_curdir = getdir _ac

_raddir = _curdir * 0.0174

_xvel = _spd * (sin _raddir)
_yvel = _spd * (cos _raddir)

_ac setvelocity [_xvel, -_yvel, 0]

exit

I put this together because I didn't like the initial setting of "Flying" for the aircraft.  You can delete the altitude section and just use the velocity section.

Of note;
        It's cos(y) and sin(x) because North is 0 degrees, if it were sin(y) and cos(x) then EAST would be 0 degrees.  Also, it's (-yvel) because North and South values are backwards.  COS and SIN work with RADIANS, so that's why it's (current direction * 0.0174), 0.0174 radians per degree:  1 radian = 1 degree * (PI / 180).

"One day algebra will save your life."  Val Kilmer, RED PLANET

Hope it helps,
Quantum69

RunAwayScientist

  • Guest
Re:Set The Velocity Of An Object, and set Distances
« Reply #22 on: 09 Mar 2003, 02:36:58 »

    Ehhhhhhhhhhhhhhhh.....I believe this script sets the INITIAL speed, and altitude. But I don't think it makes the computer AI driving the Car, stay at that speed. Am I correct?

     Well I must say, it's very elaborate, and might be of use to other people in different instances.

      Remember, what I'm trying to achie-!!!!

     I just thought of something....Lemme finish my scentence...

       Remember, what I'm trying to achieve is the same idea when you keep formation, while another AI Commands you.

        Alright, remember the Single Player mission, the first level? Remember how when you followed your Commander around, there was that yellow box, that told you exactly where to stand in formation?

        Same idea here, except I want the little formation box, to be right over a Suspect's car, meaning the Police Officer's car will ram into it.

         Well, now to my brainstorming idea! (Rains Brains)

       What I just thought of, is how the yellow box kind of resembles it's large cousin, the Waypoint box. The WayPoint box tells you were to go.

         What if I were to kind of create, a waypoint of the Suspect's car for the Cop to follow. And I don't mean the 'move' command. Kind of like the destroy command, or so.

       Well, what are your thoughts scripters, and modders? Come to me! I've got Key Lime Pie!!!!

          -RunAwayScientist ('Can't we all just, get along? Or does Peace Not Last So Long?' - RunAwayScientist)