Core.Object | +--Engine.Actor | +--Engine.Inventory | +--XIIIMP.MarioSuperBonus | +--XIIIMP.Teleport
Pawn
MyPawn
bool
NoTeleport
InitialHealth,
SafeHealth
simulated
GiveTo(Pawn Other)
//__________________________________________________________________________
00001 //----------------------------------------------------------- 00002 // 00003 //----------------------------------------------------------- 00004 class Teleport extends MarioSuperBonus; 00005 00006 var Pawn MyPawn; 00007 var int InitialHealth, SafeHealth; 00008 var bool NoTeleport; 00009 00010 simulated event Destroyed() 00011 { 00012 RemoveIconInPlayerHud(); 00013 super.Destroyed(); 00014 } 00015 00016 //__________________________________________________________________________ 00017 00018 simulated function GiveTo( pawn Other ) 00019 { 00020 Super.GiveTo(other); 00021 MyPawn = Other; 00022 InitialHealth = MyPawn.Health; 00023 00024 if( InitialHealth < SafeHealth ) 00025 NoTeleport = true; 00026 else 00027 NoTeleport = false; 00028 00029 AddIconInPlayerHud( Other ); 00030 SetTimer(0.1,true); 00031 SetTimer2(60.0,false); 00032 } 00033 00034 //__________________________________________________________________________ 00035 00036 event Timer() 00037 { 00038 local NavigationPoint Nav; 00039 local int RandNavId,Index; 00040 local Array<NavigationPoint> TeleportSpotList; 00041 00042 if( MyPawn == none ) 00043 return; 00044 00045 if( MyPawn.Health <= 0 ) 00046 return; 00047 00048 if( NoTeleport ) 00049 { 00050 if( InitialHealth != MyPawn.Health ) 00051 NoTeleport = false; 00052 } 00053 00054 if( NoTeleport ) 00055 return; 00056 00057 If( MyPawn.Health < SafeHealth ) 00058 { 00059 Nav = Level.NavigationPointList; 00060 00061 while( Nav != none) 00062 { 00063 if( Nav.IsA('PlayerStart') ) 00064 { 00065 TeleportSpotList.Length = TeleportSpotList.Length+1; 00066 TeleportSpotList[ TeleportSpotList.Length-1 ] = Nav; 00067 } 00068 00069 Nav = Nav.NextNavigationPoint; 00070 } 00071 00072 SetTimer(0.0,false); 00073 SetTimer2( 0.0,false ); 00074 00075 Nav = TeleportSpotList[ Rand(TeleportSpotList.Length) ]; 00076 00077 Spawn(class'SpawnEmitter',,, MyPawn.Location); 00078 MyPawn.SetLocation( Nav.Location ); 00079 Spawn(class'SpawnEmitter',,, MyPawn.Location); 00080 Destroy(); 00081 } 00082 } 00083 00084 //__________________________________________________________________________ 00085 00086 event Timer2() 00087 { 00088 SetTimer( 0.0,false ); 00089 SetTimer2( 0.0,false ); 00090 00091 Destroy(); 00092 } 00093 00094 //__________________________________________________________________________ 00095 00096 00097 00098 00099 00100 defaultproperties 00101 { 00102 SafeHealth=100 00103 BonusIconId=16 00104 }