Tuesday, May 26, 2015

Entry 017 - Health System

As promised, I'd like to introduce you to the simple health system in SPLIT. But first: what do I need a health system for, isn't it better to just use triggers that "kill" you immediately? Most events are like that already, but imagine a fire in a 3D environment that kills you if you get to close, while in other first person games it just decreases your health the longer you stay in there. That's why (and other reasons) I came up with a very basic but flexible solution.

 Player Blueprint & example Actor Blueprint

Within the Player Plueprint is a simple variable that can range from -1 to 100 (clamp). The sequence you see is being triggered by a Tick Event. As long as no invulnerability is active (there's an item to come that makes you invulnerable to any damage except falling) the health variable will be count up to a max of 100. Except the Health Regeneration is being deactivated of course (usefull little addition). Afterwards it is checking the player health <= 0, if so, an event will be triggered. But that event is actually a matinee (death anim), therefore it needs to be sent to another Blueprint (Map Functions) within the map, that then triggers the matinee using an Event Dispatcher.

Now to drain the health you but only need another Blueprint communicating with your Player Blueprint. Simply use the setup shown in the image above and it'll decrease your health by 5 for every tick (the higher the value, the faster you'll tick down).

Greetings,
Dave

No comments:

Post a Comment