Guest Access
EVENTALIST
EVENTALIST
EVENTALIST
profile
This is a organized mission menu I had made a while back but never published on this site for some reason, (must've forgot to post it).
soon
Demo Link: Download V 1.0 OLD!
Config Script:
PART 2 INCLUDED IN POST 2 BELLOW!
mr_wiggles
profile
Mission Menu
- Author: Mr_Wiggles | Version: 2.0 | Date: 11/25/15
Description:
This is a organized mission menu I had made a while back but never published on this site for some reason, (must've forgot to post it).
Features:
- Mission Arrow that points the way to next goal on map,
- Tidy menu for navigating mission list.
- On map display of real time objective status.
Screen Shots:
soon
Version History:
- Version 2.0 (11/25/15) - Initial Post
Script:
Demo Link: Download V 1.0 OLD!
- Code:
#==============================================================================
# ** Wiggles Mission Config **
#------------------------------------------------------------------------------
# by Mr_Wiggles
# Version 2.0
# 11/25/15
#==============================================================================
# Mission Menu Instructions:
# --------------------------
# NEW: Short hand event script commands!
#
# (1) - miss_complete?(id)
# (2) - miss_failed?(id)
# (3) - miss_known?(id)
# (4) - obstat?(id, objective)
# (5) - new_mission(id)
# (6) - set_obstat(id, objective, status)
#------------------------------------------------------------------------------
# You can check the progress of missions by using:
# $game_missions.completed?(id) - (1)
# $game_missions.failed?(id) - (2)
# $game_missions.known?(id) - (3)
# $game_missions.obj_status(id, ob_id) - (4)
# Inside of a script call in an event or conditional branch.
#
# (1) check if mission is completed
#
# (2) check if mission was failed
#
# (3) check if player knows about mission
#
# (4) check status of objective id for mission, returns:
# stat = (0= not known, 1= known, 2= completed, 3= failed)
#
#------------------------------------------------------------------------------
# You can edit the mission's status by using:
# $game_missions.know_mission(id, value = true) - (5)
# $game_missions.change_obstat(id, ob_id, stat) - (6)
# Inside of a script call in an event or conditional branch.
#
# (5) id = mission id, value = boolean (true or false) defualt is true
#
# (6) id = mission id, ob_id = objectives id,
# stat = (0= not known, 1= known, 2= completed, 3= failed)
#------------------------------------------------------------------------------
# Use $game_missions.set_active(id) manually set the active mission, player set.
# Call the mission menu by useing $scene = Scene_Missions.new
#
#==============================================================================
#
# Arrow Pointer Instructions:
# -------------------------
# To make the arrow point to a loctaion use an event that has:
# "Missions [id]" in a comment within the top 5 lines.
# the top five because most scripts that read event comments read
# the first one. This was done to make the script compatible.
#
# [id] for Missions is all the ids that point to that event.This is good for
# map change events for pointers on other maps.
#
# If an event is a map transfer and you want to point to missions on that
# new map use ["all",excluding_ids]
# ex. "Missions ["all",3,4]" will point to for all other missions that
# are not 3 or 4.
#
# To make the arrow point to an object if a variable is at a certain value
# use "ifvar[id]=value" after "Missions [id]".
# ex. "Missions [1,3] ifvar[1]=10"
#
# To make the arrow point to an obect if the vairable is NOT the matching
# value use "ifvar[id]!=value" instead.
#
# To make the arrow point to an object if a switch is at a certain value
# use "ifswi[id]=value" after "Missions [id]".
# ex. "Missions [1,3] ifswi[1]=true"
#
# To make the arrow point to a specific id set the vraiable with the id
# of the "POINTVAR" to value of the destenation id. To stop pointing set
# the variable to zero.
#
# NOTE: It is important that you do not have any spaces but those between
# "Missions" and "[id]" or any arguements like "ifvar[1]=5" or "ifswi[1]=true".
# ex. "Missions ["all",1,2] ifswi[1]=false"
#
# NOTE: The mission comment tags will only work if the event page they are on
# is active. (say event page 2 needs switch[id] true, if there is a tag
# on that page it will only work if switch[id] is true.)
#
# NOTE: You can use the list as an arguement branch as well.
# ex. (event command list)
# Comment: "Missions ["all",6,10] ifswi[100]=true"
# Comment: "Missions [1,3] ifvar[1]=13"
# Comment: "Missions [5,6]"
# If the first comment arguments are not met it will move to the second
# line, and if the second are not met it will move down to the third... etc.
#==============================================================================
#==============================================================================
# * CONFIG
#==============================================================================
module Wig_Mission
#------------------------------------------------------------
# * Mission Marker
#------------------------------------------------------------
# This is like a bullet point for the objectives.
# ○ ● - DOTS □ ■ - SQUARES √ - CHECK MARK
INCO_MAR = "○ " # not yet completed
DONE_MAR = "● " # completed
FAIL_MAR = "X " # failed
HIDE_COMP= true # hide missions in journal list if completed
#------------------------------------------------------------
# * Mission Arrow
#------------------------------------------------------------
USE_ARROW = true # Make sure to have Mission Arrow 2.4 script.
ACT_VAR = 42 # Variable that contains active mission id.
#------------------------------------------------------------
# * Mission HUD
#------------------------------------------------------------
USE_HUD = true
# Loctaion of window. (1-Top R, 2-Lower R, 3-Top L, 4-Lower L, 5-Center)
WIN_LOC = 1
# Time that window is shown for. (in frames)
WIN_TIME = WaitTime.fsec * 5
# Wait untill there is no message being displayed.
MSG_WAIT = true
#------------------------------------------------------------------------------
# Mission Arrow Config
#------------------------------------------------------------------------------
# Show debugging information.
DEBUG = false
#------------------------------------------------------------------------------
# Location of the arrow sprite. [x, y] (320, 240 = Center Screen)
ARROW_LOC = [0, 0]
#------------------------------------------------------------------------------
# Refresh rate (lower number = faster refresh but more lag.)
REFRESH = 10
#------------------------------------------------------------------------------
# Name of the Picture file for the arrow.
POINT_IMG = "Mission Arrow"
#------------------------------------------------------------------------------
# Arrow Opacity.
AROPACIT = 180
#==============================================================================
#==============================================================================
#------------------------------------------------------------
# * Mission Name =======================================================
#------------------------------------------------------------
# id => "name"
NAMES = {
1 => "Get into the Castle",
2 => "Find the Library",
3 => "Gathering Intel",
4 => "Find the Crystal"
}
def self.name(id)
if id == 0 ; show_error(0); return; elsif NAMES[id].nil?
show_error(1, id); return; end; return NAMES[id]
end
#------------------------------------------------------------
# * Mission Description ================================================
#------------------------------------------------------------
def self.descrip(id)
case id
when 1
text = "You don't remember much, but least you found an old friend." +
"Guards are after your capture and you haven't a clue.."
when 2
text = "The king has died from a new evil known as Fousus, he has" +
" asked you with his dyeing breath to take this key to the" +
" Library located in the Dungeon of the Castle."
when 3
text = "Look around and try to find out what Fousus has been up to."
when 4
text = "You made it into Fousus' Tower, now find the first Crystal."
end
# Error checking.
return text unless text.nil?; show_error(2, id)
end
#------------------------------------------------------------
# * Mission Known ======================================================
#------------------------------------------------------------
# Check to see if the mission is known. (bool value: "true or false")
def self.known(id)
case id
when 1 then return true
else # defualt return
return false
end
end
#------------------------------------------------------------
# * Mission Objectives =================================================
#------------------------------------------------------------
def self.objectives(id)
case id
when 1
return ["Find a Way in", "Shut off the Pipes"]
when 2
return ["Find The Library"]
when 3
return ["Check Asguard", "Head To Mt. Helcora", "Climb the Mountian"]
when 4
return ["Find the Crystal", "Turn Off the Gas"]
end; show_error(3, id); return nil
end
#------------------------------------------------------------
# * Mission Objective Status ===========================================
#------------------------------------------------------------
# This alows you to set the status of the individual objectives.
# (0= not known, 1= known, 2= completed, 3= failed)
def self.objec_status(id)
info = []
case id
when 1 then info = [1, 0]
when 2 then info = [1]
when 3 then info = [1, 0, 0]
when 4 then info = [1, 0]
end
return info if info.size == self.objectives(id).size; show_error(4, id)
end
#------------------------------------------------------------
# * Mission Character =================================================
#------------------------------------------------------------
# Displays a character graphic for the mission.
# [Type, Character set name, frame = 0, hue = 0]. Use nil for no character.
def self.picture(id)
pic = []
case id
when 1 then pic = ["C", "196-Support04"]
when 2 then pic = ["I", "note"]
when 3 then pic = ["C", "182-Rock01"]
when 4 then pic = ["C", "Crystals", 0]
end
# Error checking. DON'T EDIT
return pic if pic.nil?
frame = pic[2].nil? ? 0 : pic[2]; hue = pic[3].nil? ? 0 : pic[3]
type, file = pic[0], pic[1]
if type == "C"; bitmap = RPG::Cache.character(file, hue) rescue nil
elsif type == "I"; bitmap = RPG::Cache.icon(file) rescue nil
end; show_error(5, id, file) if bitmap.nil?; return [type, bitmap, frame]
end
#==============================================================================
#==============================================================================
#------------------------------------------------------------
# * Show Error
#------------------------------------------------------------
def self.show_error(code, id = 0, extra = nil)
if code == 0
error = "There can not be a mission with the id of 0."
elsif code == 1
error = "No name found for mission #{id}."
elsif code == 2
error = "No description found for mission #{id}."
elsif code == 3
error = "No objectives found for mission #{id}."
elsif code == 4
error = "Objective size doesnt match Status size for mission #{id}."
elsif code == 5
error = "IMG Set #{extra} not found for mission #{id}."
elsif code == 6
error = "No prevous status for mission #{id}, objective #{extra}. \n" +
"Remember that objectives start counting at 0."
elsif code == 7
error = "No status for mission #{id}, objective #{extra}."
end
print("Wig Mission: #{error}"); $scene = nil if !SKIP_ERRORS
end
end
#==============================================================================
# * END CONFIG
#==============================================================================
PART 2 INCLUDED IN POST 2 BELLOW!
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
EVENTALIST
profile
mr_wiggles
profile
PART 2 of 2.
- Code:
#==============================================================================
# ** Wiggles Mission Menu **
#------------------------------------------------------------------------------
# by Mr_Wiggles
# Version 2.0
# 11/25/15
#==============================================================================
# Instructions:
# --------------------------
# There is nothing to edit here. To make edits to the missions do so in the
# Wiggles Mission Config script.
#
SKIP_ERRORS = true # for adding to save games.
#==============================================================================
# * Short Hand calling.
#==============================================================================
class Interpreter
def set_obstat(mission, objective, status)
$game_missions.change_obstat(mission, objective, status)
end
#------------------------------------------------------------
def obstat?(mission, objective)
return $game_missions.obj_status(mission, objective)
end
#------------------------------------------------------------
def new_mission(id)
$game_missions.know_mission(id)
end
#------------------------------------------------------------
def miss_complete?(id)
return $game_missions.completed?(id)
end
#------------------------------------------------------------
def miss_failed?(id)
return $game_missions.failed?(id)
end
#------------------------------------------------------------
def miss_known?(id)
$game_missions.known?(id)
end
#------------------------------------------------------------
def miss_complete(id)
$game_missions.complete_mission(id)
end
end
#==============================================================================
# * Game_Missions
#==============================================================================
class Game_Missions
attr_reader :num_mis
attr_accessor :active_id
#------------------------------------------------------------
# * Initialize
#------------------------------------------------------------
def initialize
@known = {}
@completed = {}
@obj_stats = {}
@active_id = 0
end
#------------------------------------------------------------
# * Completed?
#------------------------------------------------------------
def completed?(id)
obs = Wig_Mission.objectives(id)
for i in 0...obs.size
@obj_stats[id] = Wig_Mission.objec_status(id) if @obj_stats[id].nil?
complete = (@obj_stats[id][i] == 2)
break if !complete
end
return complete
end
#------------------------------------------------------------
# * Full list
#------------------------------------------------------------
def mission_total
return Wig_Mission::NAMES.size
end
#------------------------------------------------------------
# * Failed?
#------------------------------------------------------------
def failed?(id)
obs = Wig_Mission.objectives(id)
for i in 0...obs.size
@obj_stats[id] = Wig_Mission.objec_status(id) if @obj_stats[id].nil?
failed = (@obj_stats[id][i] == 3)
break if failed
end
return failed
end
#------------------------------------------------------------
# * Known?
#------------------------------------------------------------
def known?(id)
@known[id] = Wig_Mission.known(id) if @known[id].nil?
@obj_stats[id] = Wig_Mission.objec_status(id) if @obj_stats[id].nil?
return @known[id]
end
#------------------------------------------------------------
# * Know Mission
#------------------------------------------------------------
def know_mission(id, value = true)
@active_id = 0 if @active_id == id and !value
@known[id] = value
@obj_stats[id] = Wig_Mission.objec_status(id) #if @obj_stats[id].nil?
# show hud
return if $game_system.mission_hud.nil?
if value
$game_system.mission_hud.show("Quest: " + Wig_Mission.name(id), "Learned")
else
$game_system.mission_hud.show("Quest: " + Wig_Mission.name(id), "Forgoten")
end
end
#------------------------------------------------------------
# * Complete Mission
#------------------------------------------------------------
def complete_mission(id)
unless known?(id)
know_mission(id)
end
@obj_stats[id] = Wig_Mission.objec_status(id) if @obj_stats[id].nil?
if @obj_stats[id].nil?
show_error(6, id, 0); return
end
for stat in @obj_stats[id]
ob_id = @obj_stats[id].index(stat)
change_obstat(id, ob_id, 2)
end
end
#------------------------------------------------------------
# * Objective Status
#------------------------------------------------------------
def obj_status(id, ob_id)
@obj_stats[id] = Wig_Mission.objec_status(id) if @obj_stats[id].nil?
status = @obj_stats[id][ob_id]
return status unless status.nil?
#show_error(7, id, ob_id)
return 0
end
#------------------------------------------------------------
# * Change Objective Status
#------------------------------------------------------------
def change_obstat(id, ob_id, stat)
stat = 3 if stat > 3; stat = 0 if stat < 0
@obj_stats[id] = Wig_Mission.objec_status(id) if @obj_stats[id].nil?
@obj_stats[id][ob_id] = stat
if @obj_stats[id][ob_id].nil?
show_error(6, id, ob_id); return
end
#if (@active_id / 10).floor == id and (failed?(id) or completed?(id))
if @active_id == id and (failed?(id) or completed?(id))
set_active(0)
else
set_active(id) if @active_id == id
#set_active(id) if (@active_id / 10).floor == id
end
# show hud
return if $game_system.mission_hud.nil?
name = Wig_Mission.name(id)
if failed?(id)
$game_system.mission_hud.show("Quest: " + name, "Failed")
elsif completed?(id)
$game_system.mission_hud.show("Quest: " + name, "Completed")
else
ob = Wig_Mission.objectives(id); ob = ob[ob_id]
case stat
when 1
$game_system.mission_hud.show("Quest: " + name,
"New : " + ob)
when 2
$game_system.mission_hud.show("Quest: " + name,
ob + ": Completed")
when 3
$game_system.mission_hud.show("Quest: " + name,
ob + ": Failed")
end
end
end
#------------------------------------------------------------
# * Get Last Completed Objective
#------------------------------------------------------------
def last_obj(id)
obs = Wig_Mission.objectives(id)
ob_id = 0
for i in 0..obs.size - 1
next if obj_status(id, i) == 2
ob_id = i + 1
break
end
return ob_id
end
#------------------------------------------------------------
# * Set Active Mission
#------------------------------------------------------------
def set_active(id)
$game_variables[Wig_Mission::ACT_VAR] = 0
if id != 0 and (completed?(id) or failed?(id))
return false
end
#value = id * 10
#if id != 0
# value += last_obj(id)
#end
if Wig_Mission::USE_ARROW
$game_variables[Wig_Mission::ACT_VAR] = id #value
end
@active_id = id #value
# show hud
unless $game_system.mission_hud.nil? or id == 0 or @old_id == id
ob = Wig_Mission.objectives(id); ob = ob[last_obj(id) - 1]
$game_system.mission_hud.show("Quest: " + Wig_Mission.name(id),
Wig_Mission::INCO_MAR + ob)
end
@old_id = id if @old_id != id
return true
end
end
#==============================================================================
# * Scene_Title
#==============================================================================
class Scene_Title
$game_missions = Game_Missions.new
end
#==============================================================================
# * Scene_Save
#==============================================================================
class Scene_Save < Scene_File
alias :wig_miss_save :write_save_data
def write_save_data(file)
$game_system.dispose_windows
wig_miss_save(file)
Marshal.dump($game_missions, file)
end
end
#==============================================================================
# * Scene_Load
#==============================================================================
class Scene_Load < Scene_File
alias :wig_miss_load :read_save_data
def read_save_data(file)
wig_miss_load(file)
$game_missions = Marshal.load(file)
# show hud
id = $game_missions.active_id
unless $game_system.mission_hud.nil? or id == 0
ob = $game_missions.objectives(id)
ob = ob[$game_missions.last_obj(id) - 1]
$game_system.mission_hud.show("Quest: " + $game_missions.name(id),
Wig_Mission::INCO_MAR + ob)
end
end
end
#==============================================================================
# * Scene_Missions
#==============================================================================
class Scene_Missions
#------------------------------------------------------------
# * Main
#------------------------------------------------------------
def main
# create windows
@discrip_window = Mission_Desc_Window.new
@menu_window = Mission_Menu_Window.new
if $game_missions.active_id != 0
id = $game_missions.active_id
@menu_window.index = @menu_window.data.index(id)
end
# main loop
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
# dispose windows
@discrip_window.dispose
@menu_window.dispose
end
#------------------------------------------------------------
# * Update
#------------------------------------------------------------
def update
# update windows
@menu_window.update
@discrip_window.update(@menu_window.mission, @menu_window.mission_nums)
# update commands
if Input.trigger?(Input::C)
id = @menu_window.mission
#if ($game_missions.active_id / 10).floor == id
unless id.nil?
if $game_missions.active_id == id
$game_missions.set_active(0)
elsif !$game_missions.set_active(id)
$game_system.se_play($data_system.buzzer_se)
return
end
end
$game_system.se_play($data_system.decision_se)
@menu_window.refresh
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
end
#==============================================================================
# * Mission_Desc_Window
#==============================================================================
class Mission_Desc_Window < Window_Base
#------------------------------------------------------------
# * Initialize
#------------------------------------------------------------
def initialize
super(0, 0, 640, 320)
self.contents = Bitmap.new(width - 32, height - 32)
@old_id = 0
update
end
#------------------------------------------------------------
# * Refresh
#------------------------------------------------------------
def refresh(id, mission_nums)
self.contents.clear
# draw back ground
wmm_draw_box(280, 0, 320, 280, Color.new(40, 40, 40, 200))
return if id == 0
# draw name
name = Wig_Mission.name(id)
self.contents.draw_text(0, 0, 200, 32, "Name: #{name}")
# draw description
self.contents.font.size = 18
descrip = Wig_Mission.descrip(id)
format_string(290, 8, "#{descrip}", 265)
self.contents.font.size = 24
# draw objectives
objec = Wig_Mission.objectives(id)
for i in 0...objec.size
name = objec[i]
status = $game_missions.obj_status(id, i)
next if status == 0
case status
when 1
self.contents.font.color = normal_color
mark = Wig_Mission::INCO_MAR
when 2
self.contents.font.color = text_color(3)
mark = Wig_Mission::DONE_MAR
when 3
self.contents.font.color = knockout_color
mark = Wig_Mission::FAIL_MAR
end
self.contents.draw_text(0, 64 + (32 * i), 250, 32, "#{mark}#{name}")
end
self.contents.font.color = normal_color
# draw character
type, bit, frame = Wig_Mission.picture(id)
return if bit.nil?
bx, by = 0, 0
if type == "C"
bw, bh = bit.width / 4, bit.height / 4
bx = 0 + bw * (frame % 4)
by = 0 + bh * (frame / 4)
elsif type == "I"
bw, bh = bit.width / 2, bit.height / 2
end
x = 225 - (bw / 2); y = 272 - bh
wmm_draw_box(x - 4, y, bw + 8, bh + 8, Color.new(60, 60, 60, 180))
self.contents.blt(x, y + 4, bit, Rect.new(bx, by, bw, bh))
if mission_nums.size > 0
self.contents.font.size = 14
known, completed, failed = mission_nums
s = "Known: #{known} | Completed: #{completed}"
if failed > 0
s = s + " | Failed: #{failed}"
end
self.contents.draw_text(0, 276, 185, 16, "- #{s} -", 1)
end
end
#------------------------------------------------------------
# * Update
#------------------------------------------------------------
def update(id = 0, mission_nums = [])
super()
return if id == @old_id
@old_id = id
return if id.nil?
refresh(id, mission_nums)
end
end
#==============================================================================
# * Mission_Menu_Window
#==============================================================================
class Mission_Menu_Window < Window_Selectable
attr_reader :mission_nums
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 320, 640, 160)
@column_max = 2
@mission_nums = [0,0,0]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Get Mission
#--------------------------------------------------------------------------
def mission
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Get Data
#--------------------------------------------------------------------------
def data
return @data
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []; @mission_nums = [0, 0, 0]
# Add data
for i in 1..$game_missions.mission_total
unless $game_missions.completed?(i) and Wig_Mission::HIDE_COMP
if $game_missions.known?(i)
@data.push(i); @mission_nums[0] += 1
end
end
if $game_missions.completed?(i)
@mission_nums[1] += 1
elsif $game_missions.failed?(i)
@mission_nums[2] += 1
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
id = @data[index]
x = 320 * (index % @column_max) + 4
y = index / @column_max * 32
# blank rect
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
# name
name = Wig_Mission.name(id)
self.contents.font.color = text_color(3) if $game_missions.completed?(id)
self.contents.font.color = knockout_color if $game_missions.failed?(id)
aid = $game_missions.active_id
self.contents.font.color = crisis_color if id == aid
self.contents.draw_text(x, y, 320, 32, name)
self.contents.font.color = normal_color
end
end
#==============================================================================
# ** Game_System
#==============================================================================
class Game_System
attr_accessor :mission_hud
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
alias :misshud_up :update
def update
misshud_up
# infliction window
if Wig_Mission::USE_HUD
if $scene.is_a?(Scene_Map)
@mission_hud = Mission_HUD.new if @mission_hud.nil?
@wma_window = Window_MNArrow.new if @wma_window.nil?
@mission_hud.update
@wma_window.update
else
@mission_hud.dispose unless @mission_hud.nil?
@wma_window.dispose unless @wma_window.nil?
@mission_hud = nil
@wma_window = nil
end
end
end
#--------------------------------------------------------------------------
# * Dispose All windows
#--------------------------------------------------------------------------
def dispose_windows
@mission_hud.dispose unless @mission_hud.nil?
@wma_window.dispose unless @wma_window.nil?
@mission_hud = nil
@wma_window = nil
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
alias :mission_update :update
def update
$game_system.update
mission_update
end
end
#==============================================================================
# ** Mission_HUD
#==============================================================================
START_WIDTH = 164
class Mission_HUD < Window_Base
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, START_WIDTH, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 18
self.visible = false
self.opacity = 180
self.z = 99999
@display_time = 0
@need_show = []
end
#--------------------------------------------------------------------------
# * Show
#--------------------------------------------------------------------------
def show(text1, text2)
unless @need_show.include?([text1, text2])
@need_show.push([text1, text2])
end
end
#--------------------------------------------------------------------------
# * Set Text
#--------------------------------------------------------------------------
def set_text(text1, text2)
s1 = self.contents.text_size(text1).width + 20
s2 = self.contents.text_size(text2).width + 20
if s1 > START_WIDTH or s2 > START_WIDTH
self.width = s1 > s2 ? s1 : s2
self.width += 40
else
self.width = START_WIDTH
end
self.contents.dispose
self.contents = Bitmap.new(self.width - 32, self.height - 32)
self.contents.font.size = 18
# set window location
case Wig_Mission::WIN_LOC
when 1 # Top Right
self.x = 0; self.y = 0
when 2 # Lower Right
self.x = 0; self.y = 480 - height
when 3 # Top Left
self.x = 640 - width; self.y = 0
when 4 # Lower Left
self.x = 640 - width; self.y = 480 - height
when 5 # Center
self.x = 320 - (width / 2); self.y = 240 - (height / 2)
end
# draw text
self.contents.font.color = normal_color
@display_time = Wig_Mission::WIN_TIME + 20
self.contents.draw_text(0, 0, s1, 32, text1)
self.contents.draw_text(0, 28, s2, 32, text2)
self.visible = true
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
# close window
if self.visible
@display_time -= 1 if @display_time > 0
if @display_time < 20
self.width -= 4
elsif @display_time.zero?
self.visible = false
self.width = START_WIDTH
end
end
# if display array is empty
if @need_show.empty?
@display_wait = 8
return
end
# wait time to display effects
return if $game_temp.message_window_showing and Wig_Mission::MSG_WAIT
if @display_wait.zero?
text1, text2 = @need_show[0]
@need_show.delete_at(0)
@display_wait = Wig_Mission::WIN_TIME + 20
set_text(text1, text2)
end
@display_wait -= 1 if @display_wait > 0
end
end
#==============================================================================
# ** Window Base
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# * Format String
#--------------------------------------------------------------------------
def format_string(x, y, string, max_width = 100)
temp_word_array = string.scan (/./)
position = line_break = 0
lines = []
blank_width = []
new_string = [lines, blank_width]
for i in 0...temp_word_array.size
character = temp_word_array[i]
if character == " " or i == temp_word_array.size - 1
i += 1 if i == temp_word_array.size - 1
if self.contents.text_size(string[line_break,
i-line_break]).width <= max_width
position = i
else
line = temp_word_array[line_break, position-line_break]
new_string[0].push(line)
line_blank = max_width - self.contents.text_size(string[
line_break, position-line_break]).width
new_string[1].push(line_blank.to_f / (line.size.to_f - 1.0))
line_break = position + 1
position = i
end
end
end
new_string[0].push(temp_word_array[line_break,
temp_word_array.size - line_break])
draw_formated_string(x, y, new_string[0])
end
#--------------------------------------------------------------------------
# * Draw New String
#--------------------------------------------------------------------------
def draw_formated_string(x = 0, y = 0, lines = nil)
return if lines.nil?
size = self.contents.font.size
for line in 0...lines[0].size
self.contents.draw_text(x, y + (line * size), 380, size, lines[line].to_s)
end
end
#--------------------------------------------------------------------------
# * Draw Box
#--------------------------------------------------------------------------
def wmm_draw_box(x, y, w, h, f = nil, s = 2, c = Color.new(200, 200, 200))
self.contents.fill_rect(Rect.new(x, y, w, h), f) unless f.nil?
self.contents.fill_rect(Rect.new( x, y, w, s), c)
self.contents.fill_rect(Rect.new( x, y+h, w, s), c)
self.contents.fill_rect(Rect.new( x, y, s, h), c)
self.contents.fill_rect(Rect.new(x+w, y, s, h+s), c)
end
end
#==============================================================================
# ** Game Event
#==============================================================================
class Game_Event < Game_Character
def missions
return [] if @list.nil?
for i in 0..@list.size - 1
line = @list[i]
next if line.nil?
command = line.parameters[0]
next if command.nil? or !command.to_s.include?("Missions [")
command = command.to_s.split(" ")
if (command[2].nil? and command.size > 2) or command.size > 3
string = "Mis Arrow: Event #{self.id} has too many spaces. \n" +
"Comment: #{command.join(' - ')}"
print("#{string}")
$scene = nil
return
end
if command[0] == "Missions"
missions = command[1]
unless command[2].nil?
argue = command[2].split("=")
unless argue[0].nil?
argue[0].gsub("[", "$'")
unless $'.nil?
id = $'.sub("]", "").to_i
value = argue[1].to_i
if argue[0].include?("ifvar")
not_val = argue[0].include?("!")
unless not_val
missions = nil unless $game_variables[id] == value
else
missions = nil unless $game_variables[id] != value
end
elsif argue[0].include?("ifswi")
not_val = argue[0].include?("!")
unless not_val
missions = nil if $game_switches[id] == (value == 1)
#print("#{value} + #{$game_switches[id]}")
else
missions = nil unless $game_switches[id] != (value == 1)
end
end
#print("#{argue[0]} : #{id} = #{value}")
end
else
missions = nil
end
end
break if missions != nil
end
end
missions = "[]" if command.nil?
if missions.nil?
missions = command[1].include?("all") ? "[\"all\"]" : "[]"
end
if missions.include?("all")
new_ids = []; index = 0; 9999.times{index += 1; new_ids.push(index)}
missions.delete!("\"all\",")
ids = eval(missions)
for id in ids
new_ids.delete(id.to_i)
end
ids = new_ids
else
ids = eval(missions)
end
return ids
end
end
#==============================================================================
# ** Mission Arrow Window
#==============================================================================
class Window_MNArrow < Window_Base
#--------------------------------------------------------------------------
def initialize
super(-16, -16, 700, 540)
self.contents = Bitmap.new(self.width - 32, self.height - 32)
self.contents.font.size = 20
self.opacity = 0
@update_wait = 0
@bitmap = RPG::Cache.picture(Wig_Mission::POINT_IMG) rescue nil
@arrow = Arrow_Sprite.new(@bitmap)
@angle = 0
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
pointers = []
ids = []
set_true = false
for event in $game_map.events.values
ids = event.missions
next if ids.nil? or ids.empty?
if ids.include?($game_variables[Wig_Mission::ACT_VAR])
pointers.push(event.id)
px, py = $game_player.x, $game_player.y
ex, ey = event.x, event.y
gx = ex - px; gy = ey - py
@angle = get_angle(gx, gy)
@arrow.angle = 270 + @angle
w, h = @bitmap.width, @bitmap.height
self.contents.blt(@arrow.x - (w / 4), @arrow.y - (h / 2), @bitmap,
Rect.new(0, 0, w / 2, h), Wig_Mission::AROPACIT)
set_true = true
event_id = event.id
break
end
end
@arrow.visible = set_true
id = $game_variables[Wig_Mission::ACT_VAR]
return unless Wig_Mission::DEBUG and id != 0
self.contents.fill_rect(Rect.new(-24, 0, 680, 56), Color.new(0,0,0,150))
self.contents.draw_text(-24, 0, 680, 32,
"Target Mis:#{id} - Angle:#{@angle} - " +
"Event#{event_id}:[#{ex}, #{ey}] - " +
"Player:[#{px}, #{py}] - Point:[#{gx},#{gy}]", 1)
self.contents.draw_text(0, 24, 680, 32,
"Pointing at Event ID(s): #{pointers.join(', ')}", 1)
end
#--------------------------------------------------------------------------
def update
super
@update_wait -= 1
return if @update_wait > 0
@update_wait = Wig_Mission::REFRESH
refresh
@arrow.visible = false if $game_variables[Wig_Mission::ACT_VAR] == 0
@arrow.update if @arrow.visible
end
#--------------------------------------------------------------------------
def dispose
@arrow.dispose
super
end
#--------------------------------------------------------------------------
def get_angle(lx, ly)
angle = (Math.atan2(lx, ly) * 100).round
angle /= 2
if angle < 0
angle *= -1; angle = 360 - angle % 360
end
angle = 0 if lx == 0 and ly > 0
angle = 90 if lx > 0 and ly == 0
angle = 180 if lx == 0 and ly < 0
angle = 270 if lx < 0 and ly == 0
return angle
end
end
#==============================================================================
# ** Arrow Sprite
#==============================================================================
class Arrow_Sprite < Sprite
#--------------------------------------------------------------------------
def initialize(bitmap)
view = Viewport.new(0, 0, 680, 480); view.z = 9000
super(view)
unless bitmap.nil?
self.bitmap = bitmap; w, h = bitmap.width, bitmap.height
self.src_rect.set(w / 2, 0, w / 2, h)
self.x, self.y = Wig_Mission::ARROW_LOC[0] - (w / 2),
Wig_Mission::ARROW_LOC[1] - (h / 2)
self.x = (w / 4) if self.x < 0
self.y = (h / 2) if self.y < 0
self.x = 680 - (w / 4) if self.x > 680
self.y = 480 - (h / 2) if self.y > 480
self.ox, self.oy = w / 4, h / 2
self.opacity = Wig_Mission::AROPACIT
else
string = "Mis Arrow: \'#{POINT_IMG}\' was not found, be sure that it" +
"\n is in your Graphics\Pictures folder."
print("#{string}")
end
self.visible = false
update
end
#--------------------------------------------------------------------------
def dispose
self.bitmap.dispose unless self.bitmap.nil?
super
end
end
#==============================================================================
# ** Scene Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
alias :wmm_bat :call_battle
def call_battle
$game_system.dispose_windows
wmm_bat
end
#--------------------------------------------------------------------------
alias :wmm_shop :call_shop
def call_shop
$game_system.dispose_windows
wmm_shop
end
#--------------------------------------------------------------------------
alias :wmm_name :call_name
def call_name
$game_system.dispose_windows
wmm_name
end
#--------------------------------------------------------------------------
alias :wmm_menu :call_menu
def call_menu
$game_system.dispose_windows
wmm_menu
end
#--------------------------------------------------------------------------
alias :wmm_save :call_save
def call_save
$game_system.dispose_windows
wmm_save
end
#--------------------------------------------------------------------------
alias :wmm_debug :call_debug
def call_debug
$game_system.dispose_windows
wmm_debug
end
end
EVENTALIST
Show Signature
EVENTALIST