battle scene & battle result (resolved)

Started by nathmatt, February 08, 2009, 09:49:41 am

Previous topic - Next topic

nathmatt

February 08, 2009, 09:49:41 am Last Edit: February 11, 2009, 08:33:00 am by nathmatt
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
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


shdwlink1993

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.
Stuff I've made:




"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

nathmatt

would it make a difference if i had the postal knight edition because i cant find the part in there
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


shdwlink1993

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.
Stuff I've made:




"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

nathmatt

February 09, 2009, 12:05:02 pm #4 Last Edit: February 09, 2009, 01:18:18 pm by nathmatt
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
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

u go to scene map def battle thats where it is blizz told me
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