class ParkourController extends UTPlayerController;
var bool bSprinting;
var class<UTFamilyInfo> CharacterClass;
const MAX_LEVEL = 99;
const XP_INCREMENT = 300; // Amount of XP that is added to the amount of XP required for a level, after each level progression
const SkillPointsVar = 1;
var int SkillPoints;
var bool LevelUp;
var int XP; // Total amount of gathered XP
var int Level; // Current level
var int XPGatheredForNextLevel; // Amount of XP gathered for the next level
var int XPRequiredForNextLevel; // Amount of XP required for the next level
var int Money;
var int WeaponValue;
simulated function PostBeginPlay()
{
super.PostBeginPlay();
// Calculate XP-related properties at the start of the game
CalculateLevelProgress();
}
// The function that is called from Kismet
public function AddXP(SeqAct_GiveXP action)
{
GiveXP(action.Amount); // Give the player the amount of XP specified in the Kismet action
}
public function GiveXP(int amount)
{
self.XP += amount;
CalculateLevelProgress();
while (self.XPGatheredForNextLevel >= self.XPRequiredForNextLevel && self.Level < MAX_LEVEL)
{
self.Level++;
// Recalculate level progress after leveling up
CalculateLevelProgress();
}
}
exec function GiveSkillPoints(int amount)
{
self.SkillPoints += amount;
}
private function CalculateLevelProgress()
{
local int xpToCurrentLevel; // Total amount of XP gathered with current and previous levels
xpToCurrentLevel = XP_INCREMENT * (self.Level - 1);
self.XPGatheredForNextLevel = self.XP - xpToCurrentLevel;
self.XPRequiredForNextLevel = self.Level * XP_INCREMENT;
self.SkillPoints = SkillPointsVar;
}
//Here we create our SetSoldierClass Function and also we add the exec so its accesible trough a gfx movie
exec function SetSoldierClass()
{
//referencing to the player pawn
local Pawn p;
p = Pawn;
//unposses and destroy the pawn
UnPossess();
p.Destroy();
//spawn a new one with our specified class and posses it
p = Spawn( class'HeavyPawn',,,Location );
Possess( P, false );
CharacterClass=class'UTFamilyInfo_Liandri_Male';
ServerSetCharacterClass(CharacterClass);
}
//we use this function to be able to change the value of our money
//Springting Code
exec function StartSprint22()
{
ConsoleCommand("Sprint");
Pawn.GroundSpeed = 490;
bSprinting = true;
StopFiring();
}
simulated function StopSprint()
{
Pawn.Groundspeed = 440;
bSprinting = true;
}
defaultproperties
{
Level = 1;
XP = 0;
SkillPoints = 0;
}
Bookmarks