OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Resources Beta Testing & Submission => Topic started by: Chrispy on 18 Aug 2007, 10:16:38
-
Now you can jump in OFP! I'm not sure if something has been made and released before though. Pretty basic IMO! :P
Chris :)
-
Well, that is not exactly a jump but a teleportation. Try this instead:
_jumpvel = 1
player setPos [(getpos this select 0),(getpos this select 1),0.1]
player setVelocity [0,0,_jumpvel]
And for a forward jump (you may change _jumpvel to any desired value for longer jumps, but the player may result harmed when landing:
_jumpvel = 2
player setPos [(getpos this select 0),(getpos this select 1),0.1]
player setVelocity [sin(getDir player)*_jumpvel,cos(getDir player)*_jumpvel,*_jumpvel]
-
_jumpvel = 1
player setPos [(getpos this select 0),(getpos this select 1),0.1]
player setVelocity [0,0,_jumpvel]
^ That didn't work for me. Because I don't have the expansion?
Chris
-
SetVelocity only works on objects that are a vehicle (or in a vehicle class). Static objects or units dont work. You need to have an invisible vehicle of some kind and then setpos the unit to that, but that involves addons.
-
setVelocity does work on units.
-
If someone wants to, they can release it "as is", or they can feel free to modify it and release it (just don't pass it off as 100% yours please lol...).
Thanks guys.
Chris :)
-
OK, this one works. I tested it and have included a demo mission:
_man = _this select 0
_doer = _this select 1
_zi = velocity _man select 2
_zpos = getpos _man select 2
;limit the conditions for jumping (must be player and player must be on ground or at least
;not moving vertically (he can still jump if standing on an elevated object)
? _man != _doer || (_zpos > .1 && abs _zi > .1); exit
;setup jump velocity
_zMax = 4.5
_z = _zi + _zMax
? _z > _zMax : _z = _zMax
;do the jump with some animation
_man playmove "CrouchtoCombat"
_man setPos [getPos _man select 0, getPos _man select 1, (_zpos + .1)]
_man setVelocity [velocity _man select 0, velocity _man select 1, _z]
exit
-
No luck. Does it work for you?
This might be that Resistance problem again...
Chris
-
Chris,
I did some playing around with it last night. I did make some changes, now it works (for me). See the demo mission attached to my first post.
-
It doesn't work for me. All the player does is kneel and stand up. And I see a white text error message on the top left of the screen.
What version of OFP are you running? It's probably because I've got v1.46 - that's all.
If you can video what the jump looks like that'd be helpful. Feel free to release this as well mate - I can imagine it's good.
Chris :)
-
Chris,
It is strange that it does not work for you, even if you are only running 1.46. Maybe if you adjust the setpos height (in the line just before the setVelocity line). Make the setPos value higher, try _zpos + .2 instead of the current _zpos + .1. Also, why on earth are you still using 1.46? Can't you download the upgrade patches? I am running 1.96. Also I just recently got ArmA, but I want to finish my big OFP mission before I get too much into ArmA.
I will make a movie of the jump. I will do that this weekend.
-
The "setvelocity" - command is for OFP Ver. 1.8 at least. That means you have to have Resistance + final patch.
btw...
Is anybody able to use "setvelocity" on an with editor placed object?
???
-
Don't I have to have Resistance before I can update past v1.46?
Chris
-
My 1.96 patch would refuse the installation if i wouldn´t have installed Resistance.
I think you have to have Resistance first. It is an very good upgrade with new weapons and vehicles + a whole new island...
And, it´s not expensive to purchase! :good:
-
Chris,
I think you do have to have Resistance to update past 1.46. So go get Resistance, it has been out for so long you should be able to get it at a very low price. Maybe the problem is that it is hard to even find it now?
dr. seltsam,
You can only use setvelocity on vehicle class items, not static objects. So building, fences, crates, etc. cannot be "setVelocitied". However, you can move these items using a "virtual" set velocity funciton/script that I did. There are two versions, one takes into acount the effects of gravity and the other just does linear movement. Check the links below.
http://www.ofpec.com/forum/index.php?topic=28401.0 (http://www.ofpec.com/forum/index.php?topic=28401.0)
http://www.ofpec.com/forum/index.php?topic=28363.0 (http://www.ofpec.com/forum/index.php?topic=28363.0)
-
Thanks for these nice scripts and function files, Raptorsaurus... very impressive i must say!
I played a bit with the parameters, and noticed that the horizontal speed is always calculated in relation to the time that is needed to the target position by having initial vertical speed, gravity and the start position.
:good: :good: :cool2:
I setpos´ed the object higher into the air, and your script was able to make it look like a bomb which is guided to its target.
After my current mission project, i think, i want to use that script for an airsrike mission.
:)
-
@ dr seltsam: Yes, it makes for deadly accuracy. I am going to also do a version where the initial parameters include the initial horizonal speed instead of the desired landing position. This version would be better for random bomb landing locations for carpet bombing scripts.
@ Chris: Chris if you do not want to update to a version that allows setVelocity, then perhaps the setPos methods can be used to make the man jump. I will experiment with that, then you can test to see if it works in your 1.46 version. Does 1.46 even allow function calls though?