- Home /
How to trigger a mission in a FREE-roam world
Hi How to make a mission trigger in a free-roam world like in GTA 4
Answer by duck · Nov 01, 2010 at 07:28 PM
Well, very broadly speaking, you could use a trigger collider to trigger a function when the player enters that zone.
However, it's difficult to answer this question in any more detail because it is such a broad topic!
In fact, the design problem of creating a general-purpose system of defining your missions is a much larger task than working out how to trigger them once they are set up. For example, a mission definition would probably have some kind of route definition consisting of multiple targets or waypoints, information about which enemies spawn, and at what time, and pieces of scripted dialogue which might occur at certain points.
Ideally, your system would need to allow for as much variation as you need, while still being generic enough to avoid having to write custom gameplay code for every mission.
Since this is a topic that could easily fill a chapter of a book, you'll have to start narrowing this down to more specific problems to get further help.
Good luck!
Answer by HolBol · Nov 01, 2010 at 07:58 PM
Dude, it's obvious you have some high expectations even though you're probably very new to games dev. Start out with something small. Making a free-roam world will take countless hours from your time, and even getting close to GTA 4's standard would be an amazing achievement for just one person. I recommend starting out much smaller, maybe look at the TornadoTwins tutorials on youtube to get you started. Do this, then each time you make another project, just make it a little bit bigger. Add something new in, whatever.
Anyway, before I disregard this question completely, I'll answer.
If (on a simple level) you want to launch a mission the way GTA 4 does, you'll need to script it so when the player enters the trigger, a new scene is loaded. Something along the lines of this :
//This is in JavaScript, ok?
//this variable lets us pick the scene number //(in the build settings) from the editor. var leveltoload = 1;
//when this trigger is entered. function OnTriggerEnter() {
//load the level number in the variable application.LoadLevel(leveltoload); }
Just attach this to a box collider and mark it as a 'trigger' in the editor, and attach the above script to it. Now, make sure you have 2 scenes in the build settings, the one with the collider in, and the other being the level you want to load. Now walk your character (the stock fps controller should be fine for now) into the trigger object you made, et voila! Scene loaded.
It will take a lot to get to GTA4's scene loading, as you'll have cutscenes to load instead, camera fading and many other things to do.
Just remember: Use this as a starter, and build on it. Look through the Unity manuals, watch some videos and read some tutorials. Then you're set to go.
Anyway, very detailed answer.Implying that $$anonymous$$ilian is a novice.
Answer by StephanK · Nov 01, 2010 at 07:29 PM
That depends on what condition you want to trigger the mission. The easiest way would be a trigger collider placed anywhere in your world. If the player enters this collider you could trigger your mission/events whatever.
Your answer
Follow this Question
Related Questions
How can I make Game Objectives? 1 Answer
Best way to store / activate levels in a game? 1 Answer
Create missions system like subway surfer or Danger boat 1 Answer
Mission system, Postal service delivery game 0 Answers
Need Help With Mission Gen. 2 Answers