How to program random monster encounters?

I am trying to look for a guide on how to setup random monster encounters in blueprint, I have had little luck. I am still early into learning Blueprints, so hopefully something i can learn from/understand .

Thank you

1 Like

A little elaboration might be needed here.

For the sake of giving some ideas, I’m going to assume that you are referring to a final fantasy style random encounter when moving around a world?

At a very high level the simplest way I can think to do this would be a random number generator that is set to a number each time a battle is finished and then counts down while there is input on the movement controls, triggering the next battle when 0 is reached.

If you could potentially provide an example of what you are trying to create and what parts you are struggling with, someone would probably be able to give you some more targeted help.

1 Like

Thank you sorry for the late response,

Encounter wise I am looking to do something like a dungeon crawler like wizardry in concept where when you take at random amount of steps which triggers a monster encounter. What I am struggling with is setting up that random factor then linking that to the encounter.

1 Like

Hi, I don’t have an exact answer (but am interested in the same). I watched this tutorial that has [random spawn code, using a Length node, etc].

Perhaps it will help you get started. Watch at the time stamp, he starts setting up the code.

Or watch from the beginning if you want full context. There’s probably more specific vids. But giving you the link since you didnt get a better answer.

2 Likes

Ok, lots of ways to approach this. For what you describe with Wizardry, I would literally do a countdown with some randomness. So I’ll run you through how I’d approach it from a high level.

So in my game mode I would create an Integer variable that we’ll call EncounterCountdown and set it to something like 100 by default. I’m going to tie this to steps as that’s what you were talking about but it could be tied to anything you want (distance, time, etc). Since you cited Wizardry I will use their grid system. Each time you move to the next grid I would subtract a random amount fom EncounterCountdown by subtracting a RandomIntegerInRange and set the range to say Min=1 Max=5 and then setting EncounterCountdown to the subtracted value. If you were using an animated character you could put an AnimNotify on a footfall too if you’d prefer to do it that way.

Now when EncounterCountdown is <=0 you will call your random encounter, by whichever means you were calling that and then after the encounter is finished we reset EncounterCountdown back to its default value and begin the whole process again.

I have intentionally left this high level and vague as more of a concept rather than diving into the nitty gritty too much, but if you’re still unsure of how to proceed I can do a deeper dive.

1 Like