top of page
Search

Dev Log 6# Creating Weapon class and Combat Component whilst learning more about replication

I've started to create the weapon class and a combat component alongside it. I added an enum class in the weapon class for the Weapon states as the weapon will have it's initial state where its just lying on the map somewhere, the equipped state and the dropped state when a player drops a weapon. I've also included a pick up widget for the UI so that the play can see that they need to press E to equip the weapon.

Everything done so far is to allow the player to pick up the weapon and I managed to make it so the player who is the host/ client-server can pick up the weapon. the current problem is how do I allow client only players to also equip weapons.


Something cool I learnt about replication is the use of rep notify functions which don't get called on the server. Initially the problem I faced is that when one player overlaps with a weapon to get the message "press e to pick up" it displayed for all users no matter how far away they are and that's something only the person overlapping with the weapon needs to see. However by creating rep notify function and using an IsLocallyControlled if check allows the pick up message to only display to the client overlapping with the weapon.


 
 
 

コメント


bottom of page