AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   random(256) in one case (https://forums.alliedmods.net/showthread.php?t=275668)

iLlegalzp 12-05-2015 17:03

random(256) in one case
 
So is it possible that the code below will give you become in a case that is not to add all the colors one by one and be in one case again all colors random (256) (to run arbitrary color of the 256?

PHP Code:

         case 0..5:
         {
            
rgbaura = {105105105}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell105105105kRenderNormal25);
         }
         case 
6..11
         {
            
rgbaura = {112128144}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell112128144kRenderNormal25);
         }
         case 
12..17:
         {
            
rgbaura = {190190190}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell190190190kRenderNormal25);
         }
         case 
18..23:
         {
            
rgbaura = {2525112}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell2525112kRenderNormal25);
         }
         case 
24..29:
         {
            
rgbaura = {00128}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell00128kRenderNormal25);
         }
         case 
30..35:
         {
            
rgbaura = {100149237}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell100149237kRenderNormal25);
         }
         case 
36..41:
         {
            
rgbaura = {132112255}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell132112255kRenderNormal25);
         }
         case 
42..47:
         {
            
rgbaura = {00255}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell00255kRenderNormal25);
         }
         default:
         {
            
g_nemaura[ID_AURA] = 0
            rgbaura 
= {15000}
         }
      } 


Bugsy 12-05-2015 17:08

Re: random(256) in one case
 
I don't understand what you are asking.

iLlegalzp 12-05-2015 17:35

Re: random(256) in one case
 
The code is for the nemesis aura, now i have to add all 256 colors one by one this is hard because i don't have enough time so i want to add all 256 colors in one case :)

Bugsy 12-05-2015 18:03

Re: random(256) in one case
 
Is there a mathematical relationship between the case and the respective RGB values?

Example, is there any relationship between:
case 12..17 and rgbaura = {190, 190, 190}
case 18..23 and rgbaura = {25, 25, 112}

iLlegalzp 12-05-2015 18:31

Re: random(256) in one case
 
Quote:

Originally Posted by Bugsy (Post 2369136)
Is there a mathematical relationship between the case and the respective RGB values?

Example, is there any relationship between:
case 12..17 and rgbaura = {190, 190, 190}
case 18..23 and rgbaura = {25, 25, 112}

every case number is +6 but i didn't undertand you what do you mena ?

for example

PHP Code:

            case 0..5:
            {
                
rgbaura = {2525112}
            }
            case 
6..11
            { 

only that ?

Bugsy 12-05-2015 19:08

Re: random(256) in one case
 
I was thinking, is there any way to mathematically derive 25,25,112 with the respecitve case 0..5. I dont think there is, they all look random

fysiks 12-06-2015 22:11

Re: random(256) in one case
 
Basically, if you don't have a mathematical method (a forumula) for determining the what the R, G, and B values are for each case then it's not possible to not write them all out.

UNLESS, you are actually meaning that you want R to be random, G to be random, and B to be random (this will give you a random color every time). In this case, you can do this:

PHP Code:

rgbaura[0] = random(256);
rgbaura[1] = random(256);
rgbaura[2] = random(256); 

Also, you should never assign a whole array using an equal sign unless it is when you declare the variable (when you use "new"). In your case, you should assign each of the three values as shown above.

iLlegalzp 12-07-2015 05:06

Re: random(256) in one case
 
Where exactly i have to add it ?

Depresie 12-07-2015 05:13

Re: random(256) in one case
 
just delete switch and case and add this instead of it

PHP Code:

new red random_num(0,256)
new 
green rendom_num(0,256)
new 
blue random_num(0,256)

fm_set_rendering(ID_AURAkRenderFxGlowShellredgreenbluekRenderNormal25); 



All times are GMT -4. The time now is 17:49.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.