Answered Rain Models

Status
Not open for further replies.

Ways

Veteran
Messages
141
Points
578
Does anybody know a good Rain script? I need one for my level effects...

 
Last edited by a moderator:

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,616
Points
828
You said you need a Rain function with effects, here is my one:
PHP:
fx_system(effect,range)
{
    self notify("stop_me_my_friend");
    self endon("stop_me_my_friend");
    self.vars["fx_system"] = true;
    if(!isinarray( level._effect, level._effect[ effect ]))
    {
        S("^1This Function needs this Effect :"+effect+". Which is not implemented on this Map.\nPlease Report this Bug on CabConModding\nINFO: Mapname: ^1"+getMapName()+"^7 Effect: ^1"+effect+"");
        return 0;
    }
    if(!isEmpty(range))
        range = 500;
    for(;;)
    {
        PlayFX( level._effect[effect], getRandomPos(500));
        wait RandomFloatRange( 0, .2 );
        if(randomintrange( 0, 10 )==5)
            wait RandomFloatRange( 2, 7 );
    }
}
fx_system_stop()
{
    if(self.vars["fx_system"] == false)
    {
        self notify("stop_me_my_friend");
        S("Fx System ^1OFF");
    }
    else  
        S("^1Is alreasy OFF. Select a FX to start the FX System.");
}

Toogler_FX_System(effect,range)
{
    self notify("stop_me_my_friend");
    self endon("stop_me_my_friend");
    self.vars["fx_system"] = !self.vars["fx_system"];
    if(self.vars["fx_system"] == true)
    {
        S("^2ON");
        self thread fx_system(effect,range);
    }
    else
    {
        S("^1OFF");
        self thread fx_system_stop();
    }
}

That is my normal Model Rain Function:
PHP:
getOptionName()
{
return "Option Name";
}
entity_rain(i)
{
    self thread entity_rain_fuc(i);
    self iPrintln("Rain Entity("+getOptionName()+")");
}
entity_rain_fuc(i)
{
    self endon("death");
    self endon("entity_rain_stop");
    for(;;)
    {
        if(!isdefined(self.ForgeEntity))
                self.ForgeEntity = [];
            if(!isdefined(self.CountForgeEntity))
               self.CountForgeEntity = 0;
            if(self.CountForgeEntity >= 99)
                self.CountForgeEntity = 0;
            if(isdefined(self.ForgeEntity[self.CountForgeEntity]))
                {
                      self.ForgeEntity[self.CountForgeEntity] notify("StopAnimEntity");
                       self.ForgeEntity[self.CountForgeEntity] delete();
                       self.ForgeEntity[self.CountForgeEntity] = undefined;
                }
        self.ForgeEntity[self.CountForgeEntity] = spawn("script_model",getRandomPos(2000,randomintrange(1100,1200)));
        self.ForgeEntity[self.CountForgeEntity] setmodel(i);
        self.ForgeEntity[self.CountForgeEntity] PhysicsLaunch();
        self.CountForgeEntity++;
        wait 0.7;
    }
}
DeleteAftaTime()
{
    wait 10;
    self delete();
}

DeleteAllEntity()
{
    if(isDefined(self.ForgeEntity))
    {
        for (i = 0; i < 100; i++)
        {
            if(isdefined(self.ForgeEntity[i]))
           {
               self.ForgeEntity[i] delete();
               self.ForgeEntity[i] = undefined;
           }
        }
    }
    self S("All entity ^2deleted");
}
Utilities for booth:
PHP:
getRandomPos(value,value_z)
{
if(isEmpty(value_z))
    value_z = 0;
return self.origin + (randomintrange(0-value,value),randomintrange(0-value,value),value_z);
}

isEmpty(var)
{
    if(var == "" || !isDefined(var))
        return true;
    else
        return false;
}

S(i)
{
    self iprintln(i);
}
That's my old Function (is pretty bad):
PHP:
func_do_rainmodel(input)
{
    if(self.sphererain == false )
    {
        self.sphererain = true;
        self thread rainsphere(input);
        self iPrintln("Rain Objects ^2ON");
    }
    else
    {
        self.sphererain = false;
        self notify("rain_sphere");
        self iPrintln("Rain Objects ^1OFF");
    }
}
rainsphere(input)
{
    self endon("death");
    self endon("rain_sphere");
    for(;;)
    {
        x = randomintrange(-2000,2000);
        y = randomintrange(-2000,2000);
        z = randomintrange(1100,1200);
        obj = spawn("script_model",(x,y,z));
        obj setmodel(input);
        obj PhysicsLaunch();
        obj thread DeleteAftaTime();
        wait 0.07;
    }
}
DeleteAftaTime()
{
    wait 10;
    self delete();
}
 

candy

G59 Terrorist
Staff member
Premium Member
Donator
Messages
1,307
Points
748
You said you need a Rain function with effects, here is my one:
PHP:
fx_system(effect,range)
{
    self notify("stop_me_my_friend");
    self endon("stop_me_my_friend");
    self.vars["fx_system"] = true;
    if(!isinarray( level._effect, level._effect[ effect ]))
    {
        S("^1This Function needs this Effect :"+effect+". Which is not implemented on this Map.\nPlease Report this Bug on CabConModding\nINFO: Mapname: ^1"+getMapName()+"^7 Effect: ^1"+effect+"");
        return 0;
    }
    if(!isEmpty(range))
        range = 500;
    for(;;)
    {
        PlayFX( level._effect[effect], getRandomPos(500));
        wait RandomFloatRange( 0, .2 );
        if(randomintrange( 0, 10 )==5)
            wait RandomFloatRange( 2, 7 );
    }
}
fx_system_stop()
{
    if(self.vars["fx_system"] == false)
    {
        self notify("stop_me_my_friend");
        S("Fx System ^1OFF");
    }
    else 
        S("^1Is alreasy OFF. Select a FX to start the FX System.");
}

Toogler_FX_System(effect,range)
{
    self notify("stop_me_my_friend");
    self endon("stop_me_my_friend");
    self.vars["fx_system"] = !self.vars["fx_system"];
    if(self.vars["fx_system"] == true)
    {
        S("^2ON");
        self thread fx_system(effect,range);
    }
    else
    {
        S("^1OFF");
        self thread fx_system_stop();
    }
}

That is my normal Model Rain Function:
PHP:
getOptionName()
{
return "Option Name";
}
entity_rain(i)
{
    self thread entity_rain_fuc(i);
    self iPrintln("Rain Entity("+getOptionName()+")");
}
entity_rain_fuc(i)
{
    self endon("death");
    self endon("entity_rain_stop");
    for(;;)
    {
        if(!isdefined(self.ForgeEntity))
                self.ForgeEntity = [];
            if(!isdefined(self.CountForgeEntity))
               self.CountForgeEntity = 0;
            if(self.CountForgeEntity >= 99)
                self.CountForgeEntity = 0;
            if(isdefined(self.ForgeEntity[self.CountForgeEntity]))
                {
                      self.ForgeEntity[self.CountForgeEntity] notify("StopAnimEntity");
                       self.ForgeEntity[self.CountForgeEntity] delete();
                       self.ForgeEntity[self.CountForgeEntity] = undefined;
                }
        self.ForgeEntity[self.CountForgeEntity] = spawn("script_model",getRandomPos(2000,randomintrange(1100,1200)));
        self.ForgeEntity[self.CountForgeEntity] setmodel(i);
        self.ForgeEntity[self.CountForgeEntity] PhysicsLaunch();
        self.CountForgeEntity++;
        wait 0.7;
    }
}
DeleteAftaTime()
{
    wait 10;
    self delete();
}

DeleteAllEntity()
{
    if(isDefined(self.ForgeEntity))
    {
        for (i = 0; i < 100; i++)
        {
            if(isdefined(self.ForgeEntity[i]))
           {
               self.ForgeEntity[i] delete();
               self.ForgeEntity[i] = undefined;
           }
        }
    }
    self S("All entity ^2deleted");
}
Utilities for booth:
PHP:
getRandomPos(value,value_z)
{
if(isEmpty(value_z))
    value_z = 0;
return self.origin + (randomintrange(0-value,value),randomintrange(0-value,value),value_z);
}

isEmpty(var)
{
    if(var == "" || !isDefined(var))
        return true;
    else
        return false;
}

S(i)
{
    self iprintln(i);
}
That's my old Function (is pretty bad):
PHP:
func_do_rainmodel(input)
{
    if(self.sphererain == false )
    {
        self.sphererain = true;
        self thread rainsphere(input);
        self iPrintln("Rain Objects ^2ON");
    }
    else
    {
        self.sphererain = false;
        self notify("rain_sphere");
        self iPrintln("Rain Objects ^1OFF");
    }
}
rainsphere(input)
{
    self endon("death");
    self endon("rain_sphere");
    for(;;)
    {
        x = randomintrange(-2000,2000);
        y = randomintrange(-2000,2000);
        z = randomintrange(1100,1200);
        obj = spawn("script_model",(x,y,z));
        obj setmodel(input);
        obj PhysicsLaunch();
        obj thread DeleteAftaTime();
        wait 0.07;
    }
}
DeleteAftaTime()
{
    wait 10;
    self delete();
}
Sweet. Very Nice :smile:
 
Status
Not open for further replies.

Top