Flickering light?

If you're looking for mapping help or you reckon you're a mapping guru, post your questions / solutions here

Moderator: Moderators

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

Flickering light?

Post by wacko »

Is it possible to make light flicker? I want to add some torches but the light they give should - well - flicker.
Image
[253RID]General-Haines
Sergeant Major
Posts: 114
Joined: Fri Jan 17, 2003 7:46 pm
Location: New Jersey USA
Contact:

Post by [253RID]General-Haines »

Glad u made this post I too was wondering how to make light ~Bulbs~ Flicker
253rd Regimental Infantry Division
Image
Our Spearhead Total conversion mod is now recruiting. http://www.thegreendevils.tk
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Will be a script... Hopefully one for all torches (bulbs) which I can give some values in the entity-inspector, so they won't flicker exactly in the same rhythm!
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Yes that's possible, and not even that difficult!

First, you need a model to emit light. It doesn't have to be a visible model, but should just be a model. You could use a script model with model 'fx/dummy.tik'. Assign a targetname of 'lightflicker'.

In your script, create these threads below your main thread. Remember to start the 'lights:' thread at level start-up (below waittill spawn)

Code: Select all

lights:
    for(local.i = 1; local.i <= $lightflicker.size; local.i++)
    {
        $lightflicker[local.i] light 256 0.9 0.7 0.7 // radius, RGB
        $lightflicker[local.i] thread flicker
    }
end

flicker:
    while(1)
    {
        self lightOn
        wait (randomfloat 1.5)
        self lightOff
        wait (randomfloat 1.5)
    }
end
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

This looks pretty easy! Thanks! Unfortunately, I have no script or a main thread. So, first I need to find something about this problem first. Is there a tut for monkeys? I was mapping all the time without scripting, these times seem to be over now.
If I need now special script for anything else in my map, is it enough to make a new textfile, copy the stuff in it and call it torchmap.scr or whatever and put it into the maps/dm folder together with the torchmap.map?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Code: Select all

main:
    level waittill spawn
    for(local.i = 1; local.i <= $lightflicker.size; local.i++)
    {
        $lightflicker[local.i] light 256 0.9 0.7 0.7 // radius, RGB
        $lightflicker[local.i] thread flicker
    }
end

flicker:
    while(1)
    {
        self lightOn
        wait (randomfloat 1.5)
        self lightOff
        wait (randomfloat 1.5)
    }
end
This should do it.
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Unfortunately nothing happens. Map is main/maps/dm/dm_crypt.map
I made a dm_crypt.scr with your code in main/maps/dm, in the map where this torch is, I replaced(!) the light entity with the script_model with classname:script_model, model:fx/dummy.tik, origin:-101.85 2.16 96.23, targetname:lightflicker and testanim:idle

Now there is no light, no flicker just a torch with flames (as before)
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

In 9 out of 10 cases, I'm just too stupid, but I'm trying now for don't know how long. Is there the slightest possibilty, that this can't work?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Have you enabled dynamic lighting in the advanced options?

Well there is a slight possibility it doesn't work :oops: .
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

I have enabeld everthing, turned everything to HIGH, MAX, COMPLEX, restarted MOHAA, checked script and map aqgain. No way :cry: Could you do a small map+scr to show us how?
[253RID]General-Haines
Sergeant Major
Posts: 114
Joined: Fri Jan 17, 2003 7:46 pm
Location: New Jersey USA
Contact:

Post by [253RID]General-Haines »

mine didnt work either :-( lol
253rd Regimental Infantry Division
Image
Our Spearhead Total conversion mod is now recruiting. http://www.thegreendevils.tk
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Something new? Could anyone make it work?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Hmm maybe try a different model :?
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

What kind of model did you have in mind? I tried fx/lanternflame.tik, but it made no difference...
Maybe you could comment your script, as I have really NO idea, what I could try to change in it.
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Thanks to Jv!
The solution is here
Post Reply