Blog Archives

[TIP] Change Player Models based on Team for Multiplayer Team Deathmatch


In my game i implemented Team Deathmatch a few days ago but was struggling to update player mesh based on Team. But today i finally managed to do it and decided to share incase if anyone else is facing the same problem.

In your custom Team Deathmatch Game class add the below code:

function class<Pawn> GetDefaultPlayerClass(Controller C)
{
    if (C.PlayerReplicationInfo.Team.GetTeamNum() == 0)
    {
        return class'Team0PawnClass';
    }
    return class'Team1PawnClass';
}

Thats it! We just override the GetDefaultPlayerClass function to get the player model based on Team.

Hope you find this useful.

[Code] Heartbeat sound when life is low


Big Thanks to Crusha K. Rool and 100GPing100 from UDK Forums.

Use this code in your custom Pawn class:

class MyNewPawn extends UTPawn;
var AudioComponent HealthSound;

event TakeDamage(int DamageAmount, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
{
    super.TakeDamage(DamageAmount, EventInstigator, HitLocation, Momentum, DamageType, HitInfo, DamageCauser);
    if (Health <= 25)
    {
        HealthSound.Play();
    }
}

function Tick(float DeltaTime)
{
    Super.Tick(DeltaTime);

    if (Health > 25)
         HealthSound.Stop();
}

simulated event Destroyed()
{
    HealthSound = None;
    super.Destroyed();
}

defaultproperties
{
    Begin Object class=AudioComponent name=MenuAudioComponent
        SoundCue = SoundCue'Sounds.Misc.Heartbeat_Cue' //Change this to your soundcue.
    End Object
    HealthSound = MenuAudioComponent
    Components.Add(MenuAudioComponent)
}

[Tutorial] Change Player Mesh via Kismet


Hello everyone…In this tutorial you will learn to change Player Mesh by pressing any button in-game. We achieve this by using a custom Kismet Node.

Read the rest of this entry

Design a site like this with WordPress.com
Get started