Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

RTAB Modification

Hello. Enough chatter, let's get on to business.

In an old project I was using the DBS. I had it edited in a way so that when a character would perform a basic attack he/she/it would game a certain amount of MP based on their level. It did this by determining the "active_battler" and then calling a specific common event that corresponded with the character. It all worked perfectly.

Fast-forward until recent times and I have a project using cogwheel's RTAB, and I want in implement the same feature as previously mentioned. I found the spot in the script that was the exact same spot where it was in the DBS (Scene_Battle 4). But it doesn't work! I've gone through various measures to test if it is reading the "active_battler" correctly and if the common event calling is right. For example, I put an event on a map with a call script "$game_temp.common_event_id = 1" and it activates the common event correctly. Here is what my code currently looks like, starting at line 1720:

Code:
      # Applying the effect of normality attack
      for target in battler.target
        target.attack_effect(battler)
      end
[COLOR=Red][B]      # BEGIN OP INCREASES
        if battler == $game_actors[1]
          $game_temp.common_event_id = 1
        end
      # END OP INCREASES[/B][/COLOR]
      return
    end
(The bold and red parts are the only things I added.)

I tested to see if the script was reading the "if battler == $game_actors[1]" part correctly by doing this:

Code:
        if battler == $game_actors[1]
          $scene = Scene_Title.new
        end

and it works! But it won't call my common event, even though I tested if that code actually works.

I know a bunch of people will say it's easier just to put the whole thing into the script and not worry about the common events but I'm not a scripter. It would be nice if someone did that, but this isn't a request thread. I just want to know why the common event isn't being called from the script.

I think that's everything. Thanks in advance guys good luck!
 
Ran a test...

It DOES call your Common Event... but only once per battle.

I mean, I created a common event that merely added '1' to a simple RMXP variable and made a simple event that told me how large that variable was. I figured that if Aluxes hit a monster 4 times... it shoulda been '4'.

It wasn't. It was '1'

Fought another battle, hit a monster 5 more times... I got '2'. And so on and so forth.

To be truthful.... ya got me on this one.
 
The problem, I think, is that the common event can only be called from the map o.O
Try having it turn on a switch instead, and having a battle event do the MP thing or call the common event.
Or just use $game_actors[1].mp += whatever
...I think >.>;
 
DerVVulfman;198054 said:
Ran a test...

It DOES call your Common Event... but only once per battle.

I mean, I created a common event that merely added '1' to a simple RMXP variable and made a simple event that told me how large that variable was. I figured that if Aluxes hit a monster 4 times... it shoulda been '4'.

It wasn't. It was '1'

Fought another battle, hit a monster 5 more times... I got '2'. And so on and so forth.

To be truthful.... ya got me on this one.
Hm weird. When I test, no matter how many times I attack it doesn't work. I tested on a monster with like 9999 HP and I counted 20 hits and no common event happened. And I even simplified the common event so literally the only thing it does is add a specific amount of MP. Still nothing happened.

The problem, I think, is that the common event can only be called from the map o.O
Try having it turn on a switch instead, and having a battle event do the MP thing or call the common event.
Or just use $game_actors[1].mp += whatever
...I think >.>;
See but the thing is I had this exact thing working in the DBS. I just created a brand new game and put this into Scene_Battle 4, starting at line 211:

Code:
      # Apply normal attack results
      for target in @target_battlers
        target.attack_effect(@active_battler)
      end
[COLOR=Red]        if @active_battler == $game_actors[1]
          [U]@common_event_id = 1[/U]
        end[/COLOR]
      return
    end
Also I just noticed: see the part that's underlined? In the DBS it only works if I use "@common_event_id" as opposed to "$game_temp.common_event_id". But neither of them work for the RTAB apparently.

Also, I tried to make it turn on a switch, but again, it wouldn't activate the common event. And the problem with using a battle event is that the characters are only supposed to gain MP when they perform an attack, not automatically every turn.

Also Jaberwoky I tried out the "$game_actors[1].mp +=" suggestion. And of course, it doesn't work in the RTAB, but it works in the DBS ugh.
 
Okay, I got it to work. RTAB is weird and likes to use its own syntax or whatever the word is. Instead of using "$game_temp.common_event_id =" it uses "battler.event =" to read common events (also the same situation for how the DBS only works if "@common_event_id" is used). It's weird. Anyways, thanks for the help Jaberwoky and DerWulfman, I really appreciate it.

So just to clarify, my code now looks like this:

Code:
        if battler = $game_actors[1]
          battler.event = 1
        end

Thanks again.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top