This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
code and instructions fixed
This script will allow the player to press a button (the * on the numpad by default) to display a small window at the bottom of the screen displaying the present goal, the goal stats and an hint (optional). This window is a pop-up, and the player can continue playing while its open - The player can press the Goal button again to hide it.
The developer of the game have some basic tool to mainpulate the goal he set in the game, those tool will be listed below the following script, in the instruction manual.
First of all, this script requieres Cybersam's Keyboard Input Script V4, that you can take right here.
STEP 1: Insert the Keyboard Input Script:
Copy the following script just above MAIN and call it KB Input
STEP 2: Insert the Mini Objective Script
Copy the following script just above the KBInput Script and call it Goal
Code:
#=========================================
# Mini Objective Script - R1
# Script created by Dubealex
#
# June 28, 2005
#=========================================
Here we make a list of every objective the player will have during the game.
This is a MINI objective system, and it's made to be simple and fast.
We need the following parameter per objectives:
> Progress
> Max
> Objective Title
> Hint (optional)
Each goal will ba accesed individually, one at a time, during the game. When the player
start a new objective (i.e: a new puzzle), the parameter of this objective are used in the
window; if he start another one, it will change for that one. In other word, the Mini
Objective System will display only the active quest at hand. This is why I called it
MINI script.
def initialize(max, title, hint)
@max=max
@progress=progress=0
@title= title
@hint= hint
end
def completed?
if @progress>=@max
return true
else
return false
end
end
end
#------------------------------------------------------------------------------------
#GOAL_WINDOW
#DO not edit the non-commented line, unless you know how to script.
class Goal_Window < Window_Base
def initialize
super(-5, 380, 650, 105) #The position and size of the window (POS.X, POS.Y, WIDTH, HEIGHT)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("001-Blue01") #The WindowSkin Filename
self.contents.font.name = "Tahoma" #The font to be used
self.contents.font.size = 24 #The size of the text
self.opacity=180 #Opacity of the Goal Window (255=Opaque)
end
self.contents.font.color = text_color(6) #Color of the TITLE of the goal
self.contents.draw_text(0, 0, 640, 32, title.to_s)
self.contents.font.color = text_color(4) #Color of the STATS for that goal
self.contents.draw_text(0, 22, 640, 32, progress.to_s + " /" + max.to_s)
if $goal[id].completed? == false
self.contents.font.color = text_color(8) #Color of the HINT for the goal
self.contents.draw_text(0, 44, 640, 32, hint.to_s)
else
self.contents.font.color = text_color(3) #Objective COMPLETED color
self.contents.draw_text(0, 44, 640, 32, "Objective Completed !")
end
else
self.contents.font.color = text_color(2) #NO OBJECTIVE color
self.contents.draw_text(0, 0, 640, 32, "No Objective")
end
end
end
#ADDON
if @show_goal_window==true
@goal_window.update
if Kboard.keyboard($R_Key_MULTIPLY) #KEY CONDITION
@show_goal_window=false
@goal_window.visible=false
end
end
#Check for the * button, the Mini Goal button
if $game_switches[1]==true #switch ID= Goal System ON/OFF
if Kboard.keyboard($R_Key_MULTIPLY) #KEY CONDITION
@show_goal_window=true
@goal_window.visible=true
end
end
#END ADDON
- Remember to change the switch ID in between the brackets by the switch you wanna use to activate/de-activate the goal system !
(D) STILL in def main, below Graphics.freeze, you must add the following code:
Code:
#ADDON
@goal_window.dispose
#END ADDON
STEP 4: Insert the ADD-ON in Scene_Title
(A) In command_new_game, just below def command_new_game, you must paste the following code:
Code:
#ADDON
$goal=[]
Goal.new #Load each objective (quest) for the entire game.
#END ADDON
STEP 5: Insert the ADD-ON in Scene_Load
(A) find the line $game_player = Marshal.load(file) ... You must paste the code shown below AFTER the last Marshal.load(file) line. By default, $game_player is the last one:
Code:
#ADDON
$goal =Marshal.load(file)
#END ADDON
STEP 6: Insert the ADD-ON in Scene_Save
(A) find the line Marshal.dump($game_player, file) ... You must paste the code shown below AFTER the last Marshal.dump line. By default, $game_player is the last one:
Code:
#ADDON
Marshal.dump($goal, file)
#END ADDON
Instruction Manual
(1) Goal Attribute Index
(2) How to activate a specific goal:
To activate a certain goal, you can simple use the following Call Script:
Code:
$goal[0]=NEW ID
sample: $goal[0]=1
$goal[0] defines which goal is activated. If you want to set no goal as active, you can simple set $goal[0] equal to 0, and the window will show the text "NO OBJECTIVE".
(3) How to maipulate a specific goal:
The way the Goal system works is that the variable $goal[ID] contains all the data you need to access the stats of a certain goal. You can simply replace ID by the ID of the goal you created. You can access those value within Call Script Event.
The way I made the system work is simple: I will describe it with an example goal.
Let's say you have 23 Treasures Chest to get before a gate can open; this is known as the objective "Treasure Chest". The Goal system have the following basic values:
- A unique ID
- A total number of "steps" in the goal
- The progress in those "steps" made by the player
- A title for the goal
- A hint for that goal (optional)
So, in the page that make the treasure chest open, you would add the following Call Script:
Code:
$goal[ID].progress+=1
$goal[ID].progres refer to the progress the player made on that objective. It will always stay in memory, even you activate another goal meanwhile.
You can use $goal[1].progress-=1 to decrease the progress. Or use two equal signs (==) to set the progress to a pre-defined value.
(3) Some tool you have:
You can use the following command to check if a certain goal is completed or not. Each time you run that command, it will send back the value FALSE if it is not completed, and TRUE if it is. (it's a boolean value)
Code:
$goal[id].completed?
So, you can use this in a conditional branch, using the last page (4th).
For other things, you can experiment with the script, and do whatever changes you feel like. This script was made by me for my game, and it's customized for it, and I won't really add-in more features than that -- I wanted it to be simple.