Random or Looping
Ive just created lightning for my custom story, now all I need to do is get it to repeat randomly....which I do not know how to do. I'm guessing it could be "RandFloat" but I have not a clue how to implement it. here's the script to the lightning. How would you implement random OR EVEN Looping in this script?
void OnStart()
{
PreloadSound("general_thunder.snt");
SetSkyBoxActive(true);
SetSkyBoxColor(0.05, 0.05, 0.10, 1);
SetLightVisible("SpotLight_1", false);
SetLightVisible("SpotLight_2", false);
SetLightVisible("SpotLight_3", false);
SetLightVisible("SpotLight_4", false);
SetLightVisible("SpotLight_5", false);
SetLightVisible("SpotLight_6", false);
AddTimer("", 3.0f, "flashes");
}
//The many flashes that makes up the lightning. all triggered with "flashes"
void flashes(string &in asTimer)
{
AddTimer("", 0.01f, "flashesOn");
AddTimer("", 0.40f, "flashesOff");
AddTimer("", 0.45f, "flashesOn");
AddTimer("", 0.50f, "flashesOff");
AddTimer("", 0.63f, "flashesOn");
AddTimer("", 0.67f, "flashesOff");
AddTimer("", 0.70f, "flashesOn");
AddTimer("", 0.90f, "flashesOff");
AddTimer("", 1.10f, "Thunder");
}
void Thunder(string &in asTimer)
{
PlayGuiSound("general_thunder.snt" , 1.0f);
}
void flashesOn(string &in asTimer)
{
SetLightVisible("SpotLight_1", true);
SetLightVisible("SpotLight_2", true);
SetLightVisible("SpotLight_3", true);
SetLightVisible("SpotLight_4", true);
SetLightVisible("SpotLight_5", true);
SetLightVisible("SpotLight_6", true);
SetSkyBoxColor(0.5, 0.5, 0.6, 1);
}
void flashesOff(string &in asTimer)
{
SetLightVisible("SpotLight_1", false);
SetLightVisible("SpotLight_2", false);
SetLightVisible("SpotLight_3", false);
SetLightVisible("SpotLight_4", false);
SetLightVisible("SpotLight_5", false);
SetLightVisible("SpotLight_6", false);
SetSkyBoxColor(0.05, 0.05, 0.10, 1);
}
|