PDA

View Full Version : Snow script


_UE_Hunter
17th Aug 2000, 09:54 PM
Someone please tell me what I'm doing wrong with this script.

It is based off of the smokehose combination of entities, and yes I have the snow textures included in snow.utx


//=============================================================================
// SnowPuff.
//=============================================================================
class Snowpuff extends Effects;

#exec OBJ LOAD FILE=textures\Snowspr.utx PACKAGE=Snowspr.Snowspr

var() Texture SSprites[20];
var() int NumSets;
var() float RisingRate;

simulated function BeginPlay()
{
Velocity = Vect(0,0,-1)*RisingRate;
Texture = SSPrites[int(FRand()*NumSets*0.97)];
if (Texture == None) Texture = Texture'S_Actor';
}

//=============================================================================
// SnowHose.
//=============================================================================
class SnowHose extends Effects;

// Shoots out a stream of SnowPuffs. The snow sprites are shot
// in the direction of the SnowPuffDest actor with the same Tag as this actors
// Event. The speed, speedvariance, spawning delay and variance, size and
// size variance, as well as the acceleration of the snow puffs are adjustable.
// The effect can be initially active all the time, or enabled when the player
// is within a trigger's radius.

var() bool bInitiallyActive;
var() float SnowSpeed;
var() Vector SnowAccel;
var() float SnowDelay;
var() float SnowDelayVariance;
var() float SpeedVariance;
var() float BasePuffSize;
var() float SizeVariance;
var() int TotalNumPuffs;

var Actor SnowDestObj;
var int NumPuffsSpawned;

function BeginPlay()
{
local SnowHoseDest SDest;

// Find the SnowHoseDest object which has the same tag as
// the event of this SnowHose.
foreach AllActors( class 'SnowHoseDest', SDest, Event )
{
SnowDestObj = SDest;
break;
}
if ( SnowDestObj == None )
{
Destroy();
return;
}
NumPuffsSpawned = 0;
if( bInitiallyActive )
{
Enable('Timer');
SetTimer( SnowDelay+FRand()*SnowDelayVariance, False );
}
else
Enable('Trigger');
}

function Timer()
{
// Spawn another snow puff sprite
local SnowPuff sp;

sp = Spawn(class'SnowPuff');
sp.DrawScale = BasePuffSize+FRand()*SizeVariance;
sp.Velocity = (SnowSpeed + FRand()*SpeedVariance) *
Normal(SnowDestObj.Location - Location);
sp.Acceleration = SnowAccel;
NumPuffsSpawned++;
if( NumPuffsSpawned>TotalNumPuffs ) Destroy();
SetTimer( SnowDelay+FRand()*SnowDelayVariance, False );
}

function Trigger( actor Other, pawn EventInstigator )
{
// Actor entered the triggers radius
Enable('Timer');
SetTimer( SnowDelay+FRand()*SnowDelayVariance, False );
}

function UnTrigger( actor Other, pawn EventInstigator )
{
// Actor left the triggers radius
Disable('Timer');
}

//=============================================================================
// SnowHoseDest.
//=============================================================================
class SnowHoseDest extends Effects;

// The position of this actor implies the direction the snowpuffs will
// be shot out from the SnowHose.
// The Tag of this actor must be the same as the DestTag of the SnowHose Actor.


Please help.

_UE_Hunter
20th Aug 2000, 04:31 AM
come on you know you want to help :)
i forgot to add tho that it doesnt crash or anything
in the game there are just no snow puffs falling down when i fire up my game

_UE_Hunter
26th Aug 2000, 06:30 PM
I stayed up perfecting some snow textures for my level. All I need now is help w/ script...