we are creating a game with different levels, each levels have 3 mission, but we don't know how to create 3 missions in one level. please help!! thanks in advance
Sorry, that's not nearly enough information for anyone to help you. Generally, people find better help here if you post code, screenshots, and ask for specific issues you're having, instead of asking for high-level "How do I do this?" kind of things. What is a mission? Is it just a small level? Is it an objective the player has to complete? Do you have code in place to get one mission working, but you need help getting the game to require 3 of them? The more specific info you can provide, the better your chance of receiving assistance.
Exercise - What is a mission? Possible answers The user has to collect a certain number of items to complete each mission The user has to complete some arbitrary objective The user can choose between completing one of three options, thereby modifying the game story Good code will flow naturally out of a good description of functionality. In general terms a mission system consists of the following A way for the user to view active quests and progress A way for the user to gain new quests A way for the game to detect progress on a quest and if a quest is completed
sorry if i did not explain it clearly, well that's actually my problem, i don't have enough knowledge in making a game in unity specially in scripting, sorry again
This is nothing to do with scripting, and everything to do with design. Provide a good plain English description of your objectives, and we can help out with the scripting.
yeah, we did that but our concern on our game was, every level has 3 missions, but i don't know how to create 3 missions in one level.. actually i have a script but it only have one mission, here it is function Update () { if(currentScore >= 500) { Application.LoadLevel ("mission complete1"); } } if i'm going to continue it with else if statement, and make another mission, for example, if the player get 3 power up and get that 500 coins then that will only the time for Application.LoadLevel ("mission complete1"); well that's basically my problem.. i'm a newbie, sorry
actually i only have 1 mission for now, its was like, if the character reach 500 coins then the game will stop and there a scene will show saying "mission complete", but we at least need 3 missions.. when the player reach that 3 missions that's the time the mission complete will show. sorry i'm not really good in english language, sorry
OK, so you mean the player has 3 'objectives' rather than 3 'missions.' Objective 1: Collect 500 coins Objective 2: ??????? Objective 3: ??????? What are objectives 2 and 3?
As @superpig alluded to, you have to be able to describe what the other two missions/objectives are. As far as scripting goes, instead of just loading the next level when the player has accomplished one mission, check to see if they've completed all of them. Code (JavaScript): var isObjective1Complete : boolean = false; var isObjective2Complete : boolean = false; var isObjective3Complete : boolean = false; function Update () { if (currentScore >= 500) { isObjective1Complete = true; Debug.Log("You completed goal 1!"); } if (bossKilled = true) { isObjective2Complete = true; Debug.Log("You completed goal 2!"); } if (stdsAcquired < 3) { isObjective3Complete = true; Debug.Log("You completed goal 3!"); } if (isObjective1Complete && isObjective2Complete && isObjective3Complete) { Application.LoadLevel ("NextLevel"); } } There's certainly way more efficient ways of handling this, but it should give you the idea, anyway.
I'd just like to point out @joytdecastro that the script I provided won't just work on its own. The individual objective goals will still need to be set from elsewhere once those tasks are completed. My intent was just to lead you in the right direction.
joytdecastro, if you answer the above I am sure you will get the exact answer you are looking for. Your first mission is collect 500 coins? What is mission 2 and 3 in the same level?
for the mission 2 is to collect 5 power up that has tag "PowerUp" and for mission 3 is to score 5000 points, but i'm having problem for the mission 3 because i'm going to get the score from different script, but it is from c# script, and i'm using a js script. and i don't know how to convert it to js script.. but here's my code for the c# Code (CSharp): using UnityEngine; using System.Collections; public class GameControlScript : MonoBehaviour { public GUISkin skin; float timeRemaining = 500; float timeExtension = 3f; float timeDeduction = 2f; float totalTimeElapsed = 0; float score=0f; public bool isGameOver = false; void Start(){ Time.timeScale = 1; // set the time scale to 1, to start the game world. This is needed if you restart the game from the game over menu } void Update () { if(isGameOver) return; totalTimeElapsed += Time.deltaTime; score = totalTimeElapsed*100; timeRemaining -= Time.deltaTime; if(timeRemaining <= 0){ isGameOver = true; } } public void PowerupCollected() { timeRemaining += timeExtension; } public void AlcoholCollected() { timeRemaining -= timeDeduction; } void OnGUI() { GUI.skin=skin; //use the skin in game over menu //check if game is not over, if so, display the score and the time left if(!isGameOver) { //GUI.Label(new Rect(10, 10, Screen.width/5, Screen.height/6),"TIME LEFT: "+((int)timeRemaining).ToString()); GUI.Label(new Rect(Screen.width-(Screen.width/10), 10, Screen.width/10, Screen.height/10), "SCORE: "+((int)score).ToString()); } //if game over, display game over menu with score else { Time.timeScale = 0; //set the timescale to zero so as to stop the game world //display the final score GUI.Box(new Rect(Screen.width/4, Screen.height/4, Screen.width/2, Screen.height/2), "GAME OVER\nYOUR SCORE: "+(int)score); //restart the game on click if (GUI.Button(new Rect(Screen.width/4+10, Screen.height/4+Screen.height/10+10, Screen.width/2-20, Screen.height/10), "RESTART")){ Application.LoadLevel(Application.loadedLevel); } //load the main menu, which as of now has not been created if (GUI.Button(new Rect(Screen.width/4+10, Screen.height/4+2*Screen.height/10+10, Screen.width/2-20, Screen.height/10), "MAIN MENU")){ Application.LoadLevel(0); } //exit the game if (GUI.Button(new Rect(Screen.width/4+10, Screen.height/4+3*Screen.height/10+10, Screen.width/2-20, Screen.height/10), "EXIT GAME")){ Application.Quit(); } } } }