Announcement

Collapse
No announcement yet.

Getting an actor from Array

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

    Getting an actor from Array

    Essentially, I have been building a game, revolving around the idea of being directed to random airports, as the player flies around looking for various objects. I have an actor class called airport, which refuels and gives some bare dollar to the player on "collision"(It more flies over but you know).

    In my player controller, all instances of the airport class are put into an array. The array then picks a random airport which will be the one the player will fly too to get refuelled. Through a blueprint interface with a selected airport, IN node and a correct airport out node, this then goes to an if statement in the airport BP so that only the selected airport will refuel the player. It also gets HUD for when I want a HUD visualisation for the correct airport of some form or another.

    The thing is, that hasn't quite happened and I'm not sure how to debug test to see if the array actually gets anything in it. I deleted all other airports in my map, bar one, and when I fly over nothing happens, no refuel ect. I think I have just gone about the whole thing the wrong way but here are the sections of my BP I am referencing.
    Click image for larger version

Name:	PlayerC.jpg
Views:	1
Size:	103.6 KB
ID:	1213123
    Click image for larger version

Name:	airport.jpg
Views:	1
Size:	93.1 KB
ID:	1213124
    Click image for larger version

Name:	RightAO.jpg
Views:	1
Size:	80.6 KB
ID:	1213125

    Any suggestions would be fantastic. Sorry if it hurts you to look at it.

    #2
    Easy trick I use to debug is put a print string node between any major function or event with a meaningful message. Once you do that you should find your issue.

    Comment


      #3
      ^ I would put print string nodes in one at a time, and find where things look funky. Or put a bunch at one that have different messages like, your code reaches "here", "no, here!", "here now!" etc. and see if the code even runs all the way through. I would also print string the actor selected by Get from the Get from array, and maybe even make a for loop to output every actor that is stored in your array.

      General advice...maybe the overlap isn't working? That's what I would check first-->print string the overlapped actor.

      Comment

      Working...
      X