Page 1 of 1
destroyab;le spotlight
Posted: Sun Jan 04, 2009 4:57 pm
by Aprop
I know its very easy thing, but i want see any tutorials etc... i know how replace spotlight model to destroyed(???) or change anim, if its possible... do i need make a script light for spotlight? I havent time for looking in whole web for tuts, but im keep my maps realistic, light can be switched on and off, and surly lightbulb can destroyed....but i want make spotlight using they models too, so, any tuts?
Posted: Sun Jan 04, 2009 6:41 pm
by Condor
I am not sure what you exactly want to do.
If you want to make a spotlight, that can be switched on and off, create a script_object, create this keys and values:
targetname spotlight
model miscobj/searchlight.tik
Create a trigger_use around your on/off switch and give it the key and value:
setthread switchspot
Create a trigger_multiple around your spotlight and give it the key and value:
setthread killspot
health 10
targetname killspottrigger
Activate "DAMAGE" in the Entity window for this trigger.
script:
Code: Select all
main:
level.spotstat = 0
end
switchspot:
if (level.spotstat == 1)
{
$spotlight.model = "miscobj/searchlightoff.tik"
level.spotstat = 0
} else {
$spotlight.model = "miscobj/searchlight.tik"
level.spotstat = 1
}
end
killspot:
$killspottrigger nottriggerable
$spotlight.model = "miscobj/searchlightoff.tik"
level.spotstat = -1
end
There is no searchlightdestroyed model. searchlightoff.tik is already destroyed.
Posted: Sun Jan 04, 2009 7:11 pm
by $oldier Of Ra
You might want to increase the health though, unless you want 1 shot and out, If you put it's health at 100, a single mg bullet is enough to kill it so take 150 if you want it to last at least 2 bullets.
So for mapping do what condor says. Basically, the same applies for scripting if you want to do it solely with script. Since this is the scripting forum I'll tell something you'll probably don't know how to do in scripting: The DAMAGE flag is spawnflags 128 in scripting.
Posted: Sun Jan 04, 2009 7:15 pm
by Condor
You can kill the spotlights in the sp map with one shot ... I think this spotlights are not that robust as the flashlight in Doom 3..you can kill zombies with it

Posted: Mon Jan 05, 2009 12:43 pm
by Aprop
Main question was: how turn on and off spotlight light.. so imiscobj/searchlight.tik is the LIGHT ON model, earchlightoff.tik is LIGHT OFF model, so dont need to spawn any light... well so that's all, thanks.
Btw showed here script is a bit laborious, i'll need to rewrite it at all...get it to not use global var's, change targetnamed entities to locals.. etc
Posted: Mon Jan 05, 2009 1:00 pm
by Condor
Well, how do you want to destroy the spotlight?
Posted: Mon Jan 05, 2009 1:53 pm
by $oldier Of Ra
He means that he wants to turn the light on and off, not blow it. Try using the lightOff and lightOn commands on a spawned spotlight.
But you could use the search button, the search button is a blessing that's often ignored in forums. Believe me, after 7 years and 101651 articles, people have asked a lot of things and a lot of same things. There are quite a few topics dealing with spotlights. Some of which explain you how to control the light yourself. Here's the one:
/forum/viewtopic.php?t=11011&start=0
If you're unfamiliar with funcbeam, no worries, it's extremely easy. Not worth an explanation. And you'll find a lot more topics about spotlights when you search for it.
Posted: Mon Jan 05, 2009 2:18 pm
by Condor
I think it would be better to create a notsolid script_object with the shape of the lit up ground/walls, which is outside the level limits (not the world limits), but lit up by usual lights while the compiling process.
If you switch on the light the first time, this part of the ground/walls/etc.) gets moved to the position where its not-lit-up brother is (also a script object), which gets hidden as long as the light is on, so you don't need that slow, buggy dynamic lighting.
You can use the lightmaps from the compiling process, but it only works, if the manually lit-up part of the level is not very detailed and outside.
If you switch of the light, you just hide this script_object. I would not use dynamic lighting, if you have lots of spots etc. that can be switched on and off.
Posted: Mon Jan 05, 2009 3:22 pm
by Aprop
Condor wrote:Well, how do you want to destroy the spotlight?
Simple! Shootin' in it!