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

Members Online

»
0 Active | 83 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP 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 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Toggle light and light colors
COD4GRC
General Member
Since: Aug 12, 2007
Posts: 44
Last: Jan 30, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Wednesday, Sep. 9, 2009 10:47 am
Hi everyone,

I know how to add a light in Radiant, but I'd like to know how to toggle the light (on / off), or change the color.

This is what i tried:

Code:
lights = getentarray("flashlights", "targetname");
for(i = 0; i < lights.size; i++)
  lights[i] hide();



Code:
light = spawn("light", lights[0].origin);
light.script_color = (1.0, 0.0, 0.0);
light.script_radius = 500;
light show();



But unfortunately none of these worked (but gave no script errors). Any of you guys have an idea?


edited on Sep. 9, 2009 06:53 am by COD4GRC
Share |
tomalla
General Member
Since: Jan 16, 2007
Posts: 393
Last: Jun 10, 2012
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Wednesday, Sep. 9, 2009 01:50 pm
Lights are built in a map after compiling process. You can't modify them in-game by script ( i.e. move them, change their colors etc. ).

But there is easy way to create your own light FX. Then you could manage to script its behavior.
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Wednesday, Sep. 9, 2009 07:01 pm
isn't it actually possible to move the light but nothing else like changing the color etc.? well, it won't work with dynamic lights turned off in the settings for sure.
Share |
hyper1234
General Member
Since: Mar 17, 2009
Posts: 358
Last: Apr 14, 2011
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Wednesday, Sep. 9, 2009 09:41 pm
I dont really have an aswer to this but...my friend PwN3R makes mods/maps/scripts etc. Anyways...on one of his maps he has like a beam of light and it shoots up into the air and changed colour red>green>blue etc.

Not sure if this clears anything up.

If you have any question or want his help then add him xire

Xf:punishman1993
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Wednesday, Sep. 9, 2009 10:15 pm
it's probably done via efx, have a look at the (cod4) tutorial section for a EffectsEd introduction
Share |
COD4GRC
General Member
Since: Aug 12, 2007
Posts: 44
Last: Jan 30, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Monday, Sep. 14, 2009 11:38 pm
Sorry, forgot to tell you guys how I fixed it [crazy]

I got a tip from Derix, who pointed me to this (Belgian) webpage:
http://www.modbase.be/tutorials-cod2.php?tutorial_id=99

Summary:

1. Make a script_model with no model (lol)
2. Give color using 'K'
3. Replace '_color' key for 'color' (remove underscore)
4. Give the script_model a key/value 'radius'

This should work.

About switching lights on/off, I used a hack I'm not very proud of, but it works :D

Code:
light moveto(invisible_origin.origin, 0.01);


A result can be viewed here:
http://www.youtube.com/watch?v=DIgYCahGD7Y


Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 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

»