startfire/rockets

Post your scripting questions / solutions here

Moderator: Moderators

Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

startfire/rockets

Post by Elgan »

can i spawn and make a bazooka and make it fire?

also

like with the flak88's is there a wait till on target cmd for mg42's?

local.gun2 setaimtarget local.org
local.gun2 wait on target?
local.gun2 startfiring
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

1) Yes, just spawn a bazooka and then do local.mybazooka anim fire :) or local.mybazooka shoot

2) Yes, try waittill ontarget but in my experience it sometimes crashes :(

Alternatively you could easily script a waittill ontarget condition yourself :)

Example

Code: Select all

waittillontarget local.gun local.targetent:
  while !(waitthread isontarget local.gun local.targetent)
    wait 0.20
end

isontarget local.gun local.targetent:
  local.vectotarget = vector_normalize (local.targetent.origin - local.gun.origin)
  local.gunvec = local.gun.forwardvector

  local.dotvec = local.gunvec * local.vectotarget
  // 2 * arccos 0.95 gives the fov that's considered 'on target' (+- 10 degrees)
  if(local.dotvec >= 0.95)
    end 1
  else
    end 0
end
Last edited by jv_map on Tue Jun 01, 2004 5:03 pm, edited 1 time in total.
Image
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

cool thanx. i tried a wait till and it made the guns explode:S:S...

its fine how it is anyway:D
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

lol impatient guns I suppose :?
Image
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post by blue60007 »

jv_map wrote:1) Yes, just spawn a bazooka and then do local.mybazooka anim fire :) or local.mybazooka shoot

Hey cool I didn't know you could do that. :)
Image
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

"model" "weapons/kt2/bazooka.tik"


local.rockets anim fire
local.rockets2 anim fire

and it crashes mohaa:S
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

and local.rockets2 shoot

does nothing..maybe they need ammo?
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

errm now when i try local.rocket shoot it also crashes mohaa:S:S:S
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

You should spawn a bazooka, not a script_model with the bazooka model :wink:

Like this:
local.myzooka = spawn weapons/bazooka.tik
Image
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

errm

//
//local.rockets = spawn weapons/kt2/bazooka.tik
//local.rockets.angles = local.plane.angles

i was using that?


isnt that what u mean though:S
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post by blue60007 »

Well you have it commented, nothing will happen with that script.
Image
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

lol thats because i commented it out then pasted it here :P!.


i tried 1 last time but it just crashes the game:(
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post by blue60007 »

Oh sorry... :oops:
Image
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

hehe its cool. btw if you would like to have a play with the planes the serv is up and less full as forced dmw 3.0 is on

connect with it and you will be fine..
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post by blue60007 »

Hey I'll be right there...
Image
Post Reply