Randomized boss selection and ability acquisition for an NPC

I’m making a platformer which allows the player to select a level and then gain a new ability after beating the boss at the end of the level.

After beating a boss a different boss will be randomly selected to be unavailable. There are 8 bosses in total so this will happen 4 times after the player defeats the enemy. After which they will then face a character that has the four abilities they do not have.

What is the best way to program this to make sure it can be done randomly?

Hi,

Not sure if I understood your question correctly, but if I did;

After beating a boss, change a boolean variable “beaten” of this boss to TRUE. Then to pick a random other boss, use these conditions:

  • boolean variable “beaten” of boss = FALSE
  • pick a random “boss” object

Note: “boss” is a group that contains all the bosses.

This will work if you have 1 scene. but if you’re loading different scenes, then you’ll need to use global boolean variables.

When you beat a boss (assuming the object’s name is boss1), change global boolean “array.boss1” to TRUE.

To copy the boolean variables to the boss objects:

For each “boss”

  • global boolean array[boss.ObjectName()] = TRUE → change boolean “beaten” of boss to TRUE

Then you can pick a random boss using the same event as before.

1 Like

Thank you we will work, with this in mind.