![]() |
|
|
#1 |
|
Registered User
Join Date: Mar. 23rd, 2011
Posts: 2
|
Stamina system?
My friend and I are developing a zombie-survival game with UDK, and we're working on implementing some melee weapons. We would like for the player to lose some stamina when swinging a baseball bat, but we're not quite sure where that would be handled programmatically - we were thinking probably the InventoryManager class, since that interfaces with a pawn and handles the firing functions. I'm just not sure how to go about adding the functionality, and any help or a nudge in the right direction would be much appreciated.
|
|
|
|
|
|
#2 |
|
That would probably be better in the PlayerController class. As an example, you could have a float Stamina there which defaults to 1. Every Tick it checks to see if it's less than 1 and increases it by doing:
Code:
Stamina += RecoveryRate * DeltaTime; Then using: Code:
FMin(Stamina, 1.0); Code:
Stamina -= MyMeleeWeaponClass(Pawn.Weapon).StaminaReduction; Then, before you allow the player to use a melee attack you would check to make sure Stamina was greater than a certain amount (0.0 for example). Hope this helps!
__________________
Unreal Development Kit Game Programming with UnrealScript: Beginner’s Guide Stubborn Horse Studios - Angel Mapper To have said goodbye to things! Last edited by Angel_Mapper; 23rd Mar 2011 at 02:26 PM. |
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Mar. 23rd, 2011
Posts: 2
|
That does help a lot, but I'm still wondering how the firing functions are accessible in the PlayerController class. There's not a lot of documentation that we could find concerning appending functionality onto the firing procedures, and the reason we were looking at the InvManager class is because it seemed to sort of bridge the gap between the weapon and the pawn and handle the firing functions.
|
|
|
|
|
|
#4 |
|
You could put this in the Pawn class instead and work directly in the StartFire and StartAltFire functions there.
As for documentation, there is no better documentation than the source files themselves. I'd recommend reading through Object.uc, Actor.uc, GameInfo.uc and the Controller and Pawn classes to get an idea of the functionality that's available to you. Literally just sit down and read them.
__________________
Unreal Development Kit Game Programming with UnrealScript: Beginner’s Guide Stubborn Horse Studios - Angel Mapper To have said goodbye to things! Last edited by Angel_Mapper; 23rd Mar 2011 at 04:09 PM. |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|