How to set it up so a client can request a new powerup from the server?
Yo! Let's say I have two vehicles loaded into the game. One is the listen server, the other a client.
I have these functions for picking a random powerup from a list. However, I'm not sure how to get each vehicle to be picking a different powerup. I'm pretty sure this is just picking one random powerup and replicating it to every client, but I want every client to randomize their own power up when they need to.
They use the power up, ping the server that they consumed it, and then server eventually assigns them a new powerup. How should I be looking to implement this?
asked Apr 07 '17 at 08:37 PM in C++ Programming
This is how I would look at it:
You would create a Actor "Pickup" class, that is replicated. This class would have a collider component with a overlap function bound. When a vehicle overlapped it, i would then tell the vehicle to handle the buff (because all clients will have a copy of the vehicle class as I am guessing its from APawn). From there, I would check if its the server calling it - which is 100% will be as setup but if you had another call from the client, this would handle that too.
If it isn't the server, it forwards the "buff" class in as a server function, which then goes back around to the GrandBuff, but this time as authority, and then can handle the event from the server side.
answered Apr 07 '17 at 09:47 PM
ImVawx ♦♦ STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here