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.

Calling a common event from a script - how to do?

I'm working on a modification to the RMXP default battle system. As part of my modification, I've been trying to detach the basic attack command from its normal behavior, so that I can have more control over what it does. My idea was to use a cloned copy of the battler3 script with my mods for calculating damage in it, then pass those via variable to a common event (the first one in the common events tab) that would carry out the 'show animation' and 'deal damage' portions of the effect.

I've gotten this to work loosely; using an actual attack does nothing, and setting the common event to trigger at the beginning of a turn shows that the variables are being set, and damage dealt and displayed* properly, but I can't figure out how to call the common event from inside the script itself - until I can figure out how to do that, my system won't work right.

I only loosely (if that) have any clue how what I want to do is supposed to work. Below is the code for my version of this attempt. (I've set the variables I wanted earlier, and the 'official' attack action has been commented out.)

Code:
 

#-------------------------------------------------------------------------------

#Begin: Place Alternate (Common Event Call) Battle Damage effects

#-------------------------------------------------------------------------------

      # Get common event

      common_event = $data_common_events[0]

      # If common event is valid

      if common_event != nil

        # Make child interpreter

        @child_interpreter = Interpreter.new(@depth + 1)

        @child_interpreter.setup(common_event.list, @event_id)

      end

#-------------------------------------------------------------------------------

#End: Place Alternate (Common Event Call) Battle Damage effects

#-------------------------------------------------------------------------------

 

Anyone have any suggestions for what I need to do to fix this? And if you do, would you please share them with me?


*I need to extend my thanks to Jaberwoky on these forums, who handled my questions regarding that.
 

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