• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Npcs that give missions

A

ashorash

Guest
I'm wanting to have multiple npcs which will give multiple different "missions" so to speak. Basically all I need is for the npc to say that said mission's dialouge then give a key and player can do what needs to be done. When they come back I want them to be rewarded and to have the next dialogue and key given. I can't for the life of me figure this out(sorry if this is extremely easy). I know an array should be used but I'm stuck. I've been working with gml for about half a year so it's not greek to me but still shaky on some things.
 
D

dj_midknight

Guest
So if I were designing this I would give each mission a unique ID number. The key holds the ID number and has a value of like mission completed true/false. When the player returns after completing the mission the NPC flaggs the mission as completed by its ID in the array and then would skip to the next mission. You would need to do a check at the event level when the player initiates chatting with the NPC to see which mission needs to be issued and then use the necessary text statement. I know this is kind of a general description, but hopefully it helps.
 
N

Never Mind

Guest
Maybe all you need is a global variable. You could have it use a number to keep track of which mission the player is currently working on.
When the player comes into distance of the NPC with the next key he can give it to you like this:
-----------------------------------------------------------------------------------------------------------------------
if( global.currentMission == 4 ){
global.currentMission ++;
// show dialogue "here's the super duper key that will get you into area five!"
}
-----------------------------------------------------------------------------------------------------------------------

If it's an open world and the story has no order for the missions then you could use a global array.
That just means instead of having one variable that tells us what mission we're doing, we have variables for each mission telling whether they are have been reached yet.
 
Top