Raised This Month: $ Target: $400
 0% 

Is there a way to set random colours on tempents?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 11-06-2018 , 21:14   Is there a way to set random colours on tempents?
Reply With Quote #1

I'm trying to make a plugin that creates a bunch of props when another prop is broken and shoot them out everywhere with a randomly coloured beam following them.

This is how I'm creating the props:
PHP Code:
        int entNum GetRandomInt(520);

        for(
int i 0entNumi++)
        {
            
int ent CreateEntityByName("prop_physics_override");
            
DispatchKeyValue(ent"Health""0");
            
DispatchKeyValue(ent"Model""models/items/boxmrounds.mdl");
            
HookSingleEntityOutput(ent"OnPlayerUse"OnPlayerUsetrue);
            
            
int rgba[4] = { GetRandomInt(0255), GetRandomInt(0255), GetRandomInt(0255), 255 };
            
TE_SetupBeamFollow(entg_iLaserg_iHalo10.05.01.010rgba);
            
DispatchSpawn(ent);

            
float pos[3], velocity[3];
            
GetEntPropVector(victimProp_Send"m_vecOrigin"pos);
            
velocity[0] = GetRandomFloat(0.020.0);
            
velocity[1] = GetRandomFloat(0.020.0);
            
velocity[2] = GetRandomFloat(0.020.0);
            
TeleportEntity(entposNULL_VECTORvelocity);
            
TE_SendToAll();
        } 
And this is where I'm having trouble:
PHP Code:
            int rgba[4] = { GetRandomInt(0255), GetRandomInt(0255), GetRandomInt(0255), 255 };
            
TE_SetupBeamFollow(entg_iLaserg_iHalo10.05.01.010rgba); 
Every time I try to compile while setting the colour randomly I get an error of: error 008: must be a constant expression; assumed zero
I know I could just use a switch statement to pick colours but I'd much prefer being able to have it completely random.

Thanks in advance.
CliptonHeist is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:02.


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