Announcement

Collapse
No announcement yet.

Setting variables at spawn time.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Setting variables at spawn time.

    Hi all,

    I'm basically hacking together an Asteroids-type game. When a rock gets hit by a missile, it splits into two smaller rocks by using Spawn Actor From Class in a for loop. The rock has a NumHits int variable set to 0. when the rock gets hit, NumHits increases it by 1. Is there any way to pass that NumHits (which is now 1) to the newly-spawned smaller rocks, or set the NumHits variable on them when they're spawned?

    Right now the hack and slash way to do it is to set the scale on the newly spawned rocks to 0.5 and if the box extents are greater than some number, go ahead and spawn two new ones.

    It's easy enough to spawn smaller rocks with Spawn Actor From Class, but it's kind of not cool that it only allows transform to be set. The obvious thing would be an Add Pin on the input that would allow you to get a variable from the current class.

    Or I'm just totally doing it wrong. what's the proper way to do this? Thanks in advance.

    cheers,
    -John

    #2
    Hi,

    Maybe this video will help you : https://www.youtube.com/watch?v=Qv6pTOVcVDA

    Cheers

    Comment


      #3
      That's exactly it. Thank you!

      Comment


        #4
        My pleasure, was watching it when I saw your post

        Comment

        Working...
        X