Always snap to grid

Unreal Wiki:Scratchpad

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 06:36, 18 September 2008 by StarMech (Talk | contribs)

Jump to: navigation, search

This page is for pasting code you want to show someone as an example or to get assistance with. This allows you to easily collaborate with someone to solve a problem, and allows easy comparisons of the edits.

You are free to remove any existing code from below, and paste your code between the <uscript> </uscript> tags. If the page hasn't been edited in the last few hours (the last edit timestamp is 2008-09-18 06:36:43), you can assume it isn't needed anymore and can be removed. A full edit history will be available, so don't worry about losing anything you removed.

Clean up after you're done!


class SlowVolume extends PhysicsVolume;
 
function PostBeginPlay()
{
         SetTimer(0.1,true);
         Timer();
}
simulated event Timer()
{
                 local Projectile P;
              foreach DynamicActors(class'Projectile', P)
              {
                      if(Encompasses(P)==true)
                      {
                              if(
                              P.Velocity.x > 150 || P.Velocity.x < -150
                            ||
                              P.Velocity.y > 150 || P.Velocity.y < -150
                            ||
                              P.Velocity.z > 150 || P.Velocity.z < -150
                                ){
                                                               P.Velocity=P.Velocity*0.05;
                                                               P.MaxSpeed=P.MaxSpeed*0.05;
                                                               P.LifeSpan=P.LifeSpan*10;
                                }
                      }
              }
}
 
simulated event ActorLeavingVolume(Actor Other)
{
 
 
 
 
 
          if (Other!=None)
          {
 
                    Other.Velocity=Other.Velocity/0.05;
                    Projectile(Other).MaxSpeed=Projectile(Other).MaxSpeed/0.05;
 
          }
 
}
 
 
defaultproperties
{
 
        bStatic=false
        LifeSpan=10
        bMoveProjectiles=true
        bCollideActors=True
	LocationName="unspecified"
	bSkipActorPropertyReplication=true
}