0

So I want when the player presses the left key, the door/gate opens. There are doors constantly spawning in the level, but you can only open the one LEAST recently spawned, so I have the doors in an array. So when you press left, it gets the door at index 0 and opens only THAT door. Idk if that makes sense...

Here you can see what I'm doing: The Error in my Blueprint

I've been trying to figure out what this stupid error is literally all day. Why can't I figure something out that looks so simple!

Bowser jr.
  • 21
  • 1
  • 8

1 Answers1

0

According to your image, you should wire Pressed to the Cast to node, and wire cast successful to the Open node...

Also make sure your PlayerBP_Normal is able to receive player input so that input action can be triggered.

And to get [0] of the array to get the oldest door makes sense I think. Just to make sure you add spawned doors to the end of the array, so the first one is the oldest.

Marson Mao
  • 2,935
  • 6
  • 30
  • 45
  • Thank you, that worked (bruh)! But one more thing (sorry). My array is stored in a different blueprint (GameMode). I set the array as public so that I could access it from the playerBP. But now there's an error saying I must have a reference to the blueprint that the array is in. I'm not sure how to get that. I'm thinking if I should just move these nodes to the blueprint (my GameMode) where the array is. – Bowser jr. Aug 18 '16 at 15:26
  • To access the GameMode object is very easy. https://docs.unrealengine.com/latest/INT/BlueprintAPI/Game/GetGameMode/index.html Check here. The node returns base class so you also need a cast, like your door BP. Where to put the code is based on your design, I'm not sure which one is the best solution :P – Marson Mao Aug 19 '16 at 02:57
  • Lol, I ended up figuring out how to reference an actor/BP. Turns out all I had to do was add a variable of type whatever bp I wanna reference. I'm pretty much a beginner user(started this month). But thanks brother :) – Bowser jr. Aug 19 '16 at 04:31
  • No problem, if you need any help just ask :P Glad to have more people using Unreal! – Marson Mao Aug 19 '16 at 06:49
  • I have another question, but Stack won't let me ask >.< Apparently I've asked 3 questions RECENTLY, when I asked one 2 days ago, and before that my last question was a few months ago, so what the hell.. It's a weird error too. – Bowser jr. Aug 19 '16 at 17:12