RMXP - how can i make a Message_Window like popup

Started by Memor-X, August 09, 2012, 01:27:19 am

Previous topic - Next topic

Memor-X

incase if i haven't said it already, while i've been waiting for ARCed to come out (so i can use the map zoom function to clean up my cutscenes) i've been reworking my scripts in Nexis Core: Chain of Shadows, mainly improving the 3 systems used in it, the XGrid, Camping and Mission Terminal, the originals was very poorly done not because of lazyness but because i didn't know too much about scripting

at the moment i've been working on the XGrid since that's the development system for the characters, a bit more important than the others, anyway, i've been experimenting with the Window class fixing up the onscreen GUI's for when the player is in the Grid Hub or the Character Grids, i also got my Code Geass Nunnally in Wonderland Notebooks the other day so i got something to write what pops into my head (it's hard enough to read my work notes, don't need my game development notes mixed in)

anyway, the original XGrid i had working in Nexis Core: Chain of Shadows Version CUBGM used a message popup to explain what the requirements was to activate a node, this of cause was enhanced due to a message enhancement script, i got it from Creation Asylum a while back, think it was Near's or Alex's one, can't remember

anyway, with the rebuild i'm using the Multiple Message Windows Non SDK version ForeverZer0 fixed up with LiTTleDRAgo's plugin to make it work in Blizz-ABS (sure it works, no errors but i haven't used it to it's fullest yet), the difference between the scripts is that the one from the Asylum has a name box that would be created just above the message box, i used this for the Node name and the requirements and what you have met on 2 separate lines, with Multiple Message Windows, this doesn't exist, so the message is broken cause you have something like

/name[Strength +1] {CONDITIONS TO ACTIVATE}
{WHAT YOU HAVE IN COMPARISON}

not too good when i want to have the choice to activate it in the same window, so i decided to stop being suck a f****** idiot and script like proper person

this is where my problem comes in, i can make a Window pop up but i still can move which is going to cause some problems, what i want to be able to do is when i go to activate an event (the Node) a new Window is created is drawn with the details with a second window under it with the choices of "yes" or "no", while these windows are up, the player shouldn't move at all or even interact (just locking the player's movements and direction will still present a problem of them pressing enter at the event again).....however i still need this to be done while i'm in Scene_Map cause i still have some stuff in the event i want to fire off depending on the choice so most likely i need to freeze all processing of Scene_Map

the best way i can think about doing this is a script call that is called in the condition branch like

Condition Branch: Script - $xgrid.activateNodeAsk(args) == true

end


i know when i do something like this in Game Maker
if(ask_question("do you want to save"))

it stops everything until i've made the choice.....ofcause if this can't be done i'm happy with any other method, i'm sure i can adapt the system

thanking you in advance

NOTE: args in the condition branch would just be an array of values, most likely ints since inside i can just use switch/case statements to output or check data

nathmatt

here

Spoiler: ShowHide
class Game_Temp
 attr_accessor :scene
 attr_accessor :condition
 attr_accessor :question_start
end

class Interpreter
 
 def ask_question(s)
   $game_temp.question_start = true
   current_indent = @list[@index].indent
   $game_temp.scene = Scene_Question.new(s)
   while $game_temp.scene.is_a?(Scene_Question)
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Scene update
     $game_temp.scene.update
   end
   if $game_temp.condition
     $game_temp.condition = nil
     return true
   else
     $game_temp.condition = nil
     return false
   end
 end
 
end

class Question_Command < Window_Selectable
 
 attr_accessor :condition
 
def initialize(x, y, width, height)
   super
   @item_max = 2
   @column_max = 2
   @commands = ['yes','no']
   self.contents = Bitmap.new(width - 32, 32)
   refresh
   self.index = 0
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   for i in 0...@item_max
     draw_item(i)
   end
 end
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #     color : text color
 #--------------------------------------------------------------------------
 def draw_item(index)
   w = self.contents.width / 2
   rect = Rect.new( w * index, 0, w, 32)
   self.contents.draw_text(rect, @commands[index],1)
 end
 #--------------------------------------------------------------------------
 # * update
 #--------------------------------------------------------------------------
 def update
   super
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     @condition = false
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
   # Branch by command window cursor position
     case @index
     when 0  # yes
       @condition = true
     when 1
       @condition = false
     end
     @index = -1
   end
 end
end

class Scene_Question
 
 
 def initialize(s)
   @s = s
   b = Bitmap.new(100,32)
   w = b.text_size(s).width + 32
   $game_temp.condition = false
   @window_help = Window_Help.new
   @window_help.width = w
   @window_help.contents = Bitmap.new(w-32,32)
   @window_help.x = 320 - @window_help.width / 2
   @window_help.y = 240 - 128
   @window_help.set_text(s)
   @window_command = Question_Command.new(@window_help.x,@window_help.y+64,w,64)
 end
 
 def update
   @window_help.update
   @window_command.update
   if @window_command.condition != nil
     $game_temp.condition = @window_command.condition
     dispose
   end
 end
 
 def dispose
   @window_help.dispose
   @window_command.dispose
   $game_temp.scene = nil
 end
 
end

class Game_Event
 
 alias question_start start
 def start
   if $game_temp.question_start
     $game_temp.question_start = false
     return
   end
   question_start
 end
 
end

class Scene_Map
 
 alias question_call_menu call_menu
 def call_menu
   $game_temp.menu_calling = false
   if $game_temp.question_start
     $game_temp.question_start = false
     return
   end
   question_call_menu
 end
 
end


use
ask_question("msg here")

in a script condition branch
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Memor-X

thanks, at the least i was expecting someone to tell me about how to go about freezing Scene_Map and creating a message, not an entire script, this is even better

ForeverZer0

You could just not updated the Game_Player class. You could even use a switch.

class Game_Player
 
  alias disable_update update
  def update
    unless $game_switches[1]
      disable_update
    end
  end
end
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.