spacewalk

  • Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

eskarn

FNG / Fresh Meat
Feb 25, 2010
55
3
0
29
Perth, WA, Austraila
OK i have an idea and have been working on it for the last few days but have hit a point where i just don't know how to make it work

as it is i drop the player onto the "pawnstart" trigger which makes the default player into "spacepawn" then the spacepawn triggers the "space" trigger the three scripts are down below

ok so when he is walking he gets trigged into the state "spidering" and can clime walls and then when the player jumps he gets put into the state "flying" and can float round but i cant seem to get the player to touch a brush surface to put him back into the spidering state from flying but a bumpbutton on a mover will trigger it, another actor's and all projectiles

this is my idea for a mission map where the ppl has a space suit and mangetic boots so he can stick to metal surfaces to get around the decompressing spaceship

i have attached a copy of the map below

does anyone know how to make the touch function effect brush surfaces while in the flying state to force the player into spidering

http://www.filefront.com/17212934/KF-spacewalktest.rar/

Code:
//=============================================================================
// SpacePawn.
//=============================================================================
class SpacePawn extends KFHumanPawn
	placeable;

var bool bSpaceJump,bSpaceWalk;
function SpaceJump(){
bSpaceJump = true;
log( "Executing spacejump" );
}


function SpaceWalk(){
bSpaceWalk = true;
log( "Executing spacewalk" );
}



function trigger( actor Other, pawn EventInstigator ){
 local int i;
 //for ( i=0; i<Touching.Length; i++ ){
  //if (Other.SurfaceType != EST_Default){
   SpaceWalk();
   log( "Event Trigger" );
   log( Other.SurfaceType );
 // }
// }
}

function bump( Actor Other ){
 local int i;
 //for ( i=0; i<Touching.Length; i++ ){
  //if (Other.SurfaceType != EST_Default){
   SpaceWalk();
   log( Other.SurfaceType );
   log( "Event Bump" );
   
 // }
// }
}

function touch( Actor Other ){
 local int i;
 //for ( i=0; i<Touching.Length; i++ ){
  //if (Other.IsA('Brush')){
   if ( ! Other.IsA('SpacePawn')){
    SpaceWalk();
    log( Other.SurfaceType );
    log( "Event Touch" );
   }
  //}

// }
}




function bool DoJump( bool bUpdating )
{
	if ( !bIsCrouched && !bWantsToCrouch && ((Physics == PHYS_Walking) || (Physics == PHYS_Ladder) || (Physics == PHYS_Spider)) )
	{
		if ( Role == ROLE_Authority )
		{
			if ( (Level.Game != None) && (Level.Game.GameDifficulty > 2) )
				MakeNoise(0.1 * Level.Game.GameDifficulty);
			if ( bCountJumps && (Inventory != None) )
				Inventory.OwnerEvent('Jumped');
		}
                SpaceJump();
		if ( Physics == PHYS_Spider )
			Velocity = JumpZ * Floor;
			
           else if ( Physics == PHYS_Ladder )
			Velocity.Z = 0;
		   else if ( bIsWalking )
			Velocity.Z = Default.JumpZ;
		   else
			Velocity.Z = JumpZ;
		   if ( (Base != None) && !Base.bWorldGeometry )
			Velocity.Z += Base.Velocity.Z;
		    SetPhysics(PHYS_Falling);
            return true;
			}
    return false;
}

//Simulated function tick(float DeltaTime) {
//log(self.GetStateName() );
//}


state PlayerFlying
{

 function HitWall(vector HitNormal, actor Wall){
 local int i;
 SetPhysics(PHYS_Flying);

 //for ( i=0; i<Touching.Length; i++ ){
  //if (Other.IsA('Brush')){
   log( "Event Hit Wall" );
   if ( Physics == PHYS_Flying){
    SpaceWalk();
    log( Wall.SurfaceType );
    log( "Event Hit Wall" );
   }
  //}

   //}
   }

}

Code:
//=============================================================================
// PawnStart.
//=============================================================================
class PawnStart extends Triggers
	placeable;

var() edfindable Actor ResetToPoint;
var() class<MyKFRedTDMPlayer> ResetPawn;

function Touch( Actor Other )
{
	local Pawn NewPawn,OldPawn;
	local Controller C;

	Super.Touch(Other);
	if( KFPawn(Other)!=None && KFPawn(Other).Health>0 && KFPawn(Other).Controller!=None )
	{
		OldPawn = Pawn(Other);
		C = OldPawn.Controller;
		NewPawn = Spawn(ResetPawn,,,ResetToPoint.Location,ResetToPoint.Rotation);
		if( NewPawn==None )
		{
			C.Pawn.Died(None,Class'DamageType',vect(0,0,0));
			return;
		}
		C.UnPossess();
		C.Possess(NewPawn);
		OldPawn.Destroy();
		UnrealPawn(NewPawn).AddDefaultInventory();
	}
}

Code:
//=============================================================================
// Space.
//=============================================================================
class Space extends Triggers
	placeable;

simulated function tick( float DeltaTime ) {

 local Controller C; 
 local Pawn p;
 local int i;
 for( C = Level.ControllerList; C != None; C = C.nextController ) {
  if ( C.IsA('PlayerController')) {
  
   if ( C.Pawn == none) continue;
   p = C.Pawn;
   log(p.controller.GetStateName());


//Spidering

   if (p.controller.IsInState('PlayerSpidering')&& SpacePawn(p).bSpaceJump) {
    p.controller.GotoState('Playerflying');  

     //p.SetCollision(true, true , true);
     //p.bCollideWorld = true;
     //playercontroller(p).GroundPitch = 0;
    if ( p != None ){
     p.SetCollisionSize(p.Default.CollisionRadius,p.Default.CollisionHeight);
     p.ShouldCrouch(false);
     p.ShouldProne(false);
     p.bCrawler = p.Default.bCrawler;
     p.bCollideWorld = true; 
     p.SetCollision(true, true , true);
    }
    log( "jumping to flying" );
    return;
   } 

// Falling


    if (p.controller.IsInState('Playerfalling')) {
     p.controller.GotoState('Playerflying');
     return;
    } 

// Flying


    if (p.controller.IsInState('Playerflying')&&SpacePawn(p).bSpaceWalk) {
     
     p.SetCollision(true, true , true);
     p.bCollideWorld = true;
     p.controller.GotoState('Playerspidering');
     SpacePawn(p).bSpaceWalk = false;
     SpacePawn(p).bSpaceJump = false;
     log( "fly to spider" );
     return;
    } 

// Walking


    if (p.controller.IsInState('Playerwalking')) {
     if (SpacePawn(p).bSpaceJump){
      log( "walking to fly" );
      p.SetCollision(true, true , true);
      p.bCollideWorld = true;
      p.controller.GotoState('PlayerFlying');
      SpacePawn(p).bSpaceWalk = false;
      return;
     }      log( "walking to spider" );
      p.SetCollision(true, true , true);
      p.bCollideWorld = true;
      p.controller.GotoState('PlayerSpidering');
      SpacePawn(p).bSpaceWalk = false;
     return;
   }   
  }
 }
}
 
Last edited:

PsYcH0_Ch!cKeN

Grizzled Veteran
Nov 27, 2005
1,677
200
63
39
Brisbane, Australia
www.ragequit.com
You're trying to check if you've hit an object of class "Brush", which will generally do nothing. Maybe try doing something like this under HitWall instead.

Code:
if (Wall.bWorldGeometry)
  SetPhysics(PHYS_Spidering);

I have to say though, if it were me, I wouldn't use that Space class at all. Presumably you're intending the entire level to be zero-g, so you'd be better off simply adding all the necessary checks to your SpacePawn class instead. That would be FAR more efficient than trying to check through the entire Controller list every single tick and then trying to make all those function calls indirectly.