The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: SeMcDun on February 08, 2011, 12:56:41 AM

Title: What value should I enter for @active_battler ??
Post by: SeMcDun on February 08, 2011, 12:56:41 AM
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 ^_^
Title: Re: What value should I enter for @active_battler ??
Post by: dricc on February 08, 2011, 03:52:55 PM
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 .
Title: Re: What value should I enter for @active_battler ??
Post by: SeMcDun on February 08, 2011, 04:13:11 PM
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 :)
Title: Re: What value should I enter for @active_battler ??
Post by: dricc on February 08, 2011, 04:26:54 PM
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 ...
Title: Re: What value should I enter for @active_battler ??
Post by: SeMcDun on February 08, 2011, 04:50:07 PM
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 :)
Title: Re: What value should I enter for @active_battler ??
Post by: dricc on February 08, 2011, 04:54:01 PM
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
Title: Re: What value should I enter for @active_battler ??
Post by: SeMcDun on February 08, 2011, 05:03:43 PM
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?
Title: Re: What value should I enter for @active_battler ??
Post by: dricc on February 08, 2011, 05:12:25 PM
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

   
Title: Re: What value should I enter for @active_battler ??
Post by: SeMcDun on February 08, 2011, 05:24:26 PM
YAAAAAS :D It works perfectly. Thanks for all the help dricc :)

Ps. Can I use you in my game? :P To show my thanks?
Title: Re: What value should I enter for @active_battler ??
Post by: dricc on February 08, 2011, 05:32:47 PM
Yes , use my charset freely . I made it for that .
I can even talk lol :
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi39.servimg.com%2Fu%2Ff39%2F11%2F59%2F23%2F52%2Fdricc11.png&hash=fdc76624b9bfc836784b5564e5441f05cc9400f7)
Good luck with the GTBS :)