The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: selavy_rrose on April 21, 2010, 12:01:47 PM

Title: Trying to Call a Revive Common Event for a Particular Map(Help Needed)
Post by: selavy_rrose on April 21, 2010, 12:01:47 PM
Hello again ,
The default thing in RPGVX seems to be gameover when defeated. In individual events every event's particular revive seems to overwrite that, but not from map properties ->troops. I tried to fiddle with the script, so now instead of gameover it's just fadeout, but the common event revive still doesn't start, eventhough I put it in database troops battle processing, and also created a new scene in the script editor. - Scene_Revive

class Scene_Revive < Scene_Base
 #--------------------------------------------------------------------------
 # * Start processing
 #--------------------------------------------------------------------------
 def start
   super
   $game_temp.in_battle = false
   Graphics.update
   @brightness = 255
   @map_id = ("Forest")
   initialise(013)
 end
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     common_event_id : common event ID
 #--------------------------------------------------------------------------
 def initialise(common_event_id)
   @common_event_id = common_event_id
   @interpreter = nil
   refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   if self.trigger == 2 and $game_switches[self.switch_id] == true
     @interpreter = Game_Interpreter.new if @interpreter == nil
   else
     @interpreter = nil
   end
 end
 #--------------------------------------------------------------------------
 # * Get Trigger
 #--------------------------------------------------------------------------
 def trigger
   return $data_common_events[@common_event_id].trigger
 end
end


I also changed things in scene battle:

 #--------------------------------------------------------------------------
 # * End Battle
 #     result : Results (0: win, 1: escape, 2:lose)
 #--------------------------------------------------------------------------
 def battle_end(result)
   if result == 2 and not $game_troop.can_lose
     call_revive
   else
     $game_party.clear_actions
     $game_party.remove_states_battle
     $game_troop.clear
     if $game_temp.battle_proc != nil
       $game_temp.battle_proc.call(result)
       $game_temp.battle_proc = nil
     end
     unless $BTEST
       $game_temp.map_bgm.play
       $game_temp.map_bgs.play
     end
     $scene = Scene_Map.new
     @message_window.clear
     Graphics.fadeout(30)
   end
   $game_temp.in_battle = false
 end


 #--------------------------------------------------------------------------
 # * Execute Screen Switch
 #--------------------------------------------------------------------------
 def update_scene_change
   case $game_temp.next_scene
   when "map"
     call_map
   when "gameover"
     call_gameover
   when "title"
     call_title
   when "revive"
     call_revive
   else
     $game_temp.next_scene = nil
   end
 end

 #--------------------------------------------------------------------------
 # * Switch to Revive Screen event 013
 #--------------------------------------------------------------------------
 def call_revive
   $scene = Scene_Revive.new
   @message_window.clear
   Graphics.update
   Graphics.fadein(30)
 end

Thank you in advance anybody who can help. :)
Title: Re: Trying to Call a Revive Common Event for a Particular Map(Help Needed)
Post by: modern algebra on April 21, 2010, 02:36:13 PM
Well, I'm not quite sure what you're trying to do, but there are a few things about that scene that are pretty iffy. Anyay, if all you want to do is call a common event instead of Game Over, then you could use GameOver -> Common Event (http://rmrk.net/index.php/topic,24897.0.html). However, if you are doing this as an exercise to learn Ruby, then I could help you fix the code you put up.
Title: Re: Trying to Call a Revive Common Event for a Particular Map(Help Needed)
Post by: selavy_rrose on April 21, 2010, 03:13:15 PM
Thank you, yes I am trying to understand Ruby, I bought a couple of books about it, though couldn't find any books specifically about RGSS.
I think with this RPGVX Script Editor fiddling copying and pasting, I am only starting to understand a little how it works. I was glad when it actually started to play the game, instead of showing me an error. lol
I am trying to see the right map screen instead of blackness, in a previous try I managed to renew the map, but the player was dead and walking...