Main Menu
  • Welcome to The RPG Maker Resource Kit.

Scene_Battle Question

Started by blazinhandle, March 02, 2007, 06:12:46 PM

0 Members and 1 Guest are viewing this topic.

blazinhandle

I'm trying to make a system that enables a slight recovery of SP everytime a character's turn comes up, but also uses a certain amount of SP whenever the character decides to Attack and Use an item. And, of course, the Defend command (called Rest) will be used to Recover more SP, and the Skill will have its normal functioning. However, I have no idea where to input this....like whenever a turn occurs and whenever a certain command is used.

Any ideas?

thanks!


p.s. the new forum layout looks siiiiiick.

Blizzard

def make_item_action_result and def make_attack_action_result, there you can add something like i.e. @active_battler.sp -= 20. The recover:

class Scene_Battle
 
  alias start_phase4_recover_later start_phase4
  def start_phase4
    start_phase4_recover_later
    for actor in $game_party.actors
      actor.sp += 20
      actor.sp += 50 if actor.current_action.kind == 0 and actor.current_action.basic == 1
    end
    @status_window.refresh
  end
 
end


Just change the numbers like you want them.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

blazinhandle

wow blizz you never fail to impress.  ;D The attack and item worked, but I got a system stack error with the new alias. I wonder if it did that when the maxsp was already maxed out and when it tried recovering more it somehow crashed. Either that or i put it in a bad spot (Scene_Battle 4 right under disabling of the windows). What do you think?

also, any ideas of how i should/could go about displaying exactly how much is recovered (like number pop on the character and not just the gradient fill)?

thanks;)

Blizzard

#3
Try it this way.

class Scene_Battle
 
  alias start_phase4_recover2_later start_phase4
  def start_phase4
    start_phase4_recover2_later
    for actor in $game_party.actors
      unless actor.dead?
        actor.sp += 20
        actor.sp += 50 if actor.current_action.kind == 0 and actor.current_action.basic == 1
      end
    end
    @status_window.refresh
  end
 
end


For display just add below any of the SOMETHING.sp += NUMBER a SOMETHING.damage = -NUMBER and the gain will be displayed as well. Basically putting it under Scene_Battle 4 should work fine if you're not using any CBS-es or special battle add-ons.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

blazinhandle

#4
hmmm i'm still getting a S.O.B. systemstackerror. i've been placing it under the disabling of windows in the def start_phase4, think it could have something to do with 2 def start_phase4's?

LOL, i was actually putting it IN Scene_battle 4 rather than in its own script right below it.


Blizzard

Try it without the code. This was aliased with a name that shouldn't appear anywhere else in your script. =/
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

blazinhandle

i'm sorry for being a pest man, but how could i disable attack and item if the needed SP wasn't availible?

btw, im testing out the displaying of recovery SP.
I set the display up like this (just an example of how i did it for Item):

  def make_item_action_result
    # Get item
    @item = $data_items[@active_battler.current_action.item_id]
    # If unable to use due to items running out
    unless $game_party.item_can_use?(@item.id)
      # Shift to step 1
      @phase4_step = 1
      return
    end
    # If consumable
    if @item.consumable
      # Decrease used item by 1
      $game_party.lose_item(@item.id, 1)
    end
    # Use of STAMINA!!!!
    @active_battler.sp -= @active_battler.maxsp/10
    # Display just how much STAMINA is used
    @active_battler.damage = -@active_battler.sp
    # Display item name on help window
    @help_window.set_text(@item.name, 1)
    # Set animation ID
    @animation1_id = @item.animation1_id
    @animation2_id = @item.animation2_id
    # Set common event ID
    @common_event_id = @item.common_event_id
    # Decide on target
    index = @active_battler.current_action.target_index
    target = $game_party.smooth_target_actor(index)
    # Set targeted battlers
    set_target_battlers(@item.scope)
    # Apply item effect
    for target in @target_battlers
      target.item_effect(@item)
    end
  end

Blizzard

Should be like this:

    @active_battler.sp -= @active_battler.maxsp/10
    @active_battler.damage = -@active_battler.maxsp/10


And about the disable... Well, you need a little bit more code for that. The SP need to be checked during the setup of the command window and the attack should be disabled according to the left SP.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

blazinhandle

okay well i've got the disabling squared away but i still cant get the SP recovery/drought is be displayed even when i set it up like that :-\

Blizzard

I forgot something. You need that third thing as well. (^__^')

    @active_battler.sp -= @active_battler.maxsp/10
    @active_battler.damage = -@active_battler.maxsp/10
    @active_battler.damage_pop = true

Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

blazinhandle

lol still nothing, no worries tho blizz it's not a big deal 8)

fadark

bliz, can you make me a script that makes it so at the begining of your turn each of your heroes gains 10 sp. but you don't lose any unless you use a skill.

and outside a battle: for every 100 steps that your hero makes, all of your heroes gain 10 sp.

can you do that for me?

just so everyone knows, im 15 years old.

:)

100 steps can be done with events...might be hard I guess but you could use button imput for arrow keys that would add to a variable called walking, which is reset at 101
but when = 100 change Sp
Watch out for: HaloOfTheSun

blazinhandle

Quote from: fadark on March 03, 2007, 07:26:11 PM
bliz, can you make me a script that makes it so at the begining of your turn each of your heroes gains 10 sp.

class Scene_Battle
 
  alias start_phase4_recover2_later start_phase4
  def start_phase4
    start_phase4_recover2_later
    for actor in $game_party.actors
      unless actor.dead?
        actor.sp += 10
      end
    end
    @status_window.refresh
  end
 
end

fadark

thanks, but I still need:
Quoteoutside a battle: for every 100 steps that your hero makes, all of your heroes gain 10 sp.

and I don't really want to do it in events.

just so everyone knows, im 15 years old.

Shinami


fadark


just so everyone knows, im 15 years old.

blazinhandle

Quote from: fadark on March 04, 2007, 04:21:23 AM
thats really complicated. :(

i'm sorry dude but it's really not, he's laid EVERYTHING out for you. it would take maybe 5 minutes to copy and then another 10 to understand it as he's labled EVERYTHING that he's done and explained it thoroughly.

btw man, you've pretty much started a completely new topic in someone else's post. I'm not mad or anything dude, you'd just get a little more help if you were a bit more respectful. but yeah, just take the time to read through that, ingest it, and you'll be able to apply it no problem ;)

fadark

sorry about the "making a new post in someone elses post" thing. I just thought that his idea was good, so i asked if i could find "my" version of it.

I looked over the pic shinami made, and it made alot more sense. thanks you!

just so everyone knows, im 15 years old.

blazinhandle