OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Lean Bear on 03 Jan 2006, 15:57:33
-
Just checking to see if it is possible to get the velocity of a unit (not in a vehicle) and return it in the usual array format [x,y,z] ?
So far, I've only been able to get it to work on vehicles...
-
it might be the same as setvelocity which will indeed only work for vehicles. couldnt be sure though.
-
This :
Hint format ["%1", velocity player]
...works like a charm :).
-
i know u can get the velocty, but i dont think u can change it :P
-
Yes you can set velocity, but you have to do it locally
You cannot setvelocity a player unit, just objects
setvelocity [x,y,z]
-
@ Terox
So you're saying that you can't change the velocity of the player? (Or similar soldier unit?)
-
i think u can, here, check this script out, it makes the unit 'Jump'
; Script Copyright Rory Deutsch (Roni) May 2005 - rory@romad.com.au
; Feel free to use, abuse or misuse as you see fit - just don't charge for it.
; A script that allows a player to jump over low walls, onto roofs etc
; Caution ! Jumping while sprinting may cause damage to player
; Get jumper
_jumper = _this select 0
_startDamage = getDammage _jumper
; If character is in the air or severely wounded then disable jump
? ((getPos _jumper) select 2) > 0.3 : exit
? _startDamage > 0.5 : exit
; Place jumper off ground, give him a small upward velocity
_v = velocity _jumper
_vX = (_v select 0)
_vY = (_v select 1)
_vZ = (_v select 2) + 5
_jumper setPos [getPos _jumper select 0, getPos _jumper select 1, 0.3]
_jumper setVelocity [_vX, _vY, _vZ]
; Move jumper to crouch position
_jumper playMove "CrouchToCombat"
; If jumper injured while executing jump then force him prone
? getDammage _jumper > _startDamage : _jumper playMove "CrouchToLying"
hope thisa helps
-
Yep, as Marcus has pointed out, you can set the velocity of a unit, but you have to setpos it off the ground slightly before you do. I guess it sticks, or something ;)
-
Very strange, well, if it works.. :)
Thanks for your help guys!