Need Help Makeing Spotlights In Mp With No Gunners

Post your scripting questions / solutions here

Moderator: Moderators

KcAX18
Corporal
Posts: 37
Joined: Sat Jul 20, 2002 7:57 am
Location: australia
Contact:

Post by KcAX18 »

sorry but it doesnt work i dunno if it does aiming at a player but at a script model its doesnt.
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I made a script for a couple of spotlight that where bound to a crane . the spots did not move but the crane did and the spots move with it . With some hints from jv I came up with this
craneinit:
$cablightspot1 thread cranelights
$cablightspot1 bind $cablightbase1
$cablightbase1 bind $cranecab
........ more lines .........
end
cranelights:

local.groundtarget = spawn script_origin
local.groundtarget.origin = self.origin + self.forwardvector * -1024
local.groundtarget bind self

local.light = spawn script_model
local.light model "fx/dummy.tik"
local.light.angles = self.angles
local.light light (1.0 1.0 1.0)
local.light lightRadius 30
local.light lightOn
//local.light rendereffects "+viewlensflare"
local.light notsolid
local.light.origin = self.origin + self.forwardvector * -16
local.light bind self

local.groundspot = spawn script_model
local.groundspot model "fx/dummy.tik"
local.groundspot light (1.0 1.0 1.0 )
local.groundspot.angles = self.angles
local.groundspot lightRadius 200
local.groundspot lightOn
local.groundspot notsolid

local.p = trace self.origin local.groundtarget.origin 0

local.groundspot.origin =local.p

//local.groundspot rendereffects "+viewlensflare"

local.flare = spawn script_model
local.flare model "fx/searchlight.tik"
local.flare notsolid
local.flare scale 5
local.flare.origin = local.groundspot.origin
local.flare bind local.groundspot

while(1)
{
if($cranecab.moveing == 1)
{
local.sp = trace self.origin local.groundtarget.origin 0
local.groundspot.origin= local.sp

local.vect = local.groundtarget.origin - self.origin
local.vect = vector_normalize (local.vect)
local.dist = 32 // was 16

local.vect[0] = local.vect[0] * local.dist
local.vect[1] = local.vect[1] * local.dist
local.vect[2] = local.vect[2] * local.dist
local.sp = local.sp - local.vect

local.groundspot.origin = local.sp
local.flare.origin = local.groundspot.origin

}
waitframe

}
end
still tweeking it but it works . I guess you can use it as a start and add some commands to move the spot around like I said my lights are bound to an object that moves .
Post Reply