Game Development Community

Start and stop rain

by Michael Schaumburg · in Torque Game Engine · 02/09/2005 (10:36 am) · 8 replies

I like to have random start and stop of raining in our game but have no idea
to make it. I have the functions startRain() and stopRain(). How can I call these
functions randomly ???
Any idea will be great ..

#1
02/09/2005 (10:39 am)
Have a function to monitor the weather every X amount of ticks via the use of a schedule. Then turn the rain on/off depending on how you want the weather to behaive.
#2
02/09/2005 (10:46 am)
Below is basically the code I used for part of a Random Weather system in Tribes 2. It worked fine in Torque the last time I checked.

function initStorm()
{
     %rainstart = %stormstart + getrandom(35,90);
     %rainend = %stormstart + getrandom(120,240);

     Precipitation.setStorm(%rainstart, 30, 1, %rainend, 40, 0);
}

function Precipitation::setStorm(%obj, %inStartT, %inLengthT, %inPer, %outStartT, %outLengthT, %outPer)
{
   if(%inStartT < %outStartT)
      %obj.stormShow(false);
   else
      %obj.stormShow(true);
   %obj.schedule(%inStartT*1000, "stormPrecipitation", %inPer, %inLengthT);
   %obj.schedule(%outStartT*1000, "stormPrecipitation", %outPer, %outLengthT);
}


I've posted the full code in the forums before... if people want I could post it again
#3
02/09/2005 (10:49 am)
Yes, could you do that? How does this compare to this ressource?
#4
02/09/2005 (11:29 am)
@Labrat
Some Info .
The new precipitation dont have setStorm , stormShow and moore.
#5
02/09/2005 (11:35 am)
Billy, it's an example of his old code for Tribes II. I don't think it's meant to be a drop-in thing and it's easy to adapt it to current Torque IMO.
#6
02/09/2005 (2:59 pm)
In the demo the rain is started and stopped by simply adding and deleting the Precipitation object from the mission.
#7
02/10/2005 (12:08 am)
Hmm.. I'll have to look at how storms are handled in TGE now.
#8
02/11/2005 (12:39 am)
I got it working with the resource Dirk has posted. I was digging into this code and took what
I need. Thanks.....