OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: .pablo. on 19 Oct 2002, 04:06:21
-
(if this has been asked before plz post it)
I have been wanting to be able to put snipers on helicopters (think Diehard) but I never knew how to do it. I now know how to keep the sniper on top of the helicopter, but i want to know how to keep it on the side of the helicopter.
heres my question- does the camsetrelpos work with units? if it doesnt, is there any way to mimic its effects?
thx for any help
-
if you don't know at least post it so i dont think you're just ignoring me
-
I dont think camSetRelPos does work for units, instead use this (it'll do exactly the same thing):
man setpos [((getpos helo select 0) +#),((getpos helo select 1) +#),((getpos helo select 2) +#)]
you'll probably have to set it's direction too. Do something like this so he's facing out of the helo:
man setdir((GetDir helo)-90)
Put them together in a loop.
It should work, but you won't be able to control him yourself.
-
yeah but whenever the helo changes direction the sniper rotates around the helo some distance. this is becuase the sniper is suspended # x distance from the helo relative to the world, not to the helo. for example, instead of always staying on the right side of the helo when it turns right 90*, you end up suspended in the cockpit. thats why i need help.
-
getdir choppername should do the trick, but you'll have to make a nice math script.
-
You're looking for something like this:
#loop
unit setpos [(getpos heli select 0) + sin (getdir heli + 45) * 2, (getpos heli select 1) + cos (getdir heli + 45) * 2, (getpos heli select 2) + 1.5]
goto "loop"
You'll need to change the underlined and bold values to get your guy in the position you want. ;)
Oh, just for the record (don't listen if you don't want to)... Realistically it is virtually impossible to snipe from a chopper... :p
-
Sui's method will kee the unit at a fixed point relative to the centre of the vehicle, but unfortunately there is a problem - It cannot account for pitch and roll of the vehicle.
You might want to take a look at a script/addon called ProSphere (get it from opf.gamezone.cz). I haven't really had any time to play around with it, but if it does what the author says it does then it should overcome the pitch/roll problem.
Cheers
-
sui is wrong, you can snipe from a heli. i think people get the wrong idea about conducting sniping operations from the air. a highly trained sniper can provide precision fire from a heli, it is not impossible, it is being done today. i know alot of people only know about BHD and about shughart and gordon (god bless their warrior souls), but it is a common practice performed by special operations forces, especially in urban enviroments. the crew chiefs can't see everything and their weapons are designed to rain hell on the enemy, while a sniper can provide precision fire that won't jeopardize friendlies or captured personnel. it is a complete advantage to have a sniper fire from above and it is even more deadly when he's positioned in a heli, you can't reach him with grenades or rifle fire, you need to bring that whole bird done or get a precision shot on him from a distance.