| Home Page | Recent Changes

MeanFish

Welcome to my page! Feel free to add random ponderings if you want in the "Discussion" area, and if you have any suggestions/comments/complaints/threats feel free to put those wherever seems relevant.

The concept of the wiki is strong with this page author, so don't be shy about putting stuff on here!

Contact Information

AIM: HopFrog 187

MSN: NinjaGuppy6@hotmail.com

Yahoo!: wonko32

ICQ: 89282852

EMail: NinjaGuppy6@hotmail.com

Current Projects

  • Active Projects
    • Carjack! (yes, we've started working on code for this...)
    • A blitzball-style level for Deathball
  • Future Projects
    • Gnome Action Cinema (more on this later, name subject to change)
    • UT2003 Extended SDK

Diary of a Madman

As I traversed through the grassy plains of UnrealScriptLand, I came across the most frightening sight I'd ever witnessed, for there before me was a wall of teepees. "Natives," I grunted with a slightly depressed tone knowing that the answer I seek is somewhere on the other side of that wall which I will never be able to afford to go over (I love overly long sentences. Are you out of breath yet? See below to fix that problem!). These natives were wielding flamethrowers and boards with nails in them. I was simply no match with only my car keys available.

AmphibiousWaterVolume is brought to life!

I'll be sure to post the code here when I'm done making the class more easily manipulated. Flexible code is good code :) Ok, ok, I'll post what I have so far. Any advice would be appreciated. I'm also still testing it, so if there are bugs I'd love to hear about them so that I can (hopefully) fix them in less time than it took me to figure out how to make this thing work at all!

//By:  MeanFish
//Purpose:  to make it so that people wont drown inside
//of this water volume's loving arms.

class AmphibiousWaterVolume extends WaterVolume;

var int nTempTime;
var int nAdjustedBreathingTime;

//if an Actor enters the volume, set their breathing abilities to
//"I could do this for six months!" (literally)
function touch(Actor other)
{
         local Pawn myPawn;

         if (Other.IsA('Pawn'))
         {
            myPawn = Pawn(other);
            nTempTime = myPawn.UnderwaterTime;
            myPawn.UnderwaterTime= +nAdjustedBreathingTime;
         }
         
         Super.touch();
}

//if an Actor leaves, make sure to set their breathing back to normal, 
//in case there is a normal water volume in the same level.
function untouch(Actor Other)
{
         local Pawn myPawn;
         if (Other.IsA('Pawn'))
         {
            myPawn = Pawn(Other);
            myPawn.UnderwaterTime=ntempTime;
         }
         Super.untouch();
}

defaultproperties
{
nAdjustedBreathingTime=9999999.0
//I'm trying to make it so that projectiles are immune to the slowdown effect
//of underwater combat.  translation:  I'm trying to use this for a deathball level.
bMoveProjectiles=false;
}

Oh yeah...and if you decide to use this, dont forget to add whatever package you put it in to your

EditPackages section for UEd (at the bottom of ut2003.ini). Probably childs play for most of y'all but it was hard for me so BACK OFF! :-P

Discussion

Foxpaw: There's a slight problem with the way that your code resets the breathing times. If Player A enters the water, then Player B enters, then Player A leaves, Player A will get Player B's breathing properties back instead of their own. Most pawns have the same underwater breathing properties, but I wouldn't rule out the possibility of someone making a model with a custom species that has different breathing options. Alternatively, some players could have something like the scuba tanks on that submarine assault level in UT. A way to ensure that each person gets their own breathing properties back is by keeping track of a list of players and their underwater times, like so:

struct BreathingProperties
{
  var Pawn Player;
  var float StoredTime;
};

var array<BreathingProperties> StoredProperties;

// **************************************************************************************** //
// **************************************************************************************** //
// **************************************************************************************** //
// **************************************************************************************** //

simulated function int FindBreathingPropsFor( Pawn Player )
{
  local int i;
  
  if ( Player == None ) return -1;

  for (i=0;i<StoredProperties.Length;i++)
    if ( StoredProperties[i].Player == Player ) return i;

  return -1;
}

simulated function StoreBreathingPropsFor( Pawn Player )
{
  local int i;
  local BreathingProperties NewProperties;

  if ( Player == None ) return;

  i = FindBreathingPropsFor( Player );
  if ( i < 0 || i > StoredProperties.Length )
  {
    NewProperties.Player = Player;
    i = StoredProperties.Length;
    StoredProperties[i] = NewProperties;
  }

  StoredProperties[i].StoredTime = Player.UnderwaterTime;
}

// **************************************************************************************** //
// **************************************************************************************** //
// **************************************************************************************** //
// **************************************************************************************** //

simulated function Touch( actor Other )
{
  if ( Other.IsA( 'Pawn' ) )
  {
    StoreBreathingPropsFor( Pawn( Other ) );
    Pawn( Other ).UnderwaterTime += nAdjustedBreathingTime;
  }

  Super.Touch( Other );
}

simulated function Untouch( actor Other )
{
  local int i;

  Super.Untouch( Other );

  if ( Other.IsA( 'Pawn' ) )
  {
    i = FindBreathingPropsFor( Pawn( Other ) );
    if ( i >= 0 && i < StoredProperties.Length )
    {
      Pawn( Other ).UnderwaterTime = StoredProperties[i].StoredTime;
      StoredProperties.Remove( i, 1 );
    }
  }
}

// **************************************************************************************** //
// **************************************************************************************** //
// **************************************************************************************** //
// **************************************************************************************** //

MeanFish: Dude that's awesome...thanks a lot! I'll be spending some time deciphering it. I'm still learning, as mentioned previously but I appreciate the help a ton!

Category Personal Page

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In