News:

Come Chat with us live! Learn how HERE!

Main Menu

Random light color

Started by rotacak, December 13, 2009, 04:48:29 PM

rotacak

Hi,
in file models/weapons/new_weapon/weapon.cfg is defined missileDlightColor 1 1 1
That mean white light. Is possible to use random color everytime when is weapon used? For example new luci: I will shot one bullet (color pink), second (red), third (blue) etc.

I tried missileDlightColor 0~1 0~1 0~1 but it not work. Even this will be bugged, because result can be 0 0 0, but anyway, it not work at all.

nubcake

Quote from: rotacak on December 13, 2009, 04:48:29 PM
Hi,
in file models/weapons/new_weapon/weapon.cfg is defined missileDlightColor 1 1 1
That mean white light. Is possible to use random color everytime when is weapon used? For example new luci: I will shot one bullet (color pink), second (red), third (blue) etc.

I tried missileDlightColor 0~1 0~1 0~1 but it not work. Even this will be bugged, because result can be 0 0 0, but anyway, it not work at all.

Its been awhile since i programmed but perhaps you program a random integer?

for example
Define SHORT Luci_Ball_Col
{
Luci_Ball_Col == 1 - (rnd*1+0.1)
}
missileDlightColor Luci_Ball_Col Luci_Ball_Col Luci_Ball_Col;

Sorry I forgot C++ command for random, but basically make it random between 0.1 and 1. I believe you have to use a variable in the command as missileDlightColor Will only accept integers (or short/long I dont know I havent checked).

David

Except that the weapon cfg's aren't C...
Any maps not in the MG repo?  Email me or come to irc.freenode.net/#mg.
--
My words are mine and mine alone.  I can't speak for anyone else, and there is no one who can speak for me.  If I ever make a post that gives the opinions or positions of other users or groups, then they will be clearly labeled as such.
I'm disappointed that people's past actions have forced me to state what should be obvious.
I am not a dev.  Nothing I say counts for anything.

nubcake

Quote from: David on December 13, 2009, 05:18:45 PM
Except that the weapon cfg's aren't C...

Well whatever language they are written in the same principle applies you cannot assign a variable which only accepts certain Datatypes another datatype. In this case, im sure missileDlightColor only accepts INTs or SHORTs therefore you cannot plug in an argument, as it will only accept a number, not an equation (0~1 is an equation, not a number). Therefore you need to make you OWN equation seperate from missileDlightColor to accept. As in the example I gave above

seeeker

From my messing around with it, I concluded it was buggy, it only produced white colors no matter what parameters it was given. (i think)