Main Menu
  • Welcome to The RPG Maker Resource Kit.

What value should I enter for @active_battler ??

Started by SeMcDun, February 08, 2011, 12:56:41 AM

0 Members and 1 Guest are viewing this topic.

SeMcDun

Hey guys.

I've been searching through the game's scripts and can't seem to find what data to actually put into the @active_battler variable.

I thought this would be in Script requests because I need it for the Conditional Branch script option ^_^

dricc

What condition do you want to make ?
The answer of this question is probably in "Scene_Battle" . @active_battler is a Game_Battler class variable .
You can use my scripts freely . but not for commercial use .
:ccbync:
Don't encrypt your game !!!
Want to give me credit ? Easy ,add me in your game :

SeMcDun

What I'm trying to do is create a player touch event in the GubiD TBS.

I am trying to find a way to distinguish which character has stepped on the event, then apply a state to them.
So my reasoning was, find who is the active battler, then apply the state to them through eventing.

Is there a better way to do this? Or am I even going the right way about this?

Thanks for the help :)

dricc

You should have said "GTBS" first . This is always special .

I think you can apply a state to the active battler like this :
$scene.active_battler.add_state(<state_id>)
And your event should be called "battle_event" like the tower in the GTBS demo .

Not tested ...
You can use my scripts freely . but not for commercial use .
:ccbync:
Don't encrypt your game !!!
Want to give me credit ? Easy ,add me in your game :

SeMcDun

Hm. Comes up with an error.

"NO METHOD ERROR"

"undefined method 'active_battler' for Scene_Battle_TBS"

I checked through GTBS for 'active_battler' and 'add_state' with Ctrl F and found just "battler.add_state", this didn't work either =/

And yeh, I set the event name to battle_event and player touch :)

dricc

try to add this small script under the GTBS :

class Scene_Battle_TBS
  #--------------------------------------------------------------------------
  # Short hand method calls
  #--------------------------------------------------------------------------
  def active_battler
    return @active_battler
  end
end
You can use my scripts freely . but not for commercial use .
:ccbync:
Don't encrypt your game !!!
Want to give me credit ? Easy ,add me in your game :

SeMcDun

Done that, now I get the same error but with "add_state".

I checked out the GTBS battle_scene and it only ever uses battler.add_state, not active_battler.add_state.
Is that any help?

dricc

OK , so the GTBS don't know who was the latest battler .
Let's help him with this script :


class Scene_Battle_TBS
    attr_accessor  :active_battler_last

  #--------------------------------------------------------------------------
  # Short hand method calls
  #--------------------------------------------------------------------------
  def active_battler
    return @active_battler_last
  end

  alias dricc_set_active_battler set_active_battler
  def set_active_battler(battler)
     @active_battler_last = battler
     dricc_set_active_battler(battler)
   end
   end

   
You can use my scripts freely . but not for commercial use .
:ccbync:
Don't encrypt your game !!!
Want to give me credit ? Easy ,add me in your game :

SeMcDun

YAAAAAS :D It works perfectly. Thanks for all the help dricc :)

Ps. Can I use you in my game? :P To show my thanks?

dricc

Yes , use my charset freely . I made it for that .
I can even talk lol :

Good luck with the GTBS :)
You can use my scripts freely . but not for commercial use .
:ccbync:
Don't encrypt your game !!!
Want to give me credit ? Easy ,add me in your game :