K.r.a.k.e.n.
Scripter
The first game project at FutureGames. We made this game during two weeks time, beginning on the second week after the school course start. It is built using the Unreal Engine 4.
In this project I was the Lead Scripter and also worked with the team in Game Design.
I made scripts for the player character( including the movement, Weapons, Gui scripting), the win/lose conditions and the health/ammo pick ups
Ammo Pick up Script
This script activates when the player is picking up ammo for their gun. First it checks if the player has less ammo in the magazine than the max amount. If it is then if checks if the backpack ammo amount is less or equal to the max backpack amount and ads the set amount for the ammo pick up to the backpack, checks if the backpack amount is more than the max amount it takes the gun magazine size and subtract it with the amount of bullets in the gun to figure out how many that is missing and ad that on top of the back pack amount.
Reload Script
When reloading it checks if there is any ammo left in the back pack, if there is it puts all the ammo from the gun in to the backpack and checks if the backpack amount is more or equal than the magazine size. If it is then it ads a full magazine to the gun and subtract the magazine size from the backpack ammo amount. If the backpack ammo amount is less then the magazine size it ads remaining amount to the gun and subtracts on it self to zero.
Player Camera Script
This script is for a top down player camera that can move a small amount around the player character. It updates every tick/frame and cast from the player controller to the player character to be able to get the player camera. then it finds out where the location of the of the mouse cursor is and and subtracts it by the player characters position and multiply it by the amount of "leeway" that is desired for the camera movement to have and ads it on top of the the player characters location. Then the vector is broken in to floats, the x float is subtracted by the amount that i don't want the camera to move, the y axis is taken as it is and z axis is taken from the cameras original position so it doesn't move away form the character. All the floats are then put together to make a vector again and it sets the cameras new position.
Explosion Damage
This scripts happens when the players missile hits an enemy or obstacle. It takes the hit location, creates an particle effect, plays a sound at the location and destroys the projectile that hit the enemy or obstacle. It creates two sphere traces on the hit location, one smaller in the middle for direct impact and one larger for splash damage. It checks the result from the sphere trace if it hit any object from the class Enemy. Then it cast to the hit enemy and damages them.