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"

How do I change Default pawn and keep it for a new level?

So I have a custom player controller to set my defaults pawn, and having a Game instance to store my default pawn (uses pawn class var), When game starts I cast to the instance and get the desired pawn but when I get that to set it for my Gamemode's default pawn, It's not setting it, The blueprint in the image that I attached, is not failing but do nothing? So how do I change my default pawn in my custom gamemode and store it for future levels?!

Product Version: UE 4.14
Tags:
casting.png (136.0 kB)
more ▼

asked Nov 17 '16 at 08:20 PM in Blueprint Scripting

avatar image

Lathost
5 7 11 13

avatar image CrimsonHawk Nov 18 '16 at 12:33 PM

Is it a Multiplayer game by any chance? And how do you test if it is set to yours or not? Is CharSelected a Pawn actor, or child class of it?

avatar image Lathost Nov 18 '16 at 05:30 PM

I just want to have button to control what I will spawn as by my default pawn, is this possible with blueprints?

avatar image CrimsonHawk Nov 18 '16 at 06:34 PM

Most probably, but this doesn't really answers my questions. Is it an online project, or only one player? do you know that you couldn't set the pawn?

avatar image Lathost Nov 18 '16 at 07:01 PM

it's not! but maybe in the future?!, So when I press a button, I cast to game instance and change player pawn class, shouldn't that store it? Because in my player controller I cast to my game instance and get the pawn class, then I cast to my game mode and set the default pawn class, Is there a better way? sry for not answering you in the first place! :/ thanks tho!

avatar image CrimsonHawk Nov 18 '16 at 08:54 PM

Could you zip up the project, and upload it here, so I could take a look at it?

avatar image Lathost Nov 18 '16 at 10:05 PM

sry I can't just zip it up, but do you not understanding me? In my game instance I just create a pawn class variable reference, In player controller I have an event begin play, I cast to my game instance and after that cast to my custom game mode BP, and set default pawn in my custom game mode from the game instance cast, When I press the menu button I cast to my game instance and set the pawn class variable, should I sen you picks on what I have done or do you understand? :D

avatar image CrimsonHawk Nov 19 '16 at 01:24 AM

I understand, you want to press a button, and change the defaultpawn class to something else. But I don't understand how do you know if this variable setting happens or not? Your current pawn won't change because of it. Do you make a respawn? Do you make a print string? I don't see the bigger picture, that HOW do you know it didn't change, and what are you trying to achive by changing the defaultPawn mid-game. So yes, pictures, and more new details would be great. Or just reproduce the issue in a clear project and send me that, or I don't know. Any new information that you got :D

avatar image Lathost Nov 19 '16 at 12:50 PM

I just found the problem! it's not setting the default pawn class in the world setting so the level don't know what to do but the game mode knows what to spawn with, the world settings appears to set the default pawn class after what I had set it to in my custom game mode (manually). so when I go in to the blueprint and the set the game mode it works,

avatar image CrimsonHawk Nov 19 '16 at 01:58 PM

AAAaaaa! You can't set the default-default pawn from the game. All this set does is change the DefaultPawn until the end of the level. when you restart the game it changes back to the real default one.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Not really answers you questions, but alternatively you can make a new variable "DefaultPawn2" in your GameMode and use that to spawn your pawns accordingly.

more ▼

answered Nov 18 '16 at 12:35 PM

avatar image

CrimsonHawk
531 25 24 43

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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