Thriller light beam ? Plz help

Post your scripting questions / solutions here

Moderator: Moderators

[NER-BNL]Veteran
Lance Corporal
Posts: 14
Joined: Mon Nov 22, 2004 1:20 pm
Location: Gouda

Thriller light beam ? Plz help

Post by [NER-BNL]Veteran »

Does anyone know how to make a light beam go on and off , like in those thriller movie.

// Scene is a dark hallway in a mental institution

Someone please help, or point me to a tut.

Greetz Veti (Mapping noob)
---===[ Reality is a disillusion caused by a shortage of alcohol...!!! ]===---
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

give your light a key/value of

targetname/flickerLight

and put this into notepad

Code: Select all

main:

// misc DM stuff and other junk that needs to be included

level waittill spawn

level.flickerThatLight = 1
thread flickeringLight

end

flickeringLight:

while(level.flickerThatLight == 1)
{
wait 15
$flickerLight hide
wait .3
$flickerLight show
wait 2
$flickerLight hide
wait .3
$flickerLight show
wait .5
$flickerLight hide
wait 5
$flickerlight hide
wait .5
$flickerLight show
}

end
save it as the same name as your map with a .scr extension instead. (say your map's name is myMap.map, save this as myMap.scr) and put it with the map after you've compiled :)

this is a pretty smple bit of code, hide makes it disappear, show makes it appear. it's a really cool effect though, when applied indoors.

mess with those wait values (wait 5) to get the light flickering just like you want it, i used those for an electric light in a dark garrison once. it had a cool effect in the building, but the model's shading looked awful, so use wisely.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

I would recommend adding a corona to make it more realistic.
Then, I couldn't make a light entity hide or show ingame.
But:
u can add to ur map a script_origin and make it light in the script. This light though will be visible on the backsides of walls it shines on :?
If u don't care, then here we go:
Add a light bulb. :wink:
Add a script_origin where u want the light to be. Give it model : fx/dummy.tik and targetname : fx_light_01
Add another script_origin where u want the corona to be. Give it model : static/corona_reg.tik and targetname : fx_light_01 and imho scale : 0.5
In ur script something like

Code: Select all

main: 
// misc DM stuff and other junk that needs to be included 
level waittill spawn 
thread flickeringLight 
end 

flickeringLight: 
while(1) 
{ 
	wait (randomfloat 2)
	$fx_light_01 light 1 1 1 (randomfloat 100+300)
 	$fx_corona_01 show 
	wait (randomfloat 2) 
	$fx_light_01 light 1 1 1 0 //R(0-1) G(0-1) B(0-1) Radius
	$fx_corona_01 hide 
} 
end
Here's this stuff (map+scr) in a zip

Dunno what the randomize parameters do (well, change the values, but how exactly) and I was too lazy to find out. :oops:
Last edited by wacko on Mon Jan 17, 2005 3:58 pm, edited 1 time in total.
[NER-BNL]Veteran
Lance Corporal
Posts: 14
Joined: Mon Nov 22, 2004 1:20 pm
Location: Gouda

Post by [NER-BNL]Veteran »

Thanx wacko, gonna try it out right away!!!

Greetz Veti
---===[ Reality is a disillusion caused by a shortage of alcohol...!!! ]===---
Elgan
Lieutenant General
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

isnt (randomfloat 100+300) the same as (randomfloat 400):S

and flloat
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Elgan wrote:isnt (randomfloat 100+300) the same as (randomfloat 400):S

and flloat
if I only knew :oops: i think it does a random number between 300 and 400 or 200 and 400 or dunno. then, there's 'randomint 300 100' which imho does from 300 to 400.
But this is rather embarrassing, cauz prob there are more who know than who don't. All I know is that 'randomflow max' and 'randomint max' return a value between 0 and max and 'randomfloat a b' does something else :wink:
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

isnt (randomfloat 100+300) the same as (randomfloat 400):S

and flloat
(randomfloat 100 + 300) is every number between 300 and 399 , randomfloat 400 is every number between 0 and 399 and randomfloat (100 + 300) is the same as randomfloat 400 isn't it ?
Image
Elgan
Lieutenant General
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

bdbodger wrote:
isnt (randomfloat 100+300) the same as (randomfloat 400):S

and flloat
(randomfloat 100 + 300) is every number between 300 and 399 , randomfloat 400 is every number between 0 and 399 and randomfloat (100 + 300) is the same as randomfloat 400 isn't it ?
i guess that wud make sense. didnt know that you could set a min and a max using +:S
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

sounds good, yes. thnx Bd :D

So:
randomint and randomfloat do the same but randomint can just handle integers?!
and
randomint (value) gives a result of between 0 and (value)
randomint (value) + anothervalue obviously (now :roll: ) a result between (0 + anothervalue) and (value + anothervalue). So it's not a special min and max parameter, but rather simple mathematics, like anynumber + 5 is more than 5 and less than anynumber + 6. :wink:

Any objections or coments?
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

not sure how many digits randomfloat goes to 4 maybe ? 300.0000 to 399.9999 ?
Image
[NER-BNL]Veteran
Lance Corporal
Posts: 14
Joined: Mon Nov 22, 2004 1:20 pm
Location: Gouda

Post by [NER-BNL]Veteran »

:shock: This is how i'm sitting behind my comp right now....
Tried the lightbeam tut.. made the texture, but it shows up as a black and blue squared texture... I'm i missing something or... i'm i just being blond again..?

Got a problem with the compiler also... When i compile it starts up mohaa, but console opens, and it reads CAN'T FIND LOCALISATION ENTRY... and COULDN"T LOAD thriller.bsp

(couldn't make a screenie , sinds i haven't got I-net at the moment :( )
---===[ Reality is a disillusion caused by a shortage of alcohol...!!! ]===---
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

I presume u see black/blue squares in radiant!?

what did u call ur texture, where did u put it?
what is in ur shader file?
[NER-BNL]Veteran
Lance Corporal
Posts: 14
Joined: Mon Nov 22, 2004 1:20 pm
Location: Gouda

Post by [NER-BNL]Veteran »

shader text was a copy past of your tut, and named the textures the same.. Just put it in my_textures instead of beam... but made only those changes in the text of the shader that reffered to ....\textures\beam

and yes it shows up in black/blue in radiant...

Can't test the map ... cause he can't find the .bsp of my map.... Mbuilder doesn't create it or something
---===[ Reality is a disillusion caused by a shortage of alcohol...!!! ]===---
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

So, u're shader looks like:

Code: Select all

textures/my_textures/beamfade
{ 
qer_editorimage textures/my_textures/beamfade.tga 
qer_keyword utility 
qer_trans .4 
surfaceparm nolightmap 
surfaceparm nonsolid 
surfaceparm trans 
cull none 
sort additive 
{
map textures/my_textures/beamdust.tga 
blendFunc add 
tcMod scroll 0.05 0 
tcMod scale 1 1
nextbundle
map textures/my_textures/beamfade.tga 
}
}
The tga files are 24bit and in mohaa/main/textures/my_textures/beamdust.tga and mohaa/main/textures/my_textures/beamfade.tga

plz check this (typo?)


then 'bout mbuilder.
it does show the map in the map list (lower right)? Then it has found it. Open the 'other options' and check the 'Pause after...'. U will now be able to read what it did in e.g. the bsp stage. There's probably a leak in ur map u'd have to fix first.
[NER-BNL]Veteran
Lance Corporal
Posts: 14
Joined: Mon Nov 22, 2004 1:20 pm
Location: Gouda

Post by [NER-BNL]Veteran »

oke i'll check it... but even with the simple room it didn't work.. :(
paths are set correctly...

Could it be that i got a soundfix from Wombat installed, my some of my sounds dissappeared after dl'ing a map... used the wombat soundfix to fix it..
---===[ Reality is a disillusion caused by a shortage of alcohol...!!! ]===---
Post Reply