Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //You'll need a lot of cleaning and tweaking (and there's some optimising to be done) to get this good.
- //Unity + C#
- //I MADE THIS www.totalwarp.co.uk
- PlayerVARSTORE.cs
- //Quests
- public static int OnQuest = 0;
- public static string ActiveQuest = "None";
- public static string QuestType = "";
- public static string QuestLocation = "";
- public static string QuestKillMob1 = "";
- public static int QuestCollectAmount = 0;
- public static int QuestKillAmount = 0;
- public static int QuestAmountKilled = 0;
- public static int QuestAmountCollected = 0;
- public static int QuestsCompleted = 0;
- public static int QuestsFailed = 0;
- public static string QuestCollectName = "";
- public static int StoryQuest = 0;
- public static int QuestTurninRequired = 0;
- TestKillQuest01.cs
- public int Questinternalnum = 2;
- public static string QuestName = "Test Kill Quest";
- public static string QuestDifficulty = "Easy";
- public static string QuestType = "Kill";
- public static string QuestKillMob1 = "Test Enemy";
- public static string QuestCollectName = "Disrupted Cubes";
- public static string QuestLocation = "Protective / Beacons / Cave ";
- public static int QuestRequirementLVL = 2;
- public static string QuestRequirementMisc = "";
- public static int KillAmount = 5;
- public static int StoryQuest = 0;
- public static int QuestRewardexp = 30;
- public static string QuestRewardItem = "None";
- public static int QuestRewardMoney = 50;
- public static int QuestTurninRequired = 0; //Formally "QuestCompleteAction" m = move out of area to town hub | n = Do nothing
- public static string QuestCompleteTextN = "Defaults.DefaultQuestTurnInText"; //Text to display when quest complete and no need to turn in
- public static string QuestCompleteTextM = "Defaults.DefaultQuestCompleteTextN"; //Text to display when quest complete turn in required
- public static string QuestText = "This is a Test Mission. \n \nKill "+ KillAmount +" of "+QuestKillMob1+"\n \nTeleport Location: "+QuestLocation+"";
- Defaults.cs
- public static string DefaultQuestCompleteTextN = "Quest Complete! Returning to town in:";
- public static string DefaultQuestTurnInText = "Active Quest Completed!";
- public static string QuestErrorBROKEN = "QUEST HAS BROKEN Please note the following: "+ PlayerVARStore.ActiveQuest +""+ PlayerVARStore.QuestType +""+ PlayerVARStore.QuestCollectAmount +""+ PlayerVARStore.QuestAmountCollected +"";
- public static string DefaultQuestFail = "You have failed "+ PlayerVARStore.ActiveQuest +".";
- public static string DefaultQuestImpossible = "Your quest has been rendered impossible.";
- Enemy (I only had one enemy in my game at the time so this only really works as a basis.)
- if(PlayerVARStore.QuestType == "Kill"){
- if(PlayerVARStore.QuestKillMob1 == EnemyName | PlayerVARStore.QuestKillAmount != PlayerVARStore.QuestAmountKilled ) {
- MessageDisplayerg.DisplayMessage("Mission Updated: "+EnemyName+" Killed");
- PlayerVARStore.QuestAmountKilled += 1;
- }
- } else {
- if(PlayerVARStore.QuestAmountCollected < PlayerVARStore.QuestCollectAmount ) {
- MessageDisplayerg.DisplayMessage("Mission Update: Obtained "+PlayerVARStore.QuestCollectName+ "");
- PlayerVARStore.QuestAmountCollected += 1;
- }
- }
- MISSION VENDOR.cs
- public class MissionVendor : MonoBehaviour {
- string selectedquest = "None";
- public string selectedquestQuestText = "None";
- int selectedquestQuestRewardExp = 0;
- int selectedquestQuestRewardMoney = 0;
- int selectedquestQuestReqLVL = 0;
- int selectedquestStoryQuest = 0;
- string selectedquestFullQuestName = "";
- string selectedquestQuestLocation = "";
- string selectedquestQuestKillMob1 = "";
- string selectedquestQuestCollectName = "";
- int selectedquestCollectAmount = 0;
- int hidequitmission = 0;
- int selectedQuestKillAmount = 0;
- string selectedQuestType = "";
- int selectedQuestTurninRequired = 0;
- string selectedQuestRewardItem = "";
- int selectedQuestRewardAmountItem1 = 0;
- string selectedQuestRewardItem2 = "";
- int selectedQuestRewardAmountItem2 = 0;
- void OnGUI (){
- //left-most position, top-most position, total width, total height
- //background boxes
- //GUI
- GUI.Box ( new Rect(120,100,700,490),"MISSION VENDOR");
- GUI.Label ( new Rect(150, 130, 100, 20), "Mission List");
- //GUI.Label ( new Rect(380, 130, 150, 20), "Mission Description");
- //GUI.Label ( new Rect(380, 130, 150, 20), "Story Missions");
- GUI.Box(new Rect(160, 150, 200, 400), "");
- GUI.Box(new Rect(390, 150, 400, 300), "Mission Details");
- GUI.Box(new Rect(390, 460, 400, 90), "Quest Rewards");
- GUI.Box(new Rect(404, 180, 370, 260), ""+selectedquestFullQuestName+"");
- GUI.Box(new Rect(404, 480, 370, 60), "");
- //QUEST BUTTONS TODO: REPLACE
- if( GUI.Button(new Rect(170,160,150,20),""+TestCollectQuest01.QuestName+"", "Label" ) ) {
- if (PlayerVARStore.OnQuest == 0){
- selectedquest = "TestCollectQuest01";
- selectedquestQuestText = TestCollectQuest01.QuestText;
- selectedquestQuestRewardExp = TestCollectQuest01.QuestRewardexp;
- selectedquestQuestRewardMoney = TestCollectQuest01.QuestRewardMoney;
- selectedquestQuestReqLVL = TestCollectQuest01.QuestRequirementLVL;
- selectedquestFullQuestName = TestCollectQuest01.QuestName;
- selectedquestQuestLocation = TestCollectQuest01.QuestLocation;
- selectedquestStoryQuest = TestCollectQuest01.StoryQuest;
- selectedquestQuestKillMob1 = TestCollectQuest01.QuestKillMob1;
- selectedquestQuestCollectName = TestCollectQuest01.QuestCollectName;
- selectedquestCollectAmount = TestCollectQuest01.CollectAmount;
- selectedQuestType = TestCollectQuest01.QuestType;
- selectedQuestTurninRequired = TestCollectQuest01.QuestTurninRequired;
- }
- }
- if( GUI.Button(new Rect(170,175,150,20),""+TestKillQuest01.QuestName+"", "Label" ) ) {
- if (PlayerVARStore.OnQuest == 0){
- selectedquest = "TestKillQuest01";
- selectedquestQuestText = TestKillQuest01.QuestText;
- selectedquestQuestRewardExp = TestKillQuest01.QuestRewardexp;
- selectedquestQuestRewardMoney = TestKillQuest01.QuestRewardMoney;
- selectedquestQuestReqLVL = TestKillQuest01.QuestRequirementLVL;
- selectedquestFullQuestName = TestKillQuest01.QuestName;
- selectedquestQuestLocation = TestKillQuest01.QuestLocation;
- selectedquestStoryQuest = TestKillQuest01.StoryQuest;
- selectedquestQuestKillMob1 = TestKillQuest01.QuestKillMob1;
- selectedQuestKillAmount = TestKillQuest01.KillAmount;
- selectedQuestType = TestKillQuest01.QuestType;
- selectedQuestTurninRequired = TestKillQuest01.QuestTurninRequired;
- }
- }
- if( GUI.Button(new Rect(170,190,150,20),""+TestStoryQuest01.QuestName+"", "Label" ) ) {
- if (PlayerVARStore.OnQuest == 0){
- selectedquest = "TestStoryQuest01";
- selectedquestQuestText = TestStoryQuest01.QuestText;
- selectedquestQuestRewardExp = TestStoryQuest01.QuestRewardexp;
- selectedquestQuestRewardMoney = TestStoryQuest01.QuestRewardMoney;
- selectedquestQuestReqLVL = TestStoryQuest01.QuestRequirementLVL;
- selectedquestFullQuestName = TestStoryQuest01.QuestName;
- selectedquestQuestLocation = TestStoryQuest01.QuestLocation;
- selectedquestStoryQuest = TestStoryQuest01.StoryQuest;
- selectedQuestType = TestStoryQuest01.QuestType;
- selectedQuestTurninRequired = TestStoryQuest01.QuestTurninRequired;
- selectedQuestRewardItem = TestStoryQuest01.QuestRewardItem;
- selectedQuestRewardAmountItem1 = TestStoryQuest01.QuestRewardAmountItem1;
- selectedQuestRewardItem2 = TestStoryQuest01.QuestRewardItem2;
- selectedQuestRewardAmountItem2 = TestStoryQuest01.QuestRewardAmountItem2;
- }
- }
- if (selectedquest != "None") {
- GUI.Label ( new Rect(450, 280, 300, 200), "" +selectedquestQuestText+"");
- GUI.Label ( new Rect(450, 250, 300, 200), "Mission level: " +selectedquestQuestReqLVL+"");
- if (PlayerVARStore.curLevel >= selectedquestQuestReqLVL) {
- if (GUI.Button (new Rect (500,400,170,30), "Accept Mission")) {
- AudioSource.PlayClipAtPoint (MenuClickSound, transform.position);
- PlayerVARStore.QuestLocation = selectedquestQuestLocation;
- PlayerVARStore.ActiveQuest = selectedquest;
- PlayerVARStore.QuestKillMob1 = selectedquestQuestKillMob1;
- PlayerVARStore.StoryQuest = selectedquestStoryQuest;
- PlayerVARStore.QuestTurninRequired = selectedQuestTurninRequired;
- PlayerVARStore.QuestType = selectedQuestType;
- PlayerVARStore.OnQuest = 1;
- if (selectedQuestType == "Collect") {
- PlayerVARStore.QuestCollectName = selectedquestQuestCollectName;
- PlayerVARStore.QuestCollectAmount = selectedquestCollectAmount;
- }
- if (selectedQuestType == "Kill") {
- PlayerVARStore.QuestKillAmount = selectedQuestKillAmount;
- }
- MessageDisplayerg.DisplayMessage("" +PlayerVARStore.LocalName+ " has taken the mission - "+selectedquestFullQuestName+"");
- selectedquest = "None";
- }
- } else {
- if (GUI.Button (new Rect (500,400,170,30), "Your level is too low.")) {
- }
- }
- if (selectedquestQuestRewardMoney != 0) {
- GUI.Label(new Rect(425, 485, money.width+5, money.height+5), money);
- GUI.Label ( new Rect(430, 520, 300, 200), ""+selectedquestQuestRewardMoney+"");
- }
- if (selectedquestQuestRewardExp != 0) {
- GUI.Label(new Rect(470, 485, exp.width+5, exp.height+5), exp);
- GUI.Label ( new Rect(477, 520, 300, 200), ""+selectedquestQuestRewardExp+"");
- }
- if (selectedQuestRewardItem == "HP Potion") {
- GUI.Label(new Rect(510, 485, healthpotion.width+5, healthpotion.height+5), healthpotion);
- GUI.Label ( new Rect(520, 520, 300, 200), ""+selectedQuestRewardAmountItem1+"");
- }
- if (selectedQuestRewardItem2 == "Energy Potion") {
- GUI.Label(new Rect(550, 485, energypotion.width+5, energypotion.height+5), energypotion);
- GUI.Label ( new Rect(560, 520, 300, 200), ""+selectedQuestRewardAmountItem2+"");
- }
- } else {
- if (PlayerVARStore.ActiveQuest == "None") {
- hidequitmission = 0;
- GUI.Label ( new Rect(450, 280, 300, 30), "NO ACTIVE MISSION");
- GUI.Label ( new Rect(450, 300, 300, 30), "Select a mission from the left.");
- }
- else
- {
- if (PlayerVARStore.QuestType == "Collect") {
- if (PlayerVARStore.QuestCollectAmount == PlayerVARStore.QuestAmountCollected) {
- GUI.Label ( new Rect(450, 230, 300, 30), "Mission Complete!: " + PlayerVARStore.ActiveQuest + "");
- GUI.Label ( new Rect(450, 250, 300, 30), "You can now turn this in:");
- } else {
- GUI.Label ( new Rect(450, 270, 300, 30), "Active Mission: " + PlayerVARStore.ActiveQuest + "");
- GUI.Label ( new Rect(450, 290, 300, 30), "You may not have multiple active missions.");
- GUI.Label ( new Rect(450, 310, 300, 35), "Abandoning will count as a failure, But you can retake the mission.");
- }
- } else {
- if (PlayerVARStore.QuestType == "Kill") {
- if (PlayerVARStore.QuestKillAmount == PlayerVARStore.QuestAmountKilled) {
- GUI.Label ( new Rect(450, 230, 300, 30), "Mission Complete!: " + PlayerVARStore.ActiveQuest + "");
- GUI.Label ( new Rect(450, 250, 300, 30), "You can now turn this in:");
- } else {
- GUI.Label ( new Rect(450, 270, 300, 30), "Active Mission: " + PlayerVARStore.ActiveQuest + "");
- GUI.Label ( new Rect(450, 290, 300, 30), "You may not have multiple active missions.");
- GUI.Label ( new Rect(450, 310, 300, 35), "Abandoning will count as a failure, But you can retake the mission.");
- }
- }
- }
- if (PlayerVARStore.QuestType == "Collect") {
- if (PlayerVARStore.QuestCollectAmount == PlayerVARStore.QuestAmountCollected) {
- if (PlayerVARStore.QuestTurninRequired == 0) {
- GUI.Label ( new Rect(450, 390, 300, 35), "THIS SHOULDN'T HAVE HAPPENED! AUTO TURN IN.");
- } else {
- if (selectedquestQuestRewardMoney != 0) {
- GUI.Label(new Rect(425, 485, money.width+5, money.height+5), money);
- GUI.Label ( new Rect(430, 520, 300, 200), ""+selectedquestQuestRewardMoney+"");
- }
- if (selectedquestQuestRewardExp != 0) {
- GUI.Label(new Rect(470, 485, exp.width+5, exp.height+5), exp);
- GUI.Label ( new Rect(477, 520, 300, 200), ""+selectedquestQuestRewardExp+"");
- }
- if (selectedQuestRewardItem == "HP Potion") {
- GUI.Label(new Rect(510, 485, healthpotion.width+5, healthpotion.height+5), healthpotion);
- GUI.Label ( new Rect(520, 520, 300, 200), ""+selectedQuestRewardAmountItem1+"");
- }
- if (selectedQuestRewardItem2 == "Energy Potion") {
- GUI.Label(new Rect(550, 485, energypotion.width+5, energypotion.height+5), energypotion);
- GUI.Label ( new Rect(560, 520, 300, 200), ""+selectedQuestRewardAmountItem2+"");
- }
- GUI.Label (new Rect(450,300,200,30), ""+selectedquestQuestText+"");
- hidequitmission = 1;
- if (GUI.Button (new Rect (450, 360, 200, 30), "Turn in "+PlayerVARStore.ActiveQuest+"")) {
- if (selectedquestQuestRewardMoney != 0) {
- PlayerVARStore.Money += selectedquestQuestRewardMoney;
- }
- if (selectedquestQuestRewardExp != 0) {
- PlayerEXP ge = (PlayerEXP)target.GetComponent("PlayerEXP");
- ge.AdjustCurrentEXP(selectedquestQuestRewardExp);
- }
- MessageDisplayerg.DisplayMessage("" +PlayerVARStore.LocalName+ " has completed the mission - "+selectedquestFullQuestName+"");
- PlayerVARStore.ActiveQuest = "None";
- selectedquest = "None";
- selectedquestQuestText = "None";
- selectedquestQuestRewardExp = 0;
- selectedquestQuestRewardMoney = 0;
- selectedquestQuestReqLVL = 0;
- selectedquestFullQuestName = "";
- selectedquestQuestLocation = "";
- PlayerVARStore.QuestsCompleted += 1;
- selectedquestStoryQuest = 0;
- selectedquestQuestKillMob1 = "";
- selectedquestQuestCollectName = "";
- selectedquestCollectAmount = 0;
- selectedQuestKillAmount = 0;
- selectedQuestType = "";
- selectedQuestTurninRequired = 0;
- PlayerVARStore.OnQuest = 0;
- PlayerVARStore.QuestType = "";
- PlayerVARStore.QuestLocation = "";
- PlayerVARStore.QuestKillMob1 = "";
- PlayerVARStore.QuestCollectAmount = 0;
- PlayerVARStore.QuestKillAmount = 0;
- PlayerVARStore.QuestAmountKilled = 0;
- PlayerVARStore.QuestAmountCollected = 0;
- PlayerVARStore.QuestCollectName = "";
- PlayerVARStore.StoryQuest = 0;
- PlayerVARStore.QuestTurninRequired = 0;
- } else {
- if (PlayerVARStore.QuestTurninRequired == 0) {
- GUI.Label ( new Rect(450, 390, 300, 35), "This mission will automatically turn in when completed.");
- } else {
- GUI.Label ( new Rect(450, 390, 300, 35), "This mission needs to be turned in.");
- }
- }
- }
- }
- }
- if (PlayerVARStore.QuestType == "Kill") {
- if (PlayerVARStore.QuestKillAmount == PlayerVARStore.QuestAmountKilled) {
- if (PlayerVARStore.QuestTurninRequired == 0) {
- GUI.Label ( new Rect(450, 390, 300, 35), "THIS SHOULDN'T HAVE HAPPENED! AUTO TURN IN.");
- } else {
- if (selectedquestQuestRewardMoney != 0) {
- GUI.Label(new Rect(425, 485, money.width+5, money.height+5), money);
- GUI.Label ( new Rect(430, 520, 300, 200), ""+selectedquestQuestRewardMoney+"");
- }
- if (selectedquestQuestRewardExp != 0) {
- GUI.Label(new Rect(470, 485, exp.width+5, exp.height+5), exp);
- GUI.Label ( new Rect(477, 520, 300, 200), ""+selectedquestQuestRewardExp+"");
- }
- if (selectedQuestRewardItem == "HP Potion") {
- GUI.Label(new Rect(510, 485, healthpotion.width+5, healthpotion.height+5), healthpotion);
- GUI.Label ( new Rect(520, 520, 300, 200), ""+selectedQuestRewardAmountItem1+"");
- }
- if (selectedQuestRewardItem2 == "Energy Potion") {
- GUI.Label(new Rect(550, 485, energypotion.width+5, energypotion.height+5), energypotion);
- GUI.Label ( new Rect(560, 520, 300, 200), ""+selectedQuestRewardAmountItem2+"");
- }
- GUI.Label (new Rect(450, 300,200,30), ""+selectedquestQuestText+"");
- hidequitmission = 1;
- if (GUI.Button (new Rect (450, 360, 200, 30), "Turn in "+PlayerVARStore.ActiveQuest+"")) {
- if (selectedquestQuestRewardMoney != 0) {
- PlayerVARStore.Money += selectedquestQuestRewardMoney;
- }
- if (selectedquestQuestRewardExp != 0) {
- PlayerEXP ge = (PlayerEXP)target.GetComponent("PlayerEXP");
- ge.AdjustCurrentEXP(selectedquestQuestRewardExp);
- }
- PlayerVARStore.ActiveQuest = "None";
- selectedquest = "None";
- selectedquestQuestText = "None";
- selectedquestQuestRewardExp = 0;
- selectedquestQuestRewardMoney = 0;
- selectedquestQuestReqLVL = 0;
- selectedquestFullQuestName = "";
- selectedquestQuestLocation = "";
- PlayerVARStore.QuestsCompleted += 1;
- selectedquestStoryQuest = 0;
- selectedquestQuestKillMob1 = "";
- selectedquestQuestCollectName = "";
- selectedquestCollectAmount = 0;
- selectedQuestKillAmount = 0;
- selectedQuestType = "";
- selectedQuestTurninRequired = 0;
- PlayerVARStore.OnQuest = 0;
- PlayerVARStore.QuestType = "";
- PlayerVARStore.QuestLocation = "";
- PlayerVARStore.QuestKillMob1 = "";
- PlayerVARStore.QuestCollectAmount = 0;
- PlayerVARStore.QuestKillAmount = 0;
- PlayerVARStore.QuestAmountKilled = 0;
- PlayerVARStore.QuestAmountCollected = 0;
- PlayerVARStore.QuestCollectName = "";
- PlayerVARStore.StoryQuest = 0;
- PlayerVARStore.QuestTurninRequired = 0;
- } else {
- if (PlayerVARStore.QuestTurninRequired == 0) {
- GUI.Label ( new Rect(450, 390, 300, 35), "This mission will automatically turn in when completed.");
- } else {
- GUI.Label ( new Rect(450, 390, 300, 35), "This mission needs to be turned in.");
- }
- }
- }
- }
- }
- if (hidequitmission == 0) {
- if (GUI.Button (new Rect (450, 360, 170, 30), "End Current Mission")) {
- AudioSource.PlayClipAtPoint (MenuClickSound, transform.position);
- MessageDisplayerg.DisplayMessage("" +PlayerVARStore.LocalName+ " has ended the mission - "+selectedquestFullQuestName+"");
- PlayerVARStore.ActiveQuest = "None";
- selectedquest = "None";
- selectedquestQuestText = "None";
- selectedquestQuestRewardExp = 0;
- selectedquestQuestRewardMoney = 0;
- selectedquestQuestReqLVL = 0;
- selectedquestFullQuestName = "";
- selectedquestQuestLocation = "";
- PlayerVARStore.QuestsFailed += 1;
- selectedquestStoryQuest = 0;
- selectedquestQuestKillMob1 = "";
- selectedquestQuestCollectName = "";
- selectedquestCollectAmount = 0;
- selectedQuestKillAmount = 0;
- selectedQuestType = "";
- selectedQuestTurninRequired = 0;
- PlayerVARStore.OnQuest = 0;
- PlayerVARStore.QuestType = "";
- PlayerVARStore.QuestLocation = "";
- PlayerVARStore.QuestKillMob1 = "";
- PlayerVARStore.QuestCollectAmount = 0;
- PlayerVARStore.QuestKillAmount = 0;
- PlayerVARStore.QuestAmountKilled = 0;
- PlayerVARStore.QuestAmountCollected = 0;
- PlayerVARStore.QuestCollectName = "";
- PlayerVARStore.StoryQuest = 0;
- PlayerVARStore.QuestTurninRequired = 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment