- Home /
HLAPI: Changing attack prefabs of player object
What I want to do:
I have a game where players can chose their attack-ability before the gameplay starts. Their choice should then be sent to the server, and on the server the attack-abilities prefab should be swapped for whatever the player chose. The game will only be visible on the device that was chosen as dedicated server.
What I have
I have a "SkillController" script that handles some ability logic (what element is what ability and so on), finds the correct prefab and then saves it in a field, and I have a "PlayerController" that uses CmdFire to instantiate the prefab saved in the skill controller. Both scripts are placed on the player-prefab.
Problem
Whoever connects first is the only player able to swap out their abilities. Everyone else is stuck with the default value. I figured: The skill controller is placed on every PlayerObject, and is also a NEtworkbehaviour. I set the desired prefab on the client side, then send a Command to the server to update the SkillController associated with the commanding player. From then on CmdShoot spawns the new prefab instead of the old one.
That actually works, but only for the first player connected.
I am missing a core concept, could someone enlighten me? Why does only the first client that connects to the server get to change stuff?
Your answer
Follow this Question
Related Questions
How to Connect() in LAN, not working? 1 Answer
Network Discovery - Stop Broadcast not Intialized? 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers