x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Networking - Where to spawn actors in blueprints?

To set the stage, I'm trying to develop a card game. The game starts without any cards or decks (these are the actors I need to spawn) on the map so that the player may spawn these in when ready. I've tried various places in Blueprints to spawn these cards, but haven't found a solution that works in multiplayer. I don't really want to spawn the starting decks in the World Blueprint because I want to transfer the logic to other maps in the future. Here is my current setup:

  1. Game Mode - Only character spawning logic in here at the moment.

  2. Game State - I wanted to spawn the starting decks once (with replication) so I put the spawning logic in here.

  3. Player State - Not much here currently.

  4. Player Controller - Player input logic here.

  5. Player Character - This is where I spawn cards for each player's hand. It also controls how the cards move via timelines.

The problem is, whenever I cast to the player state or game state and save them as a variables, the client's (it works fine for the server) variable is blank in the Player Character. To give an example, the Player Character BP attempts to draw a card from their deck so in the Player Character BP I edit all the required variables (such as which card I draw) then I cast to MyGameState to find out the location of their deck so I can spawn the card there and move it to the player's hand. But the client has a blank variable that refers to MyGameState and it doesn't work.

Am I setting this up right? Or perhaps, should the Game State be handling the card movement? Or something else entirely?

I can post pictures later if needed. Thanks!

Product Version: UE 4.9
Tags:
more ▼

asked Nov 23 '15 at 06:54 PM in Blueprint Scripting

avatar image

uw19
25 7 6

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Not in a position to really read your question all right now, but a suggestion is you could create a new blueprint, make it a child of PlayerController. Make sure in your game mode you use this new playercontorller you made.

Then spawn your cards in on begin play in the player controller. See if that helps you.

more ▼

answered Nov 28 '15 at 08:51 AM

avatar image

thankstipscom
644 38 37 70

avatar image uw19 Dec 07 '15 at 05:41 PM

My main issue was that I wasn't casting the player controller to get the player state for that character. Once I got this working, my setup above seems like it's the way to go. Thanks for the help!

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question