OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Spectaculas on 07 May 2004, 11:20:07
-
Can somebody do a script what allows you to shoot from vehicle?
For example: You are on a back seat of 5t truck open heading to small enemy base. Small group tries to attack you but you shoot every enemy with your M16 while you are sitting in the truck.
-
Can't be done I think unless you make a new vehicle pack.
It might be scriptable but I have a feeling the answer is no. I've asked for this before and got limited response.
A new 5ton with a M16 weapon mounted on the tailgate or something might be good.
-
Oh come on now GuiltyRoachKilla, nothing is outright impossible with OFP scripting :D!
I played around with a script that allows you to "climb" up on a tank, and shoot exposed crew, and I found that if the tank started to move, I could ride along with it, shoot, whatever!
If you use a getpos/setpos command to place the player in back of the flatbed, it shoud work. Make sure you setpos the player in the right spot and high enough though...If you want help with the script let me know.
-Grendel
-
Lag ahem lag ahem. This has been brought up before. A script like that would make nearly impossible to aim with your player moving every ~0.01. A stationary truck I can see that but not a moving one. I was shot down with a box truck like this in add on ideas. The truck was like a bank one with opening rear doors and dudes could fasten seatbelts or stand or sit in back and fire rearward. It would be jarring the player constantly and you not assured a good spot in the truck when turning. look at the BAS MH47, try walking in that while going, you'll become a pancake. :)
A simple car or truck with a mounted or new animation for gunner add on using M16 or approapiate weapon would solve the problem. ;)
-
Can somebody do a script what allows you to shoot from vehicle?
For example: You are on a back seat of 5t truck open heading to small enemy base. Small group tries to attack you but you shoot every enemy with your M16 while you are sitting in the truck.
Thanks for this question, Spectaculas ;). I think, like you, that firing from a vehicle would be great (it's very annoying to be defenceless when you're in a car or a truck). However, I'm not good enough in scripting to help you :(. Perhaps the solution is like this :
1) Check if the player is "in Cargo", in a car or a truck.
2) Detect when the player fires (left click).
3) "create" a "firing bullet" (coordinates on the side / behind / in front of the vehicle, direction the player watched when he has fired and so on...).
4) Remove the ammo each time the player fires.
Sorry I can't help more than this :-\ . But I hope an answer ! :D
-
A script like that would make nearly impossible to aim with your player moving every ~0.01.
I guess you've never tried firing an automatic weapon from a moving vehicle ;). Even trying to fire accurately from a MOD-7 flexible weapon mount from a HMMWV is downright imposible when you're moving over anything but the smoothest road. Normally its just pray and spray to keep their heads down.
As far as lag goes, I only used one setpos command to get the player on the tank, and I just rode along with it. I'll play with it as soon as my cpu is back up.
-Grendel
-
My old post in add on ideas for a civvie car with an UZI.... ::)
Anyways sitting on a tank is somewhat different. A slower ride with 360 degree view + whatever you miss gets the turret :o
A truck moves faster, bounces(yes glitches and stupid engine coughs), doesn't have a clear firing area...
I've tried setposing ppl in trucks but it never works. They are under or over, never inbetween. ;)
-
I also remembered that the manual "says" that BMPs have small "holes", that allow passengers to use their owns weapons. It might be possible to make a script in order to use these "holes" (by pressing "V" or by the action menu)... :-\.
-
Hmmmm
The Humvees/turrets work okay
So what about making the turret the M16 etc at the back?
Could be cool, apart from that it won't remove the players ammo :|
- Ben
-
I've found this : http://www.ofpec.com/yabbse/index.php?board=13;action=display;threadid=11411;start=0 (not sure it helps, but...).
-
Yeah a simple M16 or AK74 on the appropiate truck...
I'd go for that. Not losing any ammo can be explained, the truck had an extra rifle. ::)
A car with a side mounted anything is what I've been looking for all along... >:(
-
1) Check if the player is "in Cargo", in a car or a truck.
2) Detect when the player fires (left click).
3) "create" a "firing bullet" (coordinates on the side / behind / in front of the vehicle, direction the player watched when he has fired and so on...).
4) Remove the ammo each time the player fires.
According to xela89 (from ofrp forums), 1) and 3) are easy, 2) and 4) seems impossible. But I think that we can use the addaction command instead of detecting a left click (in others words, have the action "Shoot from vehicle" when the player is in cargo). A few people also suggested to "move" the player when he fires (floating next to the vehicle... :-\). In my opinion 4) is not very important because a player firing from a vehicle is an easy target... :P.
-
the ICP anims form the VDV2.0.pack Are maybe a step forward.
Thes anims are great imo and very usefull too because you can still fire and turn while you're in the animation
Maybe it's possible with cargoanims too,
but the turning in the vehicle could look very weird, because only the upperbody should move.
-
I've found this script ; it puts a MG on the roof of a vehicle (a HMMWV in my example). Works perfect !
In init.sqs file, put :
[Nameofthevehicle,Nameofthemachinegun,height] exec "MGCarry.sqs"
exit
(You can do this differently, of course)
For a HMMWV, for example, put a height of 0.785 (warning : a "." for a ",").
Here's the script :
_carrier = _this select 0
_cargo = _this select 1
_height = _this select 2
endCargoSession = false
goto debug
#carrier
_x = (getPos _carrier) select 0
_y = (getPos _carrier) select 1
_z = ((getPos _carrier) select 2)+_height
_cargo setPos [_x, _y, _z + 0.9 ]
_cargo setDir (getDir _carrier)
~.01
? (!endCargoSession) : goto "carrier"
@ endcargosession
_cargo setpos [_x,(_y)-1.5,0]
exit
-
why not have you being able to shoot from a heli, :o like the BAS blackhawks the blokes with dangeling legs could pop off shots whilst the rest of you fast rope out, that would be cool 8)
-
I've found this script ; it puts a MG on the roof of a vehicle (a HMMWV in my example). Works perfect !
In init.sqs file, put :
[Nameofthevehicle,Nameofthemachinegun,height] exec "MGCarry.sqs"
exit
(You can do this differently, of course)
For a HMMWV, for example, put a height of 0.785 (warning : a "." for a ",").
Here's the script :
_carrier = _this select 0
_cargo = _this select 1
_height = _this select 2
endCargoSession = false
goto debug
#carrier
_x = (getPos _carrier) select 0
_y = (getPos _carrier) select 1
_z = ((getPos _carrier) select 2)+_height
_cargo setPos [_x, _y, _z + 0.9 ]
_cargo setDir (getDir _carrier)
~.01
? (!endCargoSession) : goto "carrier"
@ endcargosession
_cargo setpos [_x,(_y)-1.5,0]
exit
where do you put this script (i dont know scripting) :-[ ???
-
I found this in my user folder that I've had for ages..
It's the mission that came with the script
:)
Its attached
- Ben
-
1 of the problems with putting an AK-74 or a M16 is that the blokey/gunner probably won't move with the gun, I saw a chopper with a MP5 sticking out of the window but the gunner guy just stayed in one place!
-
If you make a turret, and put the gunner proxy in the selection of the turret.. The gunner will move with the turret (The BAS Little Bird, thats the addon your talking about, I guess.. Couldn't do this I suppose because the gunner couldn't spin around, as it'dd look auwful..)
- Ben