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.

Easy Request

Can someone compose a custom script for me to enable common events to be triggered before the execution of a skill?
If there could be a way to assign this script to specific skills, that would be great.
I don't think that this will be too hard.
Thanks.
 
Here you go:

Code:
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Make Skill Action Results
  #--------------------------------------------------------------------------
  def make_skill_action_result
    # Get skill
    @skill = $data_skills[@active_battler.current_action.skill_id]
    # If not a forcing action
    unless @active_battler.current_action.forcing
      # If unable to use due to SP running out
      unless @active_battler.skill_can_use?(@skill.id)
        # Clear battler being forced into action
        $game_temp.forcing_battler = nil
        # Shift to step 1
        @phase4_step = 1
        return
      end
    end
    # Use up SP
    @active_battler.sp -= @skill.sp_cost
    # Refresh status window
    @status_window.refresh
    # Show skill name on help window
    @help_window.set_text(@skill.name, 1)
    # Set animation ID
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # Set command event ID
    @common_event_id = @evented ? 0 : @skill.common_event_id
    @evented = !@evented and @common_event_id != 0
    update_phase4_step6
    @phase4_step = 2
    return if @evented
    # Set target battlers
    set_target_battlers(@skill.scope)
    # Apply skill effect
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
  end
end

I hope that works.
 

Atoa

Member

@rey meustrus
the code you made only adds the common event to the list of common events to be executed. but
it executed only in the update, after all the update_phase4 methods.

an way to make this would be creatin an method like "update basic" from VX.
to update the common event and graphics before ending the method "make_skill_action_result"

but i'm really busy to try make it now '-'
 

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