Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds
Watch MODSonair

Members Online

»
1 Active | 51 Guests
Online:

LATEST FORUM THREADS

»
Call of DutyŽ: WWII
CoD WW2 General
SOF2 Prefabs map
SoFII Mapping
coduo mapping tools
CoDUO Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Trouble creating a Flickering light in Single Player and MP
Freakyfreak
General Member
Since: Jan 8, 2014
Posts: 9
Last: Jan 27, 2014
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Sunday, Jan. 26, 2014 11:03 pm
I'm working on a horror themed COD 4 single player map and would like to create randomized flickering lights. After searching for tutorials and forums I found some info. Zeroy has a good tutorial at http://www.modsonline.com/BBCode-url.html?//wiki.modsrepository.com/index.php/Call_of_Duty_4:_Switches_Primary_Light

The tutorial works to a point, but I'm still running into the issue of turning the light off completely. The tutorial is working in the sense of moving the script brush over the light, but there still is light in the room. It seems the light is baked into the room. After testing I found that lights are complied before script brushes so although the light turns off and on there is still a light in the room. I tried primary_scriptable and primary spot lights. Also tried using static lights and fx lights. Nothing seems to work. The static lights don't turn off and fx lights don't cast shadows.

Any help would be awesome. I've spent two days trying to tackle this beast and its winning.
Share |
3st0nian
General Member
Since: Jan 14, 2008
Posts: 291
Last: Dec 4, 2017
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Monday, Jan. 27, 2014 03:33 am
I'm afraid you cant vanish light completely. I messed around with it few years ago and there was always certain amount of light left.
Share |
Freakyfreak
General Member
Since: Jan 8, 2014
Posts: 9
Last: Jan 27, 2014
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Monday, Jan. 27, 2014 08:04 am
I've seen a few videos in the forums here showing a light turning on and off without leaving a baked light. Curious on how they were able to achieve this, through a primary, static or FX light.
It is just puzzling me and holding up my map.
Share |
3st0nian
General Member
Since: Jan 14, 2008
Posts: 291
Last: Dec 4, 2017
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Monday, Jan. 27, 2014 08:15 am
Have you tried messing with these functions:
setlightexponent
setlightfovrange
setlightintensity
setlightradius

http://zeroy.com/script/
Share |
Freakyfreak
General Member
Since: Jan 8, 2014
Posts: 9
Last: Jan 27, 2014
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Monday, Jan. 27, 2014 08:21 am
I have not tried those yet. I'll have to give them a try. I could probably set the light intensity to 0 at the beginning then bump it up to the intensity I want on a randomized timer. That might just be the answer. I'll give it a go and post me results.
Share |
StrYdeR
General Member
Since: May 11, 2004
Posts: 11656
Last: Jul 3, 2019
[view latest posts]
Level 10
Admin
Forum Moderator
Im a HOST of MODSonair
Category: CoD4 Scripting
Posted: Monday, Jan. 27, 2014 09:24 am
from my recollection you can turn an FX on and off - though it doesn't create a shadow

there was a process implemented into the engine with WaW that allowed for a hanging light that could swing (when shot for example) and cast dynamic shadows

you may be able to implement that into your theme of what you are trying to do. have a look at the lantern hanging in the bunker level and the scripting therein. this swinging light was also used in the zombie level (asylum) - upstairs

[angryalien]
Share |
Freakyfreak
General Member
Since: Jan 8, 2014
Posts: 9
Last: Jan 27, 2014
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Monday, Jan. 27, 2014 09:44 am
I don't have WaW sadly. Do you know of anything in COD 4 that is similar?
Share |
SparkyMcSparks
General Member
Since: Feb 27, 2004
Posts: 1713
Last: Dec 29, 2016
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Monday, Jan. 27, 2014 09:19 pm
The rope / swinging light can't be done in CoD4, at least not like WaW -- it has special code support to create rope that was created for WaW which isn't in CoD4 (nor any of IW's games for that matter).
Share |
Freakyfreak
General Member
Since: Jan 8, 2014
Posts: 9
Last: Jan 27, 2014
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Monday, Jan. 27, 2014 11:45 pm
After some playing around and running through Blackout I was able to find scripting in the _lights.gsc file that can help create flickering lights. I was able to use a variation of that script with scriptable lights to make a light that is dark then can be turned on and off without baked light in the level.

Here is my script for anyone that is looking to create a similar effect.
Put
#include maps\_utility;
above main() in your .gsc file
In main() be sure to have maps\_load::main();
then thread function flickerlight_test or whatever name you want

flickerlight_test()
{
light = getent( "light_flicker_test", "targetname" );
wait_for_targetname_trigger( "switch" );

//light notify( "light_off" );
while(1)
{
light setLightIntensity( 5 );
wait 0.3 + randomFloat(0.7);
light setLightIntensity( 0 );
wait 0.05 + randomFloat(0.05);
}

}

In radiant the steps are:

Create a primary_scriptable light with primary_spot checked also. Set up the light like any spotlight. To start out dark set the intensity to .05 on the light. Give the light a targetname so it can be found in script, I used "light_flicker_test". To trigger the light I created a trigger_use with the targetname "switch". Once the player hits activates the trigger the light turns on to intensity 5 and randomly deems back down to 0.

I hope this helps anyone else looking for a flickering light without using FX lights. Thanks to everyone that replied to my need for help. Special thanks to 3st0nian for the suggestion for a few functions that did eventually work, but the light wasn't set up correctly when I tried earlier.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»