Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: nathmatt on February 08, 2009, 09:49:41 am

Title: battle scene & battle result (resolved)
Post by: nathmatt on February 08, 2009, 09:49:41 am
ok im trying to edit the scene battle all i want it to do is activate a switch when u battle encounter
& the i want to at the end of the battle im useing i want to use the default battle result but i want it to get the exp money & treasure from a variable im useing BLABS with the event battle add on i made http://forum.chaos-project.com/index.php?topic=2194.0 just trying to do encounters instead of event 1s
Title: Re: battle scene & battle result
Post by: shdwlink1993 on February 08, 2009, 12:54:30 pm
OK, this should be a quick bunch of edits.

To activate a switch when the battle starts, go to Scene_Battle 1, and at the top is the main function. Put this line in anywhere between "def main" and "start_phase1":

  $game_switches[ID] = true


The second part is barely more complex. Go to Scene_Battle 2, and toward the bottom is the start_phase 5 function. Replace this section of the code:

    # Loop
    for enemy in $game_troop.enemies
      # If enemy is not hidden
      unless enemy.hidden
        # Add EXP and amount of gold obtained
        exp += enemy.exp
        gold += enemy.gold
        # Determine if treasure appears
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end


with this:

    # Loop
    $game_troop.enemies.each {|enemy|
      # If enemy is not hidden
      unless enemy.hidden
        # Add EXP and amount of gold obtained
        exp += $game_variables[EXP]
        gold += $game_variables[GOLD]
        # Determine if treasure appears
        treasures.push($data_items[$game_variables[ITEM]])
        treasures.push($data_weapons[$game_variables[WEAPON]])
        treasures.push($data_armors[$game_variables[ARMOR]])
      end
    }


For all of these, you'll need to change the words in caps (ID, GOLD, etc) to the number you need. If it gives you any problems, just let me know.
Title: Re: battle scene & battle result
Post by: nathmatt on February 08, 2009, 05:10:35 pm
would it make a difference if i had the postal knight edition because i cant find the part in there
Title: Re: battle scene & battle result
Post by: shdwlink1993 on February 08, 2009, 08:30:22 pm
All it would change is what is written in the comments of the script. The actual code needed would be completely identical.

In an unmodified version (Yes, I even pulled up the Japanese script, just to make sure ;)), you'd be looking for "def main" at line 11 of Scene_Battle 1, and "def start_phase 5" at line 133 of Scene_Battle 2.
Title: Re: battle scene & battle result
Post by: nathmatt on February 09, 2009, 12:05:02 pm
im getting a syndtax error witch is on line 190 with is just an end tryed adding another 1 that didnt help btw how do i stop the battle from accouring just turn on the switch
Title: Re: battle scene & battle result (resolved)
Post by: nathmatt on February 11, 2009, 08:34:12 am
u go to scene map def battle thats where it is blizz told me