My adventure into unreal script

Started by keller, Dec 12, 2011, 01:25 PM

Previous topic - Next topic

keller

Hello Everyone-  I am starting to begin my adventure into scripting with Unreal, My main goal is to edit the MyJumpBoots so that they can be configured with different modes (with the CMM server in mind). I have set up my Scripting Environment using
WOTgreal
Exported Unreal Classes with Unreal Editor
UMake (just in case WOTgreal wouldn't Compile)

I have created my first Newbie Mutator called XLowGrav (following tutorials on legacy unreal wiki)
//=============================================================================
// XLowGrav.
// makes all zones xtra low gravity
//=============================================================================

class XLowGrav expands Mutator;

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
if ( Other.IsA('UT_JumpBoots') )
return false;

if ( Other.IsA('ZoneInfo') )
{
    ZoneInfo(Other).ZoneGravity = vect(0,0,-100);
}

bSuperRelevant = 0;
return true;
}

defaultproperties
{
}

Code isn't turning out right in the way I formatted for this thread but it does work and allows you to float higher than the original lowgrav mutator.


keller

Okay in order for me to look at the MyJumpBoots, going to need to install UTPT, I forgot to do that. Doing it now.

keller

#2
Okay so here is the code for MyJumpBoots
//================================================================================
// MyJumpBoots.
//================================================================================

class MyJumpBoots extends UT_Jumpboots;

function OwnerJumped ()
{
  TimeCharge = 0;
  if ( Charge <= 0 )
  {
    if ( Owner != None )
    {
      Pawn(Owner).JumpZ = Pawn(Owner).Default.JumpZ * Level.Game.PlayerJumpZScaling();
    }
    UsedUp();
  } else {
    Owner.PlaySound(Sound'MyJumpJmp');
  }
  Charge -= 1;
}

defaultproperties
{
    ExpireMessage="My JumpBoots have drained."

    PickupMessage="You picked up My JumpBoots."

    PickupSound=None

    ActivateSound=Sound'MyJumpSnd'

    MultiSkins(1)=Texture'MyJump'

}


I want to give these boots the ability to be modified from an ini so it can have multiple modes.
I also want to change the sound when used.


Helen

I'm not sure what UTPT is, but it sounds like they have a class called myJumpboots? It would have inherited from ut_jumpboots. In greal, in the View menu you can select Classes. Then in the classes tree you can find the ut jumpboots following this heirarchy.

Object | Actor | Inventory | Pickup | TournamentPickup | UT_JumpBoots
One of the Scriveners.

keller

Quote from: 72777E7A7D130I'm not sure what UTPT is, but it sounds like they have a class called myJumpboots? It would have inherited from ut_jumpboots. In greal, in the View menu you can select Classes. Then in the classes tree you can find the ut jumpboots following this heirarchy.

Object | Actor | Inventory | Pickup | TournamentPickup | UT_JumpBoots
Unreal Package tool decompiles .u and .int files so you can look at any code that was compiled and in those formats.  I will need to figure out how to create .int files which I assume hold the sound files correct?

Helen

BTW, if you decompiling something to study it for ideas, that's ok. But if you are going to reuse some code, or reuse someone's custom textures, you should ask for permission from the original author. Just FYI.

The .int files do not hold the sound files.

I'm not sure that the unreal tool decompiles sounds, textures, and meshes properly or not. For custom packages, I use the WOTGreal Package Exporter, I know that works at least. Mostly!
One of the Scriveners.

keller

Yes I don't want to use the old texture or sound that is why I am asking- I want to create my own, but to do that is the tricky part how do I compile it into the .u file? Does it auto compile it as long as it is in the code and the files are in the Sound/Texture folders after importing them into Unreal editor?  This is something I need to know so I can get it working.

Helen

Yes, within your package you have Sound/Texture folders, where you put your files.

Then look at the ut_jumpboots class for an example of use. For example, near the top is this line:

#exec AUDIO IMPORT FILE="..\UnrealShare\Sounds\Pickups\BOOTSA1.WAV" NAME="BootSnd" GROUP="Pickups"

Notice the NAME value? This means you can use this sound in your code, and you would reference it with "BootSnd". Same deal with the texture examples in there.
One of the Scriveners.

keller

I do not see Sound/Texture folders where is this again?

Helen

You create them yourself within your package folder, just like the Classes folder you would have created.
One of the Scriveners.

keller


keller

//================================================================================
// MyCMMJumpBoots.
//================================================================================

class MyCMMJumpBoots extends UT_Jumpboots;

function OwnerJumped ()
{
  TimeCharge = 0;
  if ( Charge <= 0 )
  {
    if ( Owner != None )
    {
      Pawn(Owner).JumpZ = Pawn(Owner).Default.JumpZ * Level.Game.PlayerJumpZScaling();
    }
    UsedUp();
  } else {
    Owner.PlaySound(Sound'BootJmp');
  }
  Charge -= 1;
}

defaultproperties
{
    ExpireMessage="CMM JumpBoots have depleted."

    PickupMessage="You picked up CMMJumpBoots."

    PickupSound=None

    ActivateSound=Sound'Botpack.Pickups.BootSnd'

    MultiSkins(1)=Texture'MyCMMJumpBoots'

}

[size=14]I have compiled with zero errors and have placed my redone texture "MyCMMJumpBoots" into a texture folder in the MyCMMJumpBoots package however when choosing the mutator in game the default jump boots texture is shown and not mine?? Any suggestions?[/size]

Helen

You haven't imported them into the code with the #exec statement.

BTW there is already a cmmJumpBoots class in the pirate deemer mod...
One of the Scriveners.

keller

okay, this is just a test, I try and piece stuff together one by one.

keller

I get this error now
--------------------Core--------------------
--------------------Engine--------------------
--------------------Editor--------------------
--------------------UWindow--------------------
--------------------Fire--------------------
--------------------IpDrv--------------------
--------------------UWeb--------------------
--------------------UBrowser--------------------
--------------------UnrealShare--------------------
--------------------UnrealI--------------------
--------------------UMenu--------------------
--------------------IpServer--------------------
--------------------Botpack--------------------
--------------------UTServerAdmin--------------------
--------------------UTMenu--------------------
--------------------UTBrowser--------------------
--------------------XLowGrav--------------------
--------------------MyCMMJumpBoots--------------------
Analyzing...
Parsing MyCMMJumpBoots
Can't find file 'C:\Unreal' for import
C:\Unreal Tournament\MyCMMJumpBoots\Classes\MyCMMJumpBoots.uc(7) : ExecWarning, Import texture MyCMMJump from C:\Unreal failed
Compiling MyCMMJumpBoots
Success - 0 error(s), 1 warnings
Shutting down ucc.exe

//================================================================================
// MyCMMJumpBoots.
//================================================================================

class MyCMMJumpBoots extends UT_Jumpboots;

#exec texture IMPORT NAME=MyCMMJump FILE=C:\Unreal Tournament\MyCMMJumpBoots\Textures\MyCMMJump.pcx LODSET=2
function OwnerJumped ()
{
  TimeCharge = 0;
  if ( Charge <= 0 )
  {
    if ( Owner != None )
    {
      Pawn(Owner).JumpZ = Pawn(Owner).Default.JumpZ * Level.Game.PlayerJumpZScaling();
    }
    UsedUp();
  } else {
    Owner.PlaySound(Sound'BootJmp');
  }
  Charge -= 1;
}

defaultproperties
{
    ExpireMessage="CMM JumpBoots have depleted."

    PickupMessage="You picked up CMMJumpBoots."

    PickupSound=None

    ActivateSound=Sound'Botpack.Pickups.BootSnd'

    MultiSkins(1)=Texture'MyCMMJump'

}

Helen

I have guesses.

A. Don't have that full path to file, change the file path to just FILE=Textures\MyCMMJump.pcx

B. Make sure your pcx is square with edges that are a square root of 2, so 32x32, 64x64, 128x128, etc.

C. Make sure your pcx has 256 colors or LESS.
One of the Scriveners.