1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

UE3 - UT3 Checking Team Number

Discussion in 'Programming' started by inferyes, Jun 2, 2010.

  1. inferyes

    inferyes Spaced In

    Joined:
    Aug 16, 2009
    Messages:
    504
    Likes Received:
    0
    I wasn't trying to define a variable, I was trying to define the UTWeap_Enforcer class that is a subclass of UTWeapon. I thought it was supposed to be AddInventory(<weapon class>) or something along those lines.
     
  2. Zur

    Zur surrealistic mad cow

    Joined:
    Jul 8, 2002
    Messages:
    11,702
    Likes Received:
    4
    As Wormbo explained the notation is class dot variable_name or function name. If you wish to have a subclass of something, you need to get it from somewhere or create it. If the idea is to add weapons out of thin air so to speak, you'll need to create the weapon from a given weapon class. Again, I know nothing about UE3 but there's something called dynamic loading which allows one to achieve this.

    http://wiki.beyondunreal.com/Legacy:DynamicLoadObject
     
    Last edited: Jun 12, 2010
  3. inferyes

    inferyes Spaced In

    Joined:
    Aug 16, 2009
    Messages:
    504
    Likes Received:
    0
    There is a function in every subclass of UTWeapon called GiveTo( pawn ) that I could call but it kept returning a error saying the it couldnt find tge weapon class.

    Maybe when I get the chance I will work on fixing that tommarow.
     
  4. Zur

    Zur surrealistic mad cow

    Joined:
    Jul 8, 2002
    Messages:
    11,702
    Likes Received:
    4
    This is where understanding OOP comes in handy.

    http://aaronash.com/ut3/UT3_UnCodex_v1.3/index.html#utgame/utweapon.html
    http://aaronash.com/ut3/UT3_UnCodex_v1.3/index.html#engine/inventory.html

    UTWeapon is an Inventory which in turn has the GiveTo() function which accepts a Pawn. So the way things have been done in UT3 is that you give a weapon to a Pawn (and not the opposite).

    This still means you need to make a weapon. You should find some clues here:

    http://www.google.com/search?btnG=1&pws=0&q=UTWeapon+giveto

    P.S: Forget the dynamic loading. It's not necessary for what you're doing.
     
    Last edited: Jun 12, 2010
  5. inferyes

    inferyes Spaced In

    Joined:
    Aug 16, 2009
    Messages:
    504
    Likes Received:
    0
    I was over in florida the past few days checking out Full Sail. Tommarow I plan to get back to work on this gametype.
     
  6. inferyes

    inferyes Spaced In

    Joined:
    Aug 16, 2009
    Messages:
    504
    Likes Received:
    0
    After looking through those last to links you posted I finally found a proper method of adding inventory weapons. :D

    I wrote a basic script so that when a player dies it waits till he respawns and then adds a weapon to him based on which team he is on and begins waiting again.

    I did a play test and it was bug free. I'm now onto the last part of making my gametype, setting up the menus and adding options to the game setup screen.

    Code:
    class UTPawn_Zombies extends UTPawn
    	dependson(PlayerReplicationInfo);
    var int BigFatZero;
    var int TeamIndexZombies;
    var bool PlayerKilled;
    var string ItemName;
    
    simulated function PostBeginPlay()
    {
    	Super.PostBeginPlay();
    	SetTimer(0.01,true);
    }
    
    simulated function Timer()
    {
    	TeamIndexZombies = GetTeamNum();
    
    	if(TeamIndexZombies == 0)
    	{
    		if(PlayerKilled == true && Health > 0)
    		{
    			PlayerKilled=false;
    			InvManager.CreateInventory(class'UTGame.UTWeap_Enforcer', False);
    			loginternal("I gave a Survivor a Enforcer! He just spawned!");
    		}
    	}
    
    	if(TeamIndexZombies == 1)
    	{		
    		if(PlayerKilled == true && Health > 0)
    		{
    			PlayerKilled=false;
    			InvManager.CreateInventory(class'UTGame.UTWeap_Impacthammer', False);
    			loginternal("I gave a Zombie a Hammer! He just spawned!");
    		}
    		bCanPickupInventory = false;
    	}
    }
    
    simulated function bool Died(Controller Killer, class<DamageType> damageType, vector HitLocation)
    {
    	if(TeamIndexZombies == 0)
    	{
    		LogInternal("A survivor has died! Please switch me to the Zombie team!");
    		UTTeamGame(WorldInfo.Game).SetTeam(Controller, UTTeamGame(WorldInfo.Game).Teams[1], true);
    		
    	}
    		PlayerKilled=true;
    	if (Super.Died(Killer, DamageType, HitLocation))
    	{
    		StartFallImpactTime = WorldInfo.TimeSeconds;
    		bCanPlayFallingImpacts=true;
    		if(ArmsMesh[0] != none)
    		{
    			ArmsMesh[0].SetHidden(true);
    			if(ArmsOverlay[0] != none)
    			{
    				ArmsOverlay[0].SetHidden(true);
    			}
    		}
    		if(ArmsMesh[1] != none)
    		{
    			ArmsMesh[1].SetHidden(true);
    			if(ArmsOverlay[1] != none)
    			{
    				ArmsOverlay[1].SetHidden(true);
    			}
    		}
    
    		SetPawnAmbientSound(None);
    		SetWeaponAmbientSound(None);
    		return true;
    	}
    	return false;
    }
    
    defaultproperties
    {
    	BigFatZero=0;
    	TeamIndexZombies=0;
    	PlayerKilled=true;
    }
    
     
    Last edited: Jun 17, 2010
  7. inferyes

    inferyes Spaced In

    Joined:
    Aug 16, 2009
    Messages:
    504
    Likes Received:
    0
    Alright so I'm working on another mod and I have a little problem. When a pawn dies all of the values stored in it are reset (because a new pawn is created) is there a way to save the values from a pawn after it dies. I am trying to write a scoring function into a player pawn and it works fine until the player pawn dies.

    The values I want to save even after the pawn has died are var int GGPlayerPawnScore; and var int GGPlayerPawnDeath;

    Code:
    class UTPawn_GunGame extends UTPawn;
    
    var int GGPlayerPawnScore;
    var int GGPlayerPawnDeath;
    
    simulated function PostBeginPlay()
    {
    	Super.PostBeginPlay();
    	SetTimer(5,true);
    }
    
    simulated function Timer()
    {
    	loginternal(GetHumanReadableName() @ "has" @ GGPlayerPawnScore @ "kill(s)" @ "and has" @ GGPlayerPawnDeath @ "death(s).");
    }
    
    function bool Died(Controller Killer, class<DamageType> damageType, vector HitLocation)
    {
    
    	GGPlayerPawnDeath=GGPlayerPawnDeath+1;
    	loginternal("I died! My GGPlayerPawnDeath is" @ GGPlayerPawnDeath @ "and" @ GGPlayerPawnDeath+1);
    
    	if (Super.Died(Killer, DamageType, HitLocation))
    	{
    		StartFallImpactTime = WorldInfo.TimeSeconds;
    		bCanPlayFallingImpacts=true;
    		if(ArmsMesh[0] != none)
    		{
    			ArmsMesh[0].SetHidden(true);
    			if(ArmsOverlay[0] != none)
    			{
    				ArmsOverlay[0].SetHidden(true);
    			}
    		}
    		if(ArmsMesh[1] != none)
    		{
    			ArmsMesh[1].SetHidden(true);
    			if(ArmsOverlay[1] != none)
    			{
    				ArmsOverlay[1].SetHidden(true);
    			}
    		}
    		SetPawnAmbientSound(None);
    		SetWeaponAmbientSound(None);
    		return true;
    	}
    	return false;
    }
    
    defaultproperties
    {
    }
    
     
    Last edited: Jun 18, 2010
  8. Zur

    Zur surrealistic mad cow

    Joined:
    Jul 8, 2002
    Messages:
    11,702
    Likes Received:
    4
    See if you can modify the Pawn so weapons aren't discarded when Died is called. Either that or find something you can use to identify the Player reliably (not the Pawn itself) and make use of Mutator's PreventDeath function.

    P.S: For quality code, make sure any possibility of a None value are taken into account before release.
     
    Last edited: Jun 18, 2010
  9. inferyes

    inferyes Spaced In

    Joined:
    Aug 16, 2009
    Messages:
    504
    Likes Received:
    0
    Yeah I tried a different way to doing this. PlayerReplicationInfo already tracks kills and deaths so I just tapped into that.

    Code:
    simulated function Timer()
    {
    	GGPlayerPawnKills=PlayerReplicationInfo.Kills;
    	GGPlayerPawnDeaths=PlayerReplicationInfo.Deaths;
    
    	loginternal(GetHumanReadableName() @ "has" @ GGPlayerPawnKills @ "kill(s)" @ "and has" @ GGPlayerPawnDeaths @ "death(s).");
    }
    

    Works fine. Now to start writing the actual mutator since I have the kill counting in place.
     
  10. Zur

    Zur surrealistic mad cow

    Joined:
    Jul 8, 2002
    Messages:
    11,702
    Likes Received:
    4
    Sorry I misread your post. I would have suggested modifying Scorekill but that doesn't seem present in UT3's Mutator. I'm not sure but the Kills and Death variables should remain as long as the player is connected.
     
  11. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,913
    Likes Received:
    36
    UT3, like UT200x before, splits smaller game modifications into the Mutator and GameRules classes. ScoreKill() is in the latter.
     
  12. inferyes

    inferyes Spaced In

    Joined:
    Aug 16, 2009
    Messages:
    504
    Likes Received:
    0
    Alright so I've gotten all my code in place for the GunGame game type I'm working on but I need to find a way to remove all the weapons from the map. I want power ups to stay and still be picked up but I need to remove weapons. One way I could do this is to delete weapons out of the players inventory if they pick them up but this would be kind of odd. I would rather just stop the weapons from being picked up at all.

    Could I replace the UTWeapoPickupFactory class some how and make it not function?
     
  13. inferyes

    inferyes Spaced In

    Joined:
    Aug 16, 2009
    Messages:
    504
    Likes Received:
    0
    Alright so I spent some time configuring defaults for the Zombies game type and it's all ready to be released. All that is left is to change the "Team Deathmatch" on the score board to "Zombies" and the little description under neath it to something else.

    I'm guessing that the big "Team Deathmatch" on the scoreboard is either a special font type or a texture. Where would I look to change this. I have already searched for a UTUI element for these things but I'm not sure where it is.
     
  14. inferyes

    inferyes Spaced In

    Joined:
    Aug 16, 2009
    Messages:
    504
    Likes Received:
    0
    After doing some more searching I came across UTUIScene_TeamScoreBoard but it is compeltely emptry.

    Code:
    /**
     * Copyright 1998-2007 Epic Games, Inc. All Rights Reserved.
     */
    
    class UTUIScene_TeamScoreboard extends UTUIScene_Scoreboard;
    
    
    defaultproperties
    {
    }
    
    If this class is exactly the same as the deathmatch scoreboard how does it make a difference? UI confuses me.
     
  15. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,913
    Likes Received:
    36
    UIScenes are created in the editor.
     
  16. inferyes

    inferyes Spaced In

    Joined:
    Aug 16, 2009
    Messages:
    504
    Likes Received:
    0
    I actually ended up creating a new UI Scoreboard and linking it to my and then realizing that I didn't need to do that to change those strings. So I have a custom HUD class now (which I managed to figure out how to do without any tutorials :) ) and I have fixed the gametype name and descriptions and what not.

    IMG
    http://screenshot.xfire.com/s/99723555-4.jpg
     

Share This Page