Battle dome script help (more help needed)

Started by nathmatt, February 11, 2009, 09:16:39 am

Previous topic - Next topic

nathmatt

February 24, 2009, 05:38:11 pm #20 Last Edit: April 05, 2009, 03:36:31 pm by nathmatt
ok im trying to acces the terrain tags out of scene map tryed this $game_map.terrain_tag but it dosent work
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


nathmatt

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


G_G

April 05, 2009, 03:45:13 pm #22 Last Edit: April 05, 2009, 04:34:18 pm by game_guy
try
$game_player.terrain_tag

not sure if it'll work

Aqua

terrain_tag(x, y)


X and Y are the coordinates you wish to get the tag for.

nathmatt

i used this character = $game_player $variables7 = character.terrain_tag when i was in scene map but now im useing scene battle & wants be to def terrain_tag
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


Aqua

Sorry... my bad

$scene_map.terrain_tag(x, y)


Sooo you'd have to store the player's x and y and put it there.

nathmatt

April 05, 2009, 07:07:06 pm #26 Last Edit: April 05, 2009, 07:10:37 pm by nathmatt
ok i have another question im tring use loop do but every time i do it locks up

heres my script

Spoiler: ShowHide
class Scene_Battle
   
  def main
    $game_temp.in_battle = true
    $game_temp.forcing_battler = nil
    @troop_id = $game_temp.battle_troop_id
    @character = $game_player
    @terrain_tag = Table.new(384)
    $game_variables [1] = @troop_id[0]
    $game_variables [2] = @troop_id[1]
    $game_variables [3] = @troop_id[2]
    @map_id = $game_map.map_id
    @player_x = $game_player.x
    @player_y = $game_player.y
    $game_system.menu_disabled = true
    $game_system.caterpillar = true
    @phase = 1
    loop do
      Graphics.update
      Input.update
      update1
      if $scene != self
        break
      end
    end
    $game_map.refresh
    end
  end
 
  def update1
    $game_system.update
    if @wait_count == nil
      @wait_count = 0
      return
    end
    if @wait_count > 0
      @wait_count -= 1
      return
    end
    if $game_map.map_id == 3
    case $terrain_t
    when 1
    teleport = [ 9, 9, 10, 2]
    when 2
    teleport = [ 8, 9, 6, 2]
    when 3
    teleport = [ 7, 9, 6, 2]
    return  teleport
  end
   if $game_map.map_id == 5
    case $terrain_t
    when 1
    teleport = [ 2, 8, 5, 2]
    when 2
    teleport = [ 2, 8, 5, 2]
    when 3
    teleport = [ 2, 8, 5, 2]
    return  teleport
  end
  if $game_map.map_id == 6
    case $terrain_t
    when 1
    teleport = [ 2, 8, 5, 2]
    when 2
    teleport = [ 2, 8, 5, 2]
    when 3
    teleport = [ 2, 8, 5, 2]
    return  teleport
    end
    case @phase
    when 1 
      update_phase1
    when 2 
      update_phase2
    when 3 
      update_phase3
    when 4 
      update_phase4
    end
  end
end

def update_phase1
$game_temp.player_transferring = true
$game_temp.player_new_map_id = teleport[0]
$game_temp.player_new_x = teleport[1]
$game_temp.player_new_y = teleport[2]
$game_temp.player_new_direction = teleport[3]
@phase = 2
end

def update_phase2
if $game_map.map_id !=  @map_id
   @wait_count = 40
   end
  if  @wait_count > 0
     enemy1
     enemy2
     enemy3
     @phase = 3
   end
   
def update_phase3
  if $game_variables [4]  == 3
    $game_system.me_play($game_system.battle_end_me)
    $game_system.hud = false
    $window =  Window_Result.new
    @wait_count = 40
  end
if @wait_count == 0
$window.dispose
    exp = $total1
    gold = $total2
    treasures = $total3
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    $game_party.gain_gold(gold)
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    $total1 = 0
    $total2 = 0
    $total3 = 0
    $game_variables [4] = 0
    @phase = 4
  end
   
  def update_phase4
  $game_temp.player_transferring = true
    $game_temp.player_new_map_id = @map_id
    $game_temp.player_new_x = @player_x
    $game_temp.player_new_y = @player_y
    $game_temp.player_new_direction = 2
    $game_system.bgm_play($game_temp.map_bgm)
    $game_system.hud = true
    $game_system.menu_disabled = false
    if $game_switches [1] == true
    $game_system.caterpillar = false
     end
    end
   end   
  end
end
end
 
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


Aqua

You need a way for the loop to end or else it'll keep on going forever and "lock up".

G_G

Quote from: Aqua on April 05, 2009, 06:58:53 pm
Sorry... my bad

$scene_map.terrain_tag(x, y)


Sooo you'd have to store the player's x and y and put it there.


Use this so you dont need to keep track of player x and y through variables
$scene_map.terrain_tag($game_player.x, $game_player.y)

nathmatt

my problem is i need it too keep looping forever while the battles going so when the battle ends i can leave the map or im stuck there btw the terrain thing didnt work because it wasnt rredefing the update method 
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


Aqua

You know... you gotta assign it to something...

$terraintag = $scene_map.terrain_tag($game_player.x, $game_player.y)


Why not just flip a switch when the battles end.
Then if that switch is on, you'll leave the map and turn off the switch.

Blizzard

"character.terrain_tag" calls "$game_map.terrain_tag(character.x, character.y)". -_- You can just use "$game_player.terrain_tag".
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

nathmatt

April 07, 2009, 10:10:47 am #32 Last Edit: April 10, 2009, 12:22:58 pm by nathmatt
ok heres my script but its not working

Spoiler: ShowHide
lass Game_System
  attr_accessor :terrains
 
  alias gog_terrains_init initialize
  def initialize
    gog_terrains_init
    @terrains = {
      1 => [ 9, 8, 5, 2, 2, 0],
      2 => [ 8, 8, 5, 2, 2, 0],
      3 => [ 7, 8, 5, 2, 2, 0],
      4 => [ 2, 8, 5, 2, 2, 0],
      5 => [ 2, 8, 5, 2, 2, 0],
      6 => [ 2, 8, 5, 2, 2, 0],
      7 => [ 2, 8, 5, 2, 2, 0]
    }
  end
end

  class Scene_Map
   
  def call_battle
    $game_temp.battle_calling = false
    $game_temp.menu_calling = false
    $game_temp.menu_beep = false
    $game_player.make_encounter_count
    $game_temp.map_bgm = $game_system.playing_bgm
    $game_system.bgm_stop
    $game_system.se_play($data_system.battle_start_se)
    $game_system.bgm_play($game_system.battle_bgm)
    $game_player.straighten
    $game_temp.in_battle = true
    $game_temp.forcing_battler = nil
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    @map_id = $game_map.map_id
    @player_x = $game_player.x
    @player_y = $game_player.y
    @rand = teleport(4)
    @extra = teleport(5)
    $game_variables [1] = rand(@rand) + @extra # 1st enemy
    $game_variables [2] = rand(@rand) + @extra # 2nd Enemy
    $game_variables [3] = rand(@rand) + @extra  # 3rd enemy
    $game_system.menu_disabled = true
    $game_system.caterpillar = true
    @phase = 1
  end
 
   
   alias map_update update
  def update
    map_update
      @check_terrain
      @update_phase1
      @update_phase2
      @update_phase3
      @update_phase4
    end
    if @wait_count == nil
      @wait_count = 0
    elsif @wait_count > 0
      @wait_count -= 1
      return
    end
  end
 
  def check_terrain
    if $game_player.terrain_tag == 1
      teleport  = $game_system.terrains[1]
    elsif $game_player.terrain_tag == 2
      teleport  = $game_system.terrains[2]
    elsif $game_player.terrain_tag == 3
      teleport  = $game_system.terrains[3]
    elsif $game_player.terrain_tag == 4
      teleport  = $game_system.terrains[4]
    elsif $game_player.terrain_tag == 5
      teleport  = $game_system.terrains[5]
    elsif $game_player.terrain_tag == 6
      teleport  = $game_system.terrains[6]
    elsif $game_player.terrain_tag == 7
      teleport  = $game_system.terrains[7]
    end
  end
 
def update_phase1
$game_temp.player_transferring = true
$game_temp.player_new_map_id = teleport[0]
$game_temp.player_new_x = teleport[1]
$game_temp.player_new_y = teleport[2]
$game_temp.player_new_direction = teleport[3]
@phase = 2
end

def update_phase2
if @phase == 2 
if $game_map.map_id !=  @map_id
   @wait_count = 40
   end
  if  @wait_count > 0
     enemy1
     enemy2
     enemy3
     @phase = 3
   end
end
end
   
def update_phase3
  if @phase == 3 
  if $game_variables [4]  == 3
    $game_system.me_play($game_system.battle_end_me)
    $game_system.hud = false
    $window =  Window_Result.new
    @wait_count = 40
  end
if @wait_count == 0
$window.dispose
    exp = $total1
    gold = $total2
    treasures = $total3
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    $game_party.gain_gold(gold)
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    $total1 = 0
    $total2 = 0
    $total3 = 0
    $game_variables [4] = 0
    @phase = 4
  end
end
end
   
  def update_phase4
    if @phase == 4
   $game_temp.player_transferring = true
    $game_temp.player_new_map_id = @map_id
    $game_temp.player_new_x = @player_x
    $game_temp.player_new_y = @player_y
    $game_temp.player_new_direction = 2
    $game_system.bgm_play($game_temp.map_bgm)
    $game_system.hud = true
    $game_system.menu_disabled = false
    if $game_switches [1] == true
    $game_system.caterpillar = false
    $game_temp.in_battle = false
     end
    end
   end   
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


nathmatt

April 10, 2009, 10:47:48 am #33 Last Edit: April 10, 2009, 12:25:14 pm by nathmatt
Quote from: nathmatt on April 07, 2009, 10:10:47 am
ok heres my script but its not working

Spoiler: ShowHide
lass Game_System
  attr_accessor :terrains
 
  alias gog_terrains_init initialize
  def initialize
    gog_terrains_init
    @terrains = {
      1 => [ 9, 8, 5, 2, 2, 0],
      2 => [ 8, 8, 5, 2, 2, 0],
      3 => [ 7, 8, 5, 2, 2, 0],
      4 => [ 2, 8, 5, 2, 2, 0],
      5 => [ 2, 8, 5, 2, 2, 0],
      6 => [ 2, 8, 5, 2, 2, 0],
      7 => [ 2, 8, 5, 2, 2, 0]
    }
  end
end

  class Scene_Map
   
  def call_battle
    $game_temp.battle_calling = false
    $game_temp.menu_calling = false
    $game_temp.menu_beep = false
    $game_player.make_encounter_count
    $game_temp.map_bgm = $game_system.playing_bgm
    $game_system.bgm_stop
    $game_system.se_play($data_system.battle_start_se)
    $game_system.bgm_play($game_system.battle_bgm)
    $game_player.straighten
    $game_temp.in_battle = true
    $game_temp.forcing_battler = nil
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    @map_id = $game_map.map_id
    @player_x = $game_player.x
    @player_y = $game_player.y
    @rand = teleport(4)
    @extra = teleport(5)
    $game_variables [1] = rand(@rand) + @extra # 1st enemy
    $game_variables [2] = rand(@rand) + @extra # 2nd Enemy
    $game_variables [3] = rand(@rand) + @extra  # 3rd enemy
    $game_system.menu_disabled = true
    $game_system.caterpillar = true
    @phase = 1
  end
 
   
   alias map_update update
  def update
    map_update
      @check_terrain
      @update_phase1
      @update_phase2
      @update_phase3
      @update_phase4
    end
    if @wait_count == nil
      @wait_count = 0
    elsif @wait_count > 0
      @wait_count -= 1
      return
    end
  end
 
  def check_terrain
    if $game_player.terrain_tag == 1
      teleport  = $game_system.terrains[1]
    elsif $game_player.terrain_tag == 2
      teleport  = $game_system.terrains[2]
    elsif $game_player.terrain_tag == 3
      teleport  = $game_system.terrains[3]
    elsif $game_player.terrain_tag == 4
      teleport  = $game_system.terrains[4]
    elsif $game_player.terrain_tag == 5
      teleport  = $game_system.terrains[5]
    elsif $game_player.terrain_tag == 6
      teleport  = $game_system.terrains[6]
    elsif $game_player.terrain_tag == 7
      teleport  = $game_system.terrains[7]
    end
  end
 
def update_phase1
$game_temp.player_transferring = true
$game_temp.player_new_map_id = teleport[0]
$game_temp.player_new_x = teleport[1]
$game_temp.player_new_y = teleport[2]
$game_temp.player_new_direction = teleport[3]
@phase = 2
end

def update_phase2
if @phase == 2 
if $game_map.map_id !=  @map_id
   @wait_count = 40
   end
  if  @wait_count > 0
     enemy1
     enemy2
     enemy3
     @phase = 3
   end
end
end
   
def update_phase3
  if @phase == 3 
  if $game_variables [4]  == 3
    $game_system.me_play($game_system.battle_end_me)
    $game_system.hud = false
    $window =  Window_Result.new
    @wait_count = 40
  end
if @wait_count == 0
$window.dispose
    exp = $total1
    gold = $total2
    treasures = $total3
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    $game_party.gain_gold(gold)
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    $total1 = 0
    $total2 = 0
    $total3 = 0
    $game_variables [4] = 0
    @phase = 4
  end
end
end
   
  def update_phase4
    if @phase == 4
   $game_temp.player_transferring = true
    $game_temp.player_new_map_id = @map_id
    $game_temp.player_new_x = @player_x
    $game_temp.player_new_y = @player_y
    $game_temp.player_new_direction = 2
    $game_system.bgm_play($game_temp.map_bgm)
    $game_system.hud = true
    $game_system.menu_disabled = false
    if $game_switches [1] == true
    $game_system.caterpillar = false
    $game_temp.in_battle = false
     end
    end
   end   


ok i changed it thanks to GameGirl lol GameGuy & WCW i think tran week lol but its still not working
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