#mission system

1 messages · Page 1 of 1 (latest)

rare veldt
#

Tell me how you want to add missions? Through the JSON object? Or add manually line by line? I'll write it easier:

const buttons = [
    {
         "name": "Mission 1"
         "icon": "iconUrl"
    }
]

Result:
fm.button("Mission 1", "iconUrl")

Or

fm.button("Mission 1", "iconUrl")

If you want to use option 1: JSON task generation, then you need to make a button generator. And then already to do scripts of execution.

brazen locust
rare veldt
#

OK. You can't do exactly completing missions?

brazen locust
#

Like this?

#

Well I'll talk very briefly

I wanted to do it so that when I click on the mission button, some mobs from my addon appear
And you can only do the next mission when you complete the first one

That's basically it
Did you understand?

rare veldt
#

Yeah

#

Okey.

#

Can you give me the code for the mission menu?

brazen locust
#

One minute

rare veldt
brazen locust
# rare veldt Okey
        let missao = new ActionFormData();
        mission.title(`missions`);
        mission.body(`Click DO to start your mission:`);
        mission.button(`To do`, "textures/icons/menu/mission1.png");
        mission.show(player).then(r2 => {
          if (r2.canceled) return;
          let response2 = r2.selection;
          switch (response2) {
          case 0:
            player.runCommandAsync(`say Coming-son...`)
            break;
          default:
          }
        }).catch(e2 => {
          console.error(e2, e2.stack);
        });
#

This is the code for the quest part

rare veldt
#
let mission = new ActionFormData();
mission.title(`missions`);
mission.body(`Click DO to start your mission:`);
if (player.hasTag() != "prMis") {
    mission.button(`To do`, "textures/icons/menu/mission1.png");
} else {
    mission.button(`To do\n Another Mission Accomplished.`, "textures/icons/menu/mission1.png")
    mission.button(`Cancel Mission`)
}
mission.show(player).then(r2 => {
            if (r2.canceled) return;
            let response2 = r2.selection;
            if (player.hasTag() != "prMis") {
                switch(response2) {
                    case 0:
                        player.sendMessage(`Mission Started`)
                        player.addTag("prMis")
                        break;
                    default:
                        break;
                }
            } else {
                switch (response2) {
                    case 0:
                        player.sendMessage(`Another Mission Underway!`)
                        break;
                    case 1:
                        player.sendMessage(`You Completed the Mission!`)
                        player.removeTag("prMis")
                        break;
                    default:
                        break;
                }
            }).catch(e2 => {
            console.error(e2, e2.stack);
        });
#

@brazen locust

brazen locust
rare veldt
#

Look. I made it so that the player could not start another mission until he finished the one he started or canceled.

#

So, to compare mobs, use vanilla Minecraft commands.

#

Compere = Spawn

brazen locust
#

Hmm

rare veldt
#

And also, when canceling, you can kill the mobs that were caused by the start of the mission

brazen locust
#

Oh, OK
I am going to sleep now
Tomorrow when I wake up I'll test to see if it worked

rare veldt
#

Good Night