Game Development Community

how to call function when in the rain

by Tom Timothy · in Torque 3D Professional · 07/18/2012 (6:25 am) · 10 replies

I would like to add a fullscreen effect when the player is in the rain not sure were I would have this function called at is it onenterliquid?

#1
07/18/2012 (6:58 am)
Rain is a precipitation effect, does that effect cover the whole level or just parts of it? You could make a trigger field so when he entered the place with the precipitation the fullscreen effect starts.
If it covers the whole level just add it where you activate the precipitation.
#2
07/18/2012 (9:40 am)
The onEnter/onExit Liquid callbacks are just for the water objects (waterblock, river, waterplane). Precipitation is not a volume object, it is simply an effect.

If you're creating and ending your rain from script just use a clientCmd to start/end your screen effect at the same time.
#3
07/18/2012 (5:15 pm)
okay this is what i am doing but cant get splats to stop what am missing thougth they should stop after i left the water.

In function Armor::onEnterLiquid

%obj.raincounter = schedule($Rain::TickTime, 50, "clientCmdShowwaterSplat", %obj);

Then In Fuction Armor::onLeaveLiquid


cancel(%obj.raincounter);


Then fuction Showwatersplat looks like this

function clientCmdShowwaterSplat()
{

waterSplashMgr.showRandomSplash();
cancel(%this.raincounter);
%obj.raincounter = schedule($Rain::TickTime,50,"clientCmdShowwaterSplat", %obj);

}
#4
07/19/2012 (10:10 am)
cancel(%this.raincounter); 
%obj.raincounter
Mismatch there?
#5
07/19/2012 (10:24 am)
A whole lot of mismatching going on in there....
#6
07/19/2012 (10:26 am)
Where are you getting %obj from inside of ShowWaterSplat?
#7
07/23/2012 (8:15 am)
its from here

new guiSplashMgrCtrl(waterSplashMgr) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
//Profile = "guiSplashMgrCtrlProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "572 465";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
RenderMode = "Random";
AutoStart = "0";
new guiSplashBitmapCtrl() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
HorizSizing = "right";
VertSizing = "bottom";
position = "110 161";
Extent = "64 64";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
fadeinTime = "500";
waitTime = "4000";
fadeoutTime = "2000";
done = "0";
bitmap = "./splats/watersplat1.png";
};
new guiSplashBitmapCtrl() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "800 600";
MinExtent = "8 2";
canSave = "1";
Visible = "0";
hovertime = "1000";
fadeinTime = "500";
waitTime = "4000";
fadeoutTime = "2000";
done = "0";
bitmap = "./splats/watersplat2.png";
};
#8
07/26/2012 (6:47 am)
Tom, it looks like you used the blood splat example as a base. Did you happen to add the client command call to kick this off? In your playgui you should have 2 client commands defined.

function clientCmdStartWaterSplash(){
   waterSplashMgr.startSplash();
}

function clientCmdStopWaterSplash(){
   waterSplashMgr.stopSplash();
}

When you want to stop the water splashes you have to make the commandtoclient calls to start and stop the splash manager.

commandToClient(%obj.client,'StartWaterSplash');

commandToClient(%obj.client,'StopWaterSplash');

You don't need to put it into a schedule and canceling a schedule will not affect the splash manager at all. Let me know if you have any questions.
#9
08/02/2012 (8:19 am)
Thanks Ryan yes its from one of your awsome additions to this engine. Is there a easy way to make this repeat its self tell its triggered not to got making trigger stoping it just dont know how to make it keep going with out calling itseklf again and again.
#10
08/02/2012 (8:32 pm)
Thanks Tom. To restart the splash manager is easy, try the following:

$SplashRunning = false;
function clientCmdStartWaterSplash(){
   waterSplashMgr.startSplash();
   $SplashRunning = true;
}

function clientCmdStopWaterSplash(){
   waterSplashMgr.stopSplash();
   $SplashRunning = false;
}

//This is called when the splash manager finishes processing
function waterSplashMgr::onSplashCompleted(%this){
   //restart the splash if we need it to loop
   if($SplashRunning == true){
      waterSplashMgr.startSplash();
   }  
}