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 to spawn an actor using variable?

Dont want to select actor to spawn manually by selecting in "Class" pin. i'm giving it using a variable "Character To Spawn". but when i do that "Switch To Character" pin doesn't show up. and cant use "Self Reference". This all thing making the spawning work but now i am not able to possess the spawned character ?? what can i do ??

alt text

Product Version: Not Selected
Tags:
34883-possess.jpg (249.9 kB)
more ▼

asked Apr 05 '15 at 01:46 AM in Blueprint Scripting

avatar image

VeerChidar
143 30 33 94

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

2 answers: sort voted first

Well never mind i figured it already... Because i couldnt get the new pin to set self reference.. i just had to save the reference of first (main) character in the 2nd (Spawned) character manually as game begins.. it solved the problem..

now i also know why we needed that self reference.. and how to spawn actor with using a variable so i can spawn anyone just by changing the variable value..!!

more ▼

answered Apr 05 '15 at 03:17 AM

avatar image

VeerChidar
143 30 33 94

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

The Possess call only works for Pawns. Since a class variable is generic, i.e. any actor class can be filled in as variable, the Blueprint compiler has no way to find out that you spawn a subclass of Pawn.

Therefore: you can use a Cast To node to cast the output of the Spawn Actor to a Pawn. This fails if the supplied class in the Character To Spawn class variable is not a subclass of Pawn, but succeeds if a correct class is selected (e.g. First Person Character).

And after casting it to Pawn you can call Possess.

more ▼

answered Apr 05 '15 at 03:14 AM

avatar image

HAH
217 3 8 16

(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