Simple gathering resources (Blueprint)

Hello,
I learn Blueprints for some time, trying to do basic base building/resourse managing 2D game.
I’m stuck trying to make my NPC to go to spawned object (resource), stand there as a start to gathering and come back to starting target point.
I’ve learned to make NPC going between target points, I’ve learned to spawn things, I can’t find suitable info on what next. Tutorials I found were way too complex (like doing final version of advanced game of similar type).

Thanks in advance

Hey @sapphi31! Welcome to the forums!

A few questions to help get the ball rolling:

  • What specifically are you having trouble implementing?
  • What is working so far?
  • What tutorials are you following?
  • Would you mind sharing your blueprints so we have a better understanding of what you need?

Any additional specifics you provide may go a long way in solving your problem!

Thank you!

I’m graphic artist trying to learn Unreal (first attempt in any programming) so my communication here maybe not quite simple. I know 3D and have some understanding of it in games (collision shapes f.ex.)

For now I’m trying to:

Make NPC that when object spawns in game goes to this object and then (after Delay) goes back to his start point.
I imagine later in place of Delay I’ll create interaction between NPC and object where object (let’s say berries bush) with some points (berries) ‘gives’ them to NPC.
In effect player gathers resources (berries) via interaction of NPC with object which shows in some form (as growing numbers or adequate drawings) on screen.

What I learned to do:

I know how to use NPC and Move To to move it between created waypoints (Target points),
how to create spawn object which spawns my object (‘bush with berries’).
Now I want to know how to make my NPC to go to object which just spawned instead of target point, stand next to it for few seconds and then come back.

-What is optimal Event to choose for this? Custom event?
-How to make detection of appearing object resulting in NPC moving to it? (I learned a bit about tracing - maybe Box Trace?

Tutorials:

I follow many simple tutorials and some complex like TwoNeurons RTS series (which I learn few things from) on You Tube.

I’m sorry, I don’t know how to share these files for now.

Hey @sapphi31,

Okay, so lets break down what you are struggling with a little bit more. Sounds like what you want specifically is as follows:

  • Spawn a resource actor at a specific location and trigger an event.
  • Have an NPC actor move from point A to B and perform an action after the resource is spawned.
  • Once action is complete or a timer resolves, the NPC actor returns from point B to A

Do I have that right so far? If so, it sounds like you have the middle and last section at least mostly figured out since you know how to move your actors.

The biggest thing that I can see helping you here is Blueprint Interfaces. This will allow your blueprints to communicate. For example, you can call a custom event through an interface from your resource when it spawns that takes in the resources location. That event would trigger an event in your NPC actor kicking of the chain of events you are trying to pull off. Check out these non-Epic affiliated breakdowne of interfaces to get you started:

I hope the above is what you need!

Hi Quetzalcodename!

You understood me perfectly! Thank you very much for pointing me in direction of Interfaces and suggesting some steps to take as I felt completely lost in jungle of information, truly appreciated!
I’m going to try this out.

1 Like

Hey @sapphi31!

Checking in. Was the above the solution you were looking for?

1 Like

Hi Quetzalcodename,

Yes, it seems to be proper solution. It took a while (lot to learn details about addressing blueprint on the other side of Interface). Learned a lot, thanks again!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.