Author Topic: Random light color  (Read 4367 times)

rotacak

  • Posts: 761
  • Turrets: +39/-64
Random light color
« 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.

nubcake

  • Posts: 529
  • Turrets: +49/-85
Re: Random light color
« Reply #1 on: December 13, 2009, 05:07:48 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

  • Spam Killer
  • *
  • Posts: 3543
  • Turrets: +249/-273
Re: Random light color
« Reply #2 on: December 13, 2009, 05:18:45 pm »
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

  • Posts: 529
  • Turrets: +49/-85
Re: Random light color
« Reply #3 on: December 14, 2009, 06:41:50 am »
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

  • Posts: 122
  • Turrets: +19/-5
Re: Random light color
« Reply #4 on: December 25, 2009, 03:21:51 am »
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)