Im trying to make a Mission NPC and when you interact with it, it sends you to another scene where you have 3 missions to choose from and when you complete one you are given 10 coins
How would I do that?
What type of missions? What kind of game? Which part(s) are you having issues with?
Basically they have types, a Scavenging Mission with a Randomly Generated Dungeon, a Racing Mission, and a Top Down Shooter Mission
The Game is a Top-Down Openworld Sandbox
Which part do you want help with? That’s a broad question. You’ll get quicker help if you are specific and do it in small parts. One issue at a time.
Here’s how I might do it.
Create a global array of structures to hold the missions. I would use a structure so you could have a long description, scene name and a short name that could be used within the scene so at the beginning of the scene any special items could be added or any custom settings. Also, the value could be used with a set of conditions to determine a winning situation.
Something like this.
How you use the mission list is up to you. You could go in order, you could shuffle the list using array tools, however you want. You could choose items based on a category or based on a skill level.
Display 3 missions, the player clicks 1 to highlight it and then clicks a begin button.
Copy the selected array structure values to just copy the index number.
Use the selected array structure value to switch scenes.
At the beginning of the scene customize the scene to align with the mission.
In the event sheet place events to check for the current mission shortened name. You could add a condition to check the short mission and either the player location or after a certain object is killed then check if that’s the current mission or if the mission is a certain value and the player is in collision with a certain object.
The types of missions are infinite. You could use individual scenes or reuse fewer scenes and place the player at different locations, give them different items and weapons at the beginning and many other options.
When the mission goals are met. You could delete the mission from the main array. You could save the array to storage. Then go back to the previous scene and continue or show new missions or the other unlocked choices. You would the add coins to the player.
How would this work for Events?
That’s not something I can get into right now. I’ll try later unless someone has a better way in the meantime.
Oh Okay, Thank you for helping though!
Here’s a crude mockup. The “summit” mission is the only mission that has interaction. The others just present a scene with a “Done” button. For the “summit” mission, you just drag the player onto the text object that says “drag here”.
Click the green [code] button and [download zip] extract and open Json file.
https://github.com/doug13579/Gdevelop-missions-example
Is this perfect? No. Is it the best way? Probably not. It is one way.
Try me: (the restart button just restarts the scene to test the shuffle, once the missions are done, there’s nothing left to do)
https://gd.games/instant-builds/8068e54b-5665-4005-9e22-d831965aa240