Tech Testing: Fire hose system
For the fire hose, I wanted to tackle the system of having it in your inventory with a variable which can be checked when trying to equip, whilst not the best for a large inventory system, I'll only be having a few items and so I feel this is the most efficient method.
Within the first person character, I created three variables named as follows
To first implement everything, I needed to create an actor that allowed the character to pick up and equip the hose, to achieve this I firstly created a small cuboid in place of a fire-hose model within my first person character, and positioned it in the viewport setting it to hidden in game.
Then, I created my actor, placed a small cube with text in the viewport and made sure the collision was overlap all dynamic, within the event graph I created a very simple string of code. When overlapped, the actor checks if the other is the character, if so it sets the variable has fire hose to true and removes the pickup actor.
I began by creating an action mapping to deal with all of the interactions within this tech test, It will used a sequenced state machine with variables which essentially means it will check if each action is being committed, if not it will move on and check the next.
The state machine itself is shown here, note that only the firehose logic is in the sequence as it's the main mechanic I'm including within my tech test
The code works by checking if LMB is pressed using the variable, and if so if the player has the firehose, and the firehose is equipped, it spawns what I've used as a placeholder projectile variable at the location of the far end of the model filling in for the hose.
The code behind equipping the firehose shown above works by checking if the player has the firehose, if so using the 1 key it will toggle the visibility in the viewport of the model and change the equipped variable to true.
Lastly, the logic behind being able to drop the hose and place it back on the ground consists of using the q key to check whether the fire hose is equipped and if the player has it, if the fire hose is NOT equipped you are able to drop it, and so it places the pickup actor using a line trace from the camera similar to the interaction system and sets the has fire hose variable to false.
Altogether, the full block of code that controls everything about the fire hose assembles to look like this within the player character.