Spotlight controlled by the player

Post your scripting questions / solutions here

Moderator: Moderators

SkiLLeT
Lance Corporal
Posts: 10
Joined: Mon Aug 02, 2004 1:46 am

Post by SkiLLeT »

Hey I had the same problem but i fixed it.

under

level waittill prespawn

//*** Precache Dm Stuff

thread Lights
exec global/player_spotlight.scr towerlights

i think you need to thread the lights b4 u exec the .scr
User avatar
SolidScope
Lance Corporal
Posts: 19
Joined: Tue Jul 13, 2004 1:24 am

Post by SolidScope »

G3mInI,

Hey! I got it to work. Thanks a lot G3mInI. Although I have no idea why it wouldn't work before. This time I just scripted the spawning of the model like you did.
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Version 2 is now done . player_spotlight.scr

changes:

you can now add a color and health to the beam

the spotlight also spawns a beam so you can tell where the light is comeing from

you can have the base target something and the trigger that activates the spot will be at the origin of the targeted entity like an mg gun for example

got rid of the light at the spotlight that use to lightup the player useing the light

the use key turns on and off the light you don't need to hold the use key any more

Here is a test sample I used for mohdm5 // snowy park

local.gunbase = spawn script_model model models/statweapons/mg42_bipod_nonstatic.tik origin ( 3796.69 -5150.08 234.13) angles (0.00 101 0.00)
local.gun = spawn models/statweapons/mg42_gun.tik origin ( 3796.69 -5150.08 237.13) angles (0.00 101 0.00)
local.gun targetname thegun

local.s1 = spawn script_model model miscobj/searchlightbase.tik origin ( 4056.53 -4411.25 216.13 ) angles ( 0 205 0 ) targetname myspot
local.s1.color = ( 1 1 0)
local.s1.health = 100

local.s2 = spawn script_model model miscobj/searchlightbase.tik origin ( 3729.59 -5142.40 216.13 ) angles ( 0 140 0 ) targetname myspot
local.s2.color = ( 1 0 0)
local.s2.health = 200
local.s2.target = $thegun

local.s3 = spawn script_model model miscobj/searchlightbase.tik origin ( 3347.93 -6009.08 216.13 ) angles ( 0 182 0 ) targetname myspot
local.s3.color = ( 1 0 1)
local.s3.health = 300

local.s4 = spawn script_model model miscobj/searchlightbase.tik origin ( 523.88 -4011.00 208.13 ) angles ( 0 325 0 ) targetname myspot
local.s4.color = ( .5 0 .5)
local.s4.health = 400

local.s5 = spawn script_model model miscobj/searchlightbase.tik origin ( 540.37 -2841.19 208.13 ) angles ( 0 300 0 ) targetname myspot
local.s5.color = ( .1 .1 0)
local.s5.health = 500

exec global/player_spotlight.scr myspot
Image
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post by G3mInI »

I tested out the new script. Works well the first time the map is executed. However when I type in 'restart' in the console, the spotlights act very strange. The base moves with the player and the beam turns off and on but the beam seems to be in a fixed position. It does not move with the searchlight. I tested several times to make sure and repeatedly got the same result. It's as if the spotlight beam is not being reset upon restarting the map. Any ideas ?

G3mInI
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

execute the script after level waittill spawn
Image
User avatar
SolidScope
Lance Corporal
Posts: 19
Joined: Tue Jul 13, 2004 1:24 am

Post by SolidScope »

G3mInI wrote:the beam turns off and on
that could be due to you holding down "use" when you only need to hit it once for on and once again for off.
Image
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post by G3mInI »

bdbodger wrote:execute the script after level waittill spawn
That fixed it. I had the thread before level waittill spawn and the execute command was in that thread.. all better now... great work.

G3mInI
Cobra {sfx}
First Lieutenant
Posts: 193
Joined: Tue Mar 23, 2004 10:25 pm
Contact:

Post by Cobra {sfx} »

One problem i noticed with spotlights was that they shine straight thru buildings etc, dont know if yours are doing the same - we had them on hunt and had to be careful where they were aiming as it looked a bit daft shining straight thru walls and things.
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

That is the problem with dynamic light no way around it .
Image
SkiLLeT
Lance Corporal
Posts: 10
Joined: Mon Aug 02, 2004 1:46 am

Post by SkiLLeT »

Is there anyway to start with the lights on, instead of off?
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Not the way the script is written you will have to turn them on .
Image
SkiLLeT
Lance Corporal
Posts: 10
Joined: Mon Aug 02, 2004 1:46 am

Post by SkiLLeT »

ok thanks. Does anyone know the name of the spotlight model? i want to spawn some spotlights that are turned on. It doesnt have to move like the mod bdbodger did.
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

miscobj/searchlightbase.tik

and

miscobj/searchlightoff.tik

and

miscobj/searchlight.tik
Image
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

i can get the spotlights to work in every map besides my own..lmao :shock:
Phil {sfx}
Sergeant
Posts: 67
Joined: Thu Sep 30, 2004 2:08 pm
Location: uk
Contact:

Post by Phil {sfx} »

bdbodger wrote:That is the problem with dynamic light no way around it .

If you use trace, like jv as in the flashlights for MW, they dont go threw walls.
Senior Modder/Mapper/Scripter/Modeller @ www.mods-r-us.net
Post Reply