Home   Help Search Login Register  

Author Topic: Slow moving bullets  (Read 835 times)

0 Members and 2 Guests are viewing this topic.

fri000

  • Guest
Slow moving bullets
« on: 05 Oct 2003, 04:43:30 »
I was wondering if it was possible to have the bullets that come out of the player's gun travel, say about twice as slow? Without using the setAccTime command so everything else doesnt slow down, just the fired projectile. Also is it possible to make this script work on multiplayer games?

 :joystick:

m21man

  • Guest
Re:Slow moving bullets
« Reply #1 on: 05 Oct 2003, 05:36:57 »
Uh, may I ask why? You trying to turn OFP into Enter The Matrix?!?

fri000

  • Guest
Re:Slow moving bullets
« Reply #2 on: 05 Oct 2003, 05:41:36 »
No, but thats not a bad idea. i just need slow moving grenades so you can have time to dodge them at close range.

but i figured bullets fall into the same category.

fri000

  • Guest
Re:Slow moving bullets
« Reply #3 on: 12 Oct 2003, 04:04:55 »
never mind, don't bother replying, i figured it out already.

Homefry31464

  • Guest
Re:Slow moving bullets
« Reply #4 on: 12 Oct 2003, 04:43:56 »
Do tell.

fri000

  • Guest
Re:Slow moving bullets
« Reply #5 on: 12 Oct 2003, 04:57:29 »
i just took parts of different scripts and made them into one. its dumb though. you cant see the bullet fly, only hear it. (you can also try to run circles around it, but you'll die if you run into it :P) i'll edit this post and add the whole script i got a bit later.


ok the following code is a mess, i'll give you that much, but it works. And as you can see there's a lot of useless extra lines commented out. you can delete them freely. there's also an explosion and smoke trail effect added to anything fired out of your gun. :)


Code: [Select]
;script written by Igor Drukov (igordrukov@noos.fr)
;an actual compilation of original BIS and Vektorboson scripts. grenade
;_man=_this select 0
;_object=nearestobject [_man,"grenade"]
_object = nearestObject [vehicle(player), _this select 4]
;_Missile = nearestObject [vehicle(player), _this select 4]
;? isNull  _Missile : exit
;_Missile setVelocity [(.01 ), (.01 ), (.01 )]
;_object setvelocity [random(100)-50,0,random(2)+2]


;#turbo
;?(_n >= 25): _driver groupchat "NOS has worn off"; nosp1 = car1 addaction ["NOS", "turbo1.sqs"];Exit

; get the current velocity of the vehicle
_xvel = velocity _object select 0
_yvel = velocity _object select 1
_zvel = velocity _object select 2

;_xvel = _xvel*.001
;_yvel = _yvel*.001
;_zvel = _zvel
; now set the new velocity
;_object setVelocity [(_xvel ), (_yvel ), (_zvel )]

;_n = _n + 1

;~0.1

;goto "turbo"

_pos=getpos _object
_lifeTime =35
_delay = 0.001
_velocity=[0,0,1]
_lifeTicks = _lifeTime / _delay
_lifeTick = _lifeTicks
#Begin

_n = _n +1

_zvel = velocity _object select 2
_object setVelocity [(_xvel*.5 ), (_yvel*.5 ), ( _zvel)]

_cx=getpos _object select 0
_cy=getpos _object select 1
_cz=getpos _object select 2
_pos=getpos _object
_bomb=drop ["cl_fire", "", "Billboard", 1, 2, _pos, [random 0.3, random 0.3, 0], 1, 0.004, 0.004, 0.1, [1.5*(0.1 + 0.2 * _lifeTick/_lifeTicks), 1.5*(0.1 + 0.5 * _lifeTick/_lifeTicks), 1.5*(0.1 + 0.1 * _lifeTick/_lifeTicks)], [[1,1,1,0], [1,1,1,1], [1,1,1,0.6], [0,0,1,0]], [0,1,0], 0.5, 0.05, "", "", ""]
_smoke=drop ["cl_basic", "", "Billboard", 1, 2, _pos, [random 0.3, random 0.3, 0], 1, 0.004, 0.004, 0.1, [1.5*(0.1 + 0.2 * _lifeTick/_lifeTicks), 1.55*(0.1 + 0.5 * _lifeTick/_lifeTicks), 1.5*(0.1 + 0.1 * _lifeTick/_lifeTicks)], [[1,1,1,0], [1,1,1,1], [1,1,1,0.6], [0,0,1,0]], [0,1,0], 0.5, 0.05, "", "", ""]

~0.001*_delay
? _cz<0.5 :goto "explo"
_lifeTick = _lifeTick - 1
?_lifeTick > 0 : goto "Begin"
#explo
_Unit = _object
_Explosion = GetPos _Unit
_cx = _Explosion select 0
_cy = _Explosion select 1
_cz = _Explosion select 2




_c = 50
_color = [[0.35,0.35,0.3,0], [0.2, 0.2, 0.1, 0.5],[0.2, 0.27, 0.15, 0]]
_size = [2, 5]
_size1 = [2, 15]
_lifetime = 2
_step = 360 / _c


_i = 0
;Vektorboson again... always him !
#l1

_vel = [sin(_i * _step)*15, cos(_i * _step)*15,0]
_vel0 = [sin(_i * _step)*100, cos(_i * _step)*100, random 75-random 150]
_vel1 = [sin(_i * _step)*15, cos(_i * _step)*15,random 15-random 30]
?_cz<1:drop ["cl_basic", "", "Billboard", _lifetime, _lifetime, [_cx, _cy, _cz], _vel, 0, 0.2, 0.157, 0.001, _size, _color, [0], 0.1, 0.2, "", "", ""]
?_cz>=1:drop ["cl_basic", "", "Billboard", _lifetime, _lifetime, [_cx, _cy, _cz], _vel1, 0, 0.2, 0.157, 0.001, [5,15,25], _color, [0], 0.1, 0.2, "", "", ""]
drop ["cl_fire", "", "Billboard", 1, 0.75, [_cx, _cy, _cz], _vel0,1, 0.004, 0.004, 0.1, [random 5,random 15], [[1,1,1,0], [1,1,1,1], [1,1,1,0.6], [1,1,1,0]], [0,1,0], 0.5, 0.05, "", "", ""]
_i = _i + 1
?_i < _c: goto "l1"
_tempobj = objNull
_pos=getpos _object
_lifeTime =0.001
_delay = 0.001
_velocity=[0,0,1]
_lifeTicks = _lifeTime / _delay
_lifeTick = _lifeTicks
#Begin0
_object exec "Destroyed.sqs"
drop ["cl_basic", "", "Billboard", 1, 1, [_cx,_cy,_cz], [random 0.3, random 0.3, random 0.3], 1, 0.004, 0.004, 0.1, [5*(0.1 + 0.2 * _lifeTick/_lifeTicks), 2.5*(0.1 + 0.5 * _lifeTick/_lifeTicks), 2.5*(0.1 + 0.1 * _lifeTick/_lifeTicks)], [[0,0,0,1], [0,0,0,1], [0,0,0,1], [0,0,0,1]], [0,1,0], 0.5, 0.05, "", "", ""]
drop ["cl_fire", "", "Billboard", 1, 1, [_cx,_cy,_cz], [random 0.3, random 0.3, random 0.3], 1, 0.004, 0.004, 0.1, [75*(0.1 + 0.2 * _lifeTick/_lifeTicks), 25*(0.1 + 0.5 * _lifeTick/_lifeTicks), 25*(0.1 + 0.1 * _lifeTick/_lifeTicks)], [[1,1,1,0], [1,1,1,1], [1,1,1,0.6], [1,1,1,0]], [0,1,0], 0.5, 0.05, "", "", ""]
~_delay
_object setdammage _i
_i=_i*1.1
_lifeTick = _lifeTick - 1
?_lifeTick > 0 : goto "Begin0"

exit



Attached is also the .sqs file of this code. your going to need to add the following the init field to get it to work:

this addeventHandler [""fired"", {_this exec ""grenadefire.sqs""}  ]


thats it, hope someone finds it useful :P
« Last Edit: 12 Oct 2003, 05:38:42 by fri000 »

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Slow moving bullets
« Reply #6 on: 13 Oct 2003, 18:29:40 »
i just took parts of different scripts and made them into one. its dumb though. you cant see the bullet fly, only hear it. (you can also try to run circles around it, but you'll die if you run into it :P) i'll edit this post and add the whole script i got a bit later.

That's because bullets aren't modelled in OFP. OFP ain't Max Payne.

Code: [Select]
;script written by Igor Drukov (igordrukov@noos.fr)
;an actual compilation of original BIS and Vektorboson scripts.

Lol... ever thought removing that? :P

:beat: *Gets Shot* :beat: