I’ve a serious problem in spawning different actors from an array/variable in multiplayer.
In a widget called “GameHUD” I have a quick-menu. It’s a kind of inventory where the player can choose his spells. This widget is created in the blueprint MyPlayerController (like the one from the ShootOut-Demo is).
This is the blueprint:
In MyPlayerController I also set the spells. These spells are set in a structure like this:
These spells are added to the quick-menu like this:
In the event graph of the MyPlayerController it looks like that:
In “GameHUD” I am going to create the HUD for the player and set the spells to the quick-menu. The player is able to click on the spells to choose them. That works fine and looks like this:
In the game the quick-menu is shown correct: and if the player clicks on the spell the spell is going to show up in the lowest field. Like that:
The Actor from the structure is also going down to the lowest field.
It works fine until here. But now the problems are going to start…
If I start the game in singleplayer, everything works fine.
If I choose two players, the client is able to choose a spell from the quick-menu, but only the server can spawn the spell(actor). At the client there is a fail showing up. … no, not a fail - I created an isValid an on the client it is NOT valid. It is this one:
I tried different ways… Right now it looks like that:
If the client presses the left mouse button, the event “Server Attempt Spawn Fireball” gets fired. This is replicated and set to “Run on server”. Then the event “Spawn Fireball” gets fired - this is “Run on server”. Now the Spell is going to spawn, but now the event gets called from the server - not the client. That means InGame: The client can only spawn the actor(spell), the server has chosen. If the server is dedicated, nothing is going to spawn.
I also have a video (but no sound - sorry for that).
It is all set like in the MultiplayerShootOut, but it is not working.
Can anyone help me out, please!?