[TUT] How to make a Quest Log

Hey people im going to show you how to make a quest log! With 2 pages you can easily add more pages!

Ok make an Empty Game object call it QuestLogUI
create a new JavaScript

Put this in the code!

static var scorpionQuestStatus = "Not Started";
static var messengerBoyQuestStatus = "Not Started";
static var messageDelivered = false;
static var scorpionKills : int = 0;
static var questLogOpened : boolean = false;
static var questClicked : boolean = false;
static var questLogPage = "Page 1";
var qHeight : float = 90;
var qWidth : float = 100;
static var qYpos : float = 10;
static var qXpos : float = 10;




function OnGUI(){
//Quest Log Layout

if(questLogOpened == true){

//Window
GUI.Box(Rect(qXpos,qYpos,qWidth+300,qHeight+410), "");
GUI.Box(Rect(qXpos,qYpos,qWidth+300,60),"");
GUI.Box(Rect(qXpos,qYpos,qWidth+300,30),"Quest Log");
GUI.Label(Rect(qXpos+5,qYpos+70,qWidth,20),"Quests");
GUI.Label(Rect(qXpos+361,qYpos+70,qWidth,20),"Status");
GUI.Label(Rect(qXpos+185,45,qWidth,20),questLogPage);

//Close Button
if(GUI.Button(Rect(385,15,20,20),"X")){
questLogOpened = false;}

//Pages 1 till 2
if(GUI.Button(Rect(qXpos+5,qYpos+35,60,20),"Previous")){
if(questLogPage == "Page 1"){

}
if(questLogPage == "Page 2"){
questLogPage = "Page 1";
}
}
if(GUI.Button(Rect(qXpos+335,qYpos+35,60,20),"Next")){
if(questLogPage == "Page 2"){

}
if(questLogPage == "Page 1"){
questLogPage = "Page 2";
}
}

}

//Quest Log Open Button

if(GUI.Button(Rect(5,700,70,40),"Quest Log")){
questLogOpened = true;
}

//----------------QUESTS----------------
if(questClicked == true){

//Window
GUI.Box(Rect(qXpos,qYpos,qWidth+300,qHeight+410), "");
GUI.Box(Rect(qXpos,qYpos,qWidth+300,60),"");
GUI.Box(Rect(qXpos,qYpos,qWidth+300,30),"Quest Information");

//Close Button
if(GUI.Button(Rect(385,15,20,20),"X")){
questClicked = false;
questLogOpened = true;
}

}

if(questLogPage == "Page 1"){
//Scorpion Slayer
if(questLogOpened == true){
if(GUI.Button(Rect(qXpos+2.5,qYpos+90,395,20),"Scorpion Slayer                                                                             " +scorpionQuestStatus)){
questLogOpened = false;
questClicked = true;
scorpionSlayerLog = true;
}
if(GUI.Button(Rect(qXpos+2.5,qYpos+112,395,20),"Messenger Boy                                                                              " +messengerBoyQuestStatus)){
questLogOpened = false;
questClicked = true;
messengerBoyLog = true;
}


}

}
if(scorpionSlayerLog == true){
//You can add your own text here you can change the name of the quests but you have to edit all the vars too then! Enjoy the quest log!

}
}

Or you can download it!

there you have it a quest log

280511–10085–$quest_log_110.js (2.3 KB)

haha this is cool :smile: i had somthing similar but it was a quest tracker :smile:

nice but it could be better with a Foreach quest instead of saying Page-1 page-2 and so on since each statement if is actually using more and more resources aka if u have 100 if states vs 10 if and foreach that would cause less problems

5 Year old thread…