Page 1 of 3

Spotlight controlled by the player

Posted: Sat Jul 31, 2004 11:41 pm
by bdbodger
Well I have written another script this one is for spotlights that are controlled by the player . To use it make script_models model miscobj/searchlightbase.tik and give them all the same targetname . Then execute the script like this .

exec global/player_spotlight.scr mytargetname

The lights starts off and while you press the use key while standing close to them they light up . It will follow your view :roll: .

player_spotlight.scr

Posted: Sun Aug 01, 2004 4:33 am
by G3mInI
Will this work in multiplayer ? Specifically using it in a server side only mod ?

Posted: Sun Aug 01, 2004 4:47 am
by bdbodger
yes serverside mod . You can spawn the base . Key your finger on the use button while standing close to it or the light goes out .

Posted: Sun Aug 01, 2004 6:22 am
by G3mInI
Sweet! Great job bdbodger. Keep em coming! I have learned a great deal from your scripts, as well as others here. Best place to get information for the game as far as I am concerened.

G3mInI

Posted: Sun Aug 01, 2004 11:54 am
by bdbodger
working on version 2 with keys you can set like color of the light and I am going to make it on off . For example but an mg gun beside it and the use key will turn on the light as well as letting you use the gun . Also a key to set health of the light and if it will be destoyable or not . Right now it is so it will just be shot out right away and it won't be useable anymore . Any other suggestions are welcome .

light

Posted: Sun Aug 01, 2004 6:11 pm
by tltrude
Your mod is very cool!!! It would be nice if the light at the end of the beam stayed on all the time and not just when it hits somthing.

Image

In the above screenshot it is hitting a small object on a pole. But, if I move it slightly off the object, only the hedge behind is lit up.

Posted: Sun Aug 01, 2004 6:41 pm
by Master-Of-Fungus-Foo-D
that looks cool, but for a flashlight mod, you might want to make the spotlight scale smaller.

Posted: Sun Aug 01, 2004 7:07 pm
by SolidScope
I did what he said to do and mine didn't work. All it did was make the base of the light. The little half circle thing. Any ideas?

targetname

Posted: Sun Aug 01, 2004 7:19 pm
by tltrude
You have to put the targetname you gave to the base at the end of the line, like this.

level waittill prespawn

exec global/player_spotlight.scr
mytargetname

And, that script has to be in main/global.

Posted: Sun Aug 01, 2004 8:18 pm
by G3mInI
Master-Of-Fungus-Foo-D wrote:that looks cool, but for a flashlight mod, you might want to make the spotlight scale smaller.
umm all i got to say to that is :lol:

If you look closely I believe he is standing next to a spotlight he spawned. It is not mounted to the top of his weapon.

bdbodger I have implemented this script of yours into a server side mod of snow park, I put a spotlight at the top of each sniper stand on one of the railings.. great script... works and looks pretty cool.

Peace,
G3mInI

Re: targetname

Posted: Sun Aug 01, 2004 8:27 pm
by SolidScope
tltrude wrote:You have to put the targetname you gave to the base at the end of the line, like this.

level waittill prespawn

exec global/player_spotlight.scr
mytargetname

And, that script has to be in main/global.
Did that, nothing happened.

I spawned a script_model in my map. Gave it the key model and value of the .tik thing like I should. Gave it the targetname of flashlight. Then went into the maps .scr file, and after waittill prespawn put exec global/player_spotlight.scr flashlight

Posted: Sun Aug 01, 2004 10:10 pm
by G3mInI
Well it worked fine for me... did u actually put player_spotlight.scr into a folder called global and add it to the .pk3 file ?

My code ended up looking like this.. of course you would have a different origin and a different targetname....

First I created a thread after level waittill prespawn like so"

thread spawn_the_lights:

right after that statement I have:
exec global/snowy1_spotlight.scr sniper_spot // I renamed player_spotlight.scr to snowy1_spotlight.scr


then further down at the bottom of my script I have this thread:

spawn_the_lights:

local.spotty1 = spawn script_model
local.spotty1 model "miscobj/searchlightbase.tik"
local.spotty1.targetname = sniper_spot
local.spotty1.origin = ( 3885.64 -5395.82 570.00 )
local.spotty1.angles = (0.00 90.00 0.00 )
end


Now that works just fine for me and for the other 3 lights I have in the spawn_the_lights thread. All have the same targetname of sniper_spot.

G3mInI

Posted: Sun Aug 01, 2004 11:07 pm
by SolidScope
When I sayid "spawn" I meant go to my new bot map in radient, make a script_model, and give it the key model and value of the .tik. And also give it the targetname that I put after I exec the file in the maps .scr. Yes I did put it in the global folder. I'm not some n00b. But I'll try it again.

Posted: Sun Aug 01, 2004 11:38 pm
by Splaetos
that looks great BD =)

Posted: Mon Aug 02, 2004 1:26 am
by bdbodger
Well tom with a real searchlight if it does not hit anything you don't see the light at the end of the beam either .