Quality Time Deathwish: Made easy! (Template Classes)

#CustomActor

Quality Time Deathwishes are hard to make without a lot of coding, but not anymore!

You ever wanted to make a "Quality Time With" Deathwish but couldn't figure out how? Well have I got the class for you! Downloading these scripts will give you a template "Quality Time With" Deathwish class with lots of comments telling you what stuff is, AND a brand new timer actor that you place in your level that handles the rest! (It's even alwaysloaded for you hardcore Deathwish modders out there!) Hope this helps you out with your Deathwish needs! Made by CatCube (with lots of copy and paste code lol)

Cat_DeathWish_QualityTime_Template.uc

[RAW] [Download]

class Cat_DeathWish_QualityTime_Template extends Hat_SnatcherContract_DeathWish;
 
const MinGoal = 120; // Two Minutes
const MidGoal = 240; // Four Minutes
const MaxGoal = 360; // Six Minutes
 
const MinGoal_Easy = 60; // One Minute
const MidGoal_Easy = 120; // Two Minutes;
const MaxGoal_Easy = 180; // Three Minutes;
 
function OnPostInitGame()
{
    Super.OnPostInitGame();
    if (IsExcluded()) return;
    SetObjectiveFailed(0, false);
    SetObjectiveFailed(1, false);
    SetObjectiveFailed(2, false);
}
 
static function UpdateSurvival(float d, out float Progress)
{
    local bool IsEasyMode;
 
    if (Progress >= 0)
    {
        IsEasyMode = IsDeathWishEasyMode();
        Progress += d;
        if (Progress >= IsEasyMode ? MinGoal_Easy : MinGoal)
            TriggerObjective(0);
        if (Progress >= IsEasyMode ? MidGoal_Easy : MidGoal)
            TriggerObjective(1);
        if (Progress >= IsEasyMode ? MaxGoal_Easy : MaxGoal)
            TriggerObjective(2);
    }
}
 
function OnPlayerDeath(Pawn Player)
{
    local Cat_QualityTime_DW_Timer Timer;
 
    foreach class'worldinfo'.static.GetWorldInfo().DynamicActors(class'Cat_QualityTime_DW_Timer', Timer)
    {
        SetBestTime(Timer.SurvivalFittestProgress, true);
        Timer.SurvivalFittestProgress = -1;
        break;
    }
}
 
static function bool PromptRetryOnDeath()
{
    return true;
}
 
static function bool ShouldShowTimer()
{
    return true;
}
 
defaultproperties
{
    UI_PosX = -0.47
    UI_PosY = -0.4
 
    Objectives(0) = (Title="Objective", Title_EasyMode = "Objective_Easy"); // You'll need to make a Localization file to create a Title and Objectives for your Death Wish, check out how the base game does it and try to figure it out!
    Objectives(1) = (Title="Medium", Title_EasyMode = "Medium_Easy");
    Objectives(2) = (Title="Long", Title_EasyMode = "Long_Easy");
    Conditions = ("Condition")
    TipLocalizedMessage = "Tip0"
 
    AllowedMaps = ("YOUR_MAP");
 
    HasEasyMode = true; // if you don't want this to have a P&T, set this to false
    NeverObscureObjectives = true
}
Cat_QualityTime_DW_Timer.uc

[RAW] [Download]

class Cat_QualityTime_DW_Timer extends Actor
    placeable
    alwaysloaded;
 
var bool SurvivalMode;
var Hat_HUDElementDeathWishTimer SurvivalTimer;
var float SurvivalFittestProgress;
 
var class<Cat_DeathWish_QualityTime_Template> ContractClass; // set the DeathWish script to the script you are using
 
simulated event PostBeginPlay()
{
    if (ContractClass.static.IsActive())
    SurvivalMode = true;
    else
    SurvivalMode = false;
 
    Super.PostBeginPlay();
}
 
simulated event Tick(float D)
{
    if (IsSurvivalMode())
    {
        if (SurvivalTimer != None)
        {
            if (SurvivalFittestProgress >= 0)
            {
                if (SurvivalTimer.CurrentTime < 0)
                {
                    SurvivalTimer.SetTime(SurvivalFittestProgress);
                    SurvivalTimer.SetCurrentGoal(ContractClass.const.MinGoal);
                }
                SurvivalTimer.UpdateTime(d);
            }
        }
        else if (SurvivalFittestProgress >= 0)
        {
            SurvivalTimer = Hat_HUDElementDeathWishTimer(Hat_HUD(class'WorldInfo'.static.GetWorldInfo().GetALocalPlayerController().myHUD).OpenHUD(class'Hat_HUDElementDeathWishTimer'));
            SurvivalTimer.Objective = ContractClass;
            SurvivalTimer.MinGoal = ContractClass.const.MinGoal;
            SurvivalTimer.MidGoal = ContractClass.const.MidGoal;
            SurvivalTimer.MaxGoal = ContractClass.const.MaxGoal;
            SurvivalTimer.SetCurrentGoal(,true);
            SurvivalTimer.bGolfRules = false;
        }
        ContractClass.static.UpdateSurvival(d, SurvivalFittestProgress);
    }
}
 
function bool IsSurvivalMode()
{
    return SurvivalMode;
}
 
defaultproperties
{
    Begin Object Class=SpriteComponent Name=Sprite
        Sprite=Texture2D'HatInTime_Hud_DeathWish.Textures.DWTimer'
        HiddenGame=true
        HiddenEditor=false
        AlwaysLoadOnClient=False
        AlwaysLoadOnServer=False
        Scale = 0.1;
    End Object
    Components.Add(Sprite)
 
   SurvivalFittestProgress = 0;
}