I'm a doctor, not a mechanic
Difference between revisions of "Legacy:VitalOverdose/Wormhole"
From Unreal Wiki, The Unreal Engine Documentation Site
m |
|||
Line 2: | Line 2: | ||
by [[Legacy:VitalOverdose|VitalOverdose]] | by [[Legacy:VitalOverdose|VitalOverdose]] | ||
− | |||
− | |||
<Uscript> | <Uscript> | ||
Line 10: | Line 8: | ||
// Wormhole By vitaloverdose, Feb 2006, http://www.Vitaloverdose.com | // Wormhole By vitaloverdose, Feb 2006, http://www.Vitaloverdose.com | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
//============================================================================= | //============================================================================= | ||
Line 56: | Line 48: | ||
SpawnFx( Self.Location , AmbiantFxPool , Self ); | SpawnFx( Self.Location , AmbiantFxPool , Self ); | ||
If ( ( bScanDest == False ) && ( (AmbiantFxpool.Length <= 0 ) || ( ReScanDelay <= 0 )) ) | If ( ( bScanDest == False ) && ( (AmbiantFxpool.Length <= 0 ) || ( ReScanDelay <= 0 )) ) | ||
− | |||
Return; | Return; | ||
− | + | ||
SetTimer(ReScanDelay,True); | SetTimer(ReScanDelay,True); | ||
Line 68: | Line 59: | ||
Local Actor FoundTelPoint; | Local Actor FoundTelPoint; | ||
if (TpAct.Length>0) | if (TpAct.Length>0) | ||
− | |||
TpAct.Remove(0,TpAct.Length); | TpAct.Remove(0,TpAct.Length); | ||
− | + | ||
− | foreach AllActors( Class'Actor' , FoundTelPoint,'TP' ) | + | |
+ | foreach AllActors( Class'Actor' , FoundTelPoint,'TP' ) | ||
{ | { | ||
TpAct.Insert(0,1); | TpAct.Insert(0,1); | ||
Line 83: | Line 74: | ||
{ | { | ||
if (Other.IsA('Vehicle')) | if (Other.IsA('Vehicle')) | ||
− | |||
Vectel(vehicle(Other)); | Vectel(vehicle(Other)); | ||
− | |||
else | else | ||
if ( Other.IsA('pawn')) | if ( Other.IsA('pawn')) | ||
− | |||
TPort(Pawn(Other)); | TPort(Pawn(Other)); | ||
− | |||
} | } | ||
Line 158: | Line 145: | ||
if ( (SpawnedFx != none ) && ( Hardattachedto != none ) ) | if ( (SpawnedFx != none ) && ( Hardattachedto != none ) ) | ||
− | |||
SpawnedFx.SetBase( Hardattachedto ); | SpawnedFx.SetBase( Hardattachedto ); | ||
− | |||
} | } | ||
Line 183: | Line 168: | ||
foreach radiusActors( Class'pawn' , Foundpawn , ScanRadius , SafeSpawnactor.location ) | foreach radiusActors( Class'pawn' , Foundpawn , ScanRadius , SafeSpawnactor.location ) | ||
− | |||
if ( ( Foundpawn != Self ) && ( Foundpawn.bCollideActors == True ) ) | if ( ( Foundpawn != Self ) && ( Foundpawn.bCollideActors == True ) ) | ||
− | |||
SafeSpawnactor =none; | SafeSpawnactor =none; | ||
− | |||
− | |||
return SafeSpawnactor; | return SafeSpawnactor; | ||
} | } | ||
Line 209: | Line 190: | ||
Teleporting.IsA('ONSHoverCraft') || | Teleporting.IsA('ONSHoverCraft') || | ||
Teleporting.IsA('ONSPlaneCraft')) | Teleporting.IsA('ONSPlaneCraft')) | ||
− | |||
Teleporting.KSetStayUpright( true , true ); | Teleporting.KSetStayUpright( true , true ); | ||
− | |||
if ( bDirectional ) | if ( bDirectional ) | ||
− | |||
RotRelation = Self; | RotRelation = Self; | ||
− | |||
else | else | ||
− | |||
RotRelation = Teleporting; | RotRelation = Teleporting; | ||
− | |||
Vehicle(Teleporting).KAddImpulse( ActualBoostForce >> RotRelation.rotation , PointOfBoostFoce >> RotRelation.rotation ); | Vehicle(Teleporting).KAddImpulse( ActualBoostForce >> RotRelation.rotation , PointOfBoostFoce >> RotRelation.rotation ); | ||
if ( TeleportSound != None ) | if ( TeleportSound != None ) | ||
− | |||
PlaySound( TeleportSound ); | PlaySound( TeleportSound ); | ||
− | |||
} | } | ||
</Uscript> | </Uscript> | ||
− | |||
− | |||
==Related topics== | ==Related topics== | ||
− | + | *[[Legacy:Vehicle|Vehicle]] | |
− | [[Legacy: | + | *[[Legacy:ONSVehicle|ONSVehicle]] |
− | + | *[[Legacy:VitalOverdose/ONSVehicleTeleporter | ONSVehicleTeleporter]] | |
− | [[Legacy:VitalOverdose/RandomRelocator| | + | *[[Legacy:VitalOverdose/RandomRelocator | RandomRelocator]] |
− | + | ||
− | + | ||
==Discussion== | ==Discussion== | ||
[[Category:Legacy Custom Class (UT2004)|{{PAGENAME}}]] | [[Category:Legacy Custom Class (UT2004)|{{PAGENAME}}]] |
Latest revision as of 13:24, 8 December 2007
//============================================================================= // Wormhole By vitaloverdose, Feb 2006, http://www.Vitaloverdose.com //============================================================================= class Wormhole Extends Trigger placeable; var Array<Actor> TpAct; Var () Array< Class< Emitter > > VecTagFxPool; Var () Array< Class< Emitter > > AmbiantFxPool; Var () Array< Class< Emitter > > TeleportFxPool_Vec; Var () Array< Class< Emitter > > TeleportFxPool_Self; Var () Sound TeleportSound; Var () Emitter SpawnedAmbiantFx; var () Emitter SpawnedVecFx; Var () bool bScanDest; var () bool bPlayTelePortEffect; Var () float ReScanDelay; Var () float SafeSpawnlocScanRadius; Var () Vector ActualBoostForce; Function PostBeginPlay() { ScanTpAct(); SpawnFx( Self.Location , AmbiantFxPool , Self ); If ( ( bScanDest == False ) && ( (AmbiantFxpool.Length <= 0 ) || ( ReScanDelay <= 0 )) ) Return; SetTimer(ReScanDelay,True); } Simulated Function ScanTpAct() { Local Actor FoundTelPoint; if (TpAct.Length>0) TpAct.Remove(0,TpAct.Length); foreach AllActors( Class'Actor' , FoundTelPoint,'TP' ) { TpAct.Insert(0,1); TpAct[0] = FoundTelPoint; } } Function Touch( Actor Other) { if (Other.IsA('Vehicle')) Vectel(vehicle(Other)); else if ( Other.IsA('pawn')) TPort(Pawn(Other)); } Simulated function TPort( Pawn TPPawn ) { local actor SafeSpawnactor; SafeSpawnactor=FindSafeSpawnLoc(SafeSpawnlocScanRadius); TPPawn.SetLocation( SafeSpawnactor.Location); TPPawn.SetRotation( SafeSpawnactor.Rotation ); TPPawn.OldRotYaw = TPPawn.Rotation.Yaw; } Simulated Function Vectel(Pawn PTele) { Local EPhysics Entryphysics; Local Vehicle Teleporting; local Rotator OldRot; Local Rotator NewRot; local actor SafeSpawnactor; Teleporting = Vehicle(pTele); NewRot = Teleporting.Rotation; EntryPhysics = Teleporting.Physics; ActualBoostForce = Teleporting.Velocity * 500; Teleporting.SetPhysics(PHYS_None); SafeSpawnactor=FindSafeSpawnLoc(SafeSpawnlocScanRadius); if ( SafeSpawnactor != none ) { Teleporting.SetLocation(SafeSpawnactor.location); oldRot = Teleporting.Rotation; NewRot.Yaw = SafeSpawnactor.Rotation.Yaw + Teleporting.Rotation.Yaw - Self.Rotation.Yaw; posttel(Teleporting , Newrot , EntryPhysics ); } } function Timer() { ScanTpAct(); } Simulated Function SpawnFx( Vector SpawnPos ,Array< Class< Emitter > > FxSpawnpool, Actor Hardattachedto ) { Local int PickedNumb; local Class<Emitter> ChosenFxClass< SEMI > local Emitter SpawnedFx; if ( FxSpawnpool.Length <= 0 ) { PickedNumb = FxSpawnpool.Length; PickedNumb = Rand(PickedNumb); ChosenFxClass = FxSpawnpool[PickedNumb]; } SpawnedFx = Spawn( ChosenFxClass , self , , SpawnPos , Rotation ); if ( (SpawnedFx != none ) && ( Hardattachedto != none ) ) SpawnedFx.SetBase( Hardattachedto ); } Function actor FindSafeSpawnLoc( float ScanRadius ) { local pawn Foundpawn; local Array<Actor> TempTpAct; Local Int Counter; Local int PickedRNDNo; local actor SafeSpawnactor; TempTpAct.Length = tpact.Length; TempTpAct = TpAct; for ( Counter=0;Counter<tpact.Length;Counter++) //here i want to pick Numbs at Random from a list { //First west up the Numbs in sequential order and then PickedRNDNo = Rand( tempTpAct.Length -1 )+1; //pick a RND No based on the Length of the list.Once Picked SafeSpawnactor = tempTpAct[PickedRNDNo]; //the Numb is removed from the list and anOther Numb is pick tempTpAct.remove( PickedRNDNo ,1 ); //is Picked based on the new Length of the list foreach radiusActors( Class'pawn' , Foundpawn , ScanRadius , SafeSpawnactor.location ) if ( ( Foundpawn != Self ) && ( Foundpawn.bCollideActors == True ) ) SafeSpawnactor =none; return SafeSpawnactor; } } Simulated function Posttel( Pawn Teleporting , Rotator Newrot , EPhysics EntryPhysics ) { local Vector PointOfBoostFoce; local Actor RotRelation;; Teleporting.SetPhysics( EntryPhysics ); Teleporting.Controller.moveTimer = -1.0; Teleporting.SetmoveTarget( Self ); Teleporting.Controller.SetRotation( NewRot ); Teleporting.SetRotation( NewRot ); if ( Teleporting.IsA('ONSChopperCraft') || Teleporting.IsA('ONSHoverCraft') || Teleporting.IsA('ONSPlaneCraft')) Teleporting.KSetStayUpright( true , true ); if ( bDirectional ) RotRelation = Self; else RotRelation = Teleporting; Vehicle(Teleporting).KAddImpulse( ActualBoostForce >> RotRelation.rotation , PointOfBoostFoce >> RotRelation.rotation ); if ( TeleportSound != None ) PlaySound( TeleportSound ); }