destroyab;le spotlight

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

destroyab;le spotlight

Post 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?
Condor
Colour Sergeant
Posts: 82
Joined: Mon Apr 09, 2007 3:19 pm
Location: Bavaria (Germany)

Post 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.
Last edited by Condor on Sun Jan 04, 2009 7:12 pm, edited 1 time in total.
...waking up in the middle of the night with your hands covered in blood and you have no idea what happened.
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
Condor
Colour Sergeant
Posts: 82
Joined: Mon Apr 09, 2007 3:19 pm
Location: Bavaria (Germany)

Post 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 :P
...waking up in the middle of the night with your hands covered in blood and you have no idea what happened.
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post 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
Condor
Colour Sergeant
Posts: 82
Joined: Mon Apr 09, 2007 3:19 pm
Location: Bavaria (Germany)

Post by Condor »

Well, how do you want to destroy the spotlight?
...waking up in the middle of the night with your hands covered in blood and you have no idea what happened.
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
Condor
Colour Sergeant
Posts: 82
Joined: Mon Apr 09, 2007 3:19 pm
Location: Bavaria (Germany)

Post 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.
...waking up in the middle of the night with your hands covered in blood and you have no idea what happened.
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Condor wrote:Well, how do you want to destroy the spotlight?
Simple! Shootin' in it!
Post Reply