As I had a controller at my side giving me the ability to test my build right away on implementation of each new button input, this made the process a lot faster also.
The simplicity of the gamepad input lays in the events within blueprints, as with a very quick search for resource on the matter I found a completely referenced layout of a controller, using Unreal Engine 4 terminology.
Taking this into account, I set the button layout according to my current blueprint, making use of the fact that two inputs can be set simultaneously to the same piece of code. My allocated controller functionality was mapped as so;
- Standard Attack/Combo: Gamepad Face Button Left (X on Xbox controller)
- Special Attack: Gamepad Face Button Top (Y on Xbox controller)
- Dodge Roll: Gamepad Face Button Right (B on Xbox controller)- Switch Weapon: Gamepad Left Shoulder (RB on Xbox Controller)
- Shield Mode: Gamepad Left Trigger (LT on Xbox controller)
- Slow walk: Gamepad Left Thumbstick (LS on Xbox Controller)
I purposely set aside two gamepad functions for other features I decided to add;
- Jump: Gamepad Face Button Bottom (A on Xbox controller)
- Auto Lock-On: Gamepad Right Thumbstick (RS on Xbox Controller)
-----------------------------------------------------------------------------------
Elaborating on the two button inputs which had been left vacant for features to be implemented, I have also added an auto aim/lock on feature, set on a toggle, and a jump.
Firstly, the jump is a very simple animation setup, set up in accordance with the setup in the base character blueprint.
I simple have the Gamepad Face Button Bottom and Space Bar input options set into a branch, which makes sure the played is not attacking, switching weapon or currently jumping. This branch, when read as false, communicates with the next branch, which is set to read whether or not the player is in Sword 1 or Sword 2 mode, this then triggers the difference in animation, as both stances have their own jump animation.
The animations themselves are set simple with "set att montage" nodes and a 'play anim montage' node.
I have no current means to test the functionality of this within my level in terms of geometry, but I will be looking to perform a quick test and and when I get a moment, to see whether or not this jump allows me to mount higher objects. I would ultimately have liked a higher jump animation, but the animation in use is the one within the specific set of animations, I would add an upward launch value in but feel the jump would then look completely unrealistic.
-----------------------------------------------------------------------------------
Alterations have been made to the core blueprinting process of my NPC, which have now allowed my NPC to die successfully without firing off other attacks prior to the actor being destroyed, I have also allowed my character to die and respawn just outside of the battle area.
As the fix was slightly confusing I consulted my peers for any opinions and knowledge they may have been able to lend on the subject and I have subsequently fixed the animations to fire appropriately, making the NPC die upon hitting 0 health.
There still appears to be a very minor issues with collision components casting damage, but I am happy with having fixed what was more of a core problem.
This was a pressing issue which I am thankful I have been able to rectify before my deadline, as the the NPC was dying, but not dying properly, as it could still fire off attacks.
I will look to fix the collision issues also, but right now they do not appear to unbalance the game too much, the boss fight has a certain tier of difficulty and can be beaten, but can also beat you if given the chance.
-----------------------------------------------------------------------------------
The final piece I have added to this point is a lock-on feature, set on the Right Stick Button and Tab, on a controller and Keyboard respectively.
To set the camera lock, I needed to implement a timeline and gate into my blueprint, the Timeline set to enter the gate, and the toggle occupied by a series of 'get all actors of class' and 'lock on' nodes.
The gate is then followed by a cast to game instance followed by a 'Set Control Rotation' node which contains all of the appropriate rotational information necessary on every axis.
Any Roll/Pitch and Yaw information which is applied through the core camera sequence is then plugged into the new rotation socket on the eventual set control rotation node.
The final product of the lock on is set to a toggle so that when I click in the right stick once on the controller or hit tab once on the keyboard the camera will lock to the NPC, with another press being required to remove the lock and return the camera to free movement.
The structure of the blueprint can be seen below;



No comments:
Post a Comment