[BABS] Exploding Objects

Started by KK20, December 09, 2012, 05:21:31 pm

Previous topic - Next topic

KK20

Blizz-ABS: Exploding Objects
Author: KK20




Introduction

Don't you know how in some games there are boxes (usually loaded with TNT or explosives of the like) that explode when damaged? Well how about using that feature in Blizz-ABS? Perhaps this can make some interesting games where, instead of using all your resources to take down a group of monsters, you only have to destroy this object to take them all out.



Step-By-Step Instructions

1.) Create a new skill in the RMXP project. Make this skill have the scope to attack 'All Enemies'. Also, adjust its damage and make its SP cost 0. Be sure that this skill does do damage. If, after defenses are calculated, the damage is 0 for all surrounding targets, the explosion animation will not play.

Open up the Blizz-ABS configuration and go to the Skills tab. Make it so that this new skill is a 'Direct/Shockwave' and define its range. Leave everything else alone.

2.) We must create a group to represent these exploding objects. Within the Blizz-ABS configuration application, go to Alignment Groups. Change the maximum to add a new group (go ahead and name it if you would like). Check the box to make it 'Lifeless'. Then, put 'Actors' and 'Enemies' as its enemies. Doing this will cause the explosion to damage these groups only. Thus, if you want to make a chain-reaction of explosions, make this group see itself as an enemy.

When you are done with that, be sure to edit the 'Actors' and 'Enemies' groups to see this new object as 'Fully Neutral'. That way, your allies and enemies won't focus on attacking these exploding objects.
Group Setup: ShowHide




3.) Copy this script and add it below the Blizz-ABS scripts:
Spoiler: ShowHide

class Map_Battler < Game_Character
 
  def use_skill(skill, forced = false, after_death = false)
    # remove last hpdamage and spdamage values
    @battler.hpdamage = @battler.spdamage = 0
    # if can use the skill
    if skill_can_use?(skill.id, forced, after_death)
      # get combo id
      combo_id = BlizzABS::Skills.combo(skill.id)
      # if combo id is valid and not currently in a combo
      if combo_id != 0 && @combo == nil
        # create combo
        @combo = BlizzABS::Combo.new(combo_id, self)
        # return used
        return true
      end
      # set last action
      @battler.last_action = ["skill", false]
      # execute skill
      result = $BlizzABS.skillitem_process(self, skill)
      # effectiveness
      effective = (result || charging? && !charged?)
      # if used or charging up and about to discharge
      if result
        # set frame penalty
        set_action(self.skill_penalty(skill.id))
        # skill consumption effect
        skill_consumption(skill)
        # call common event
        common_event_call(skill)
        # set usage animation
        set_usage_animation(skill)
        # set sprite animation
        set_sprite_animation(BlizzABS::SPRSkill, skill_sprites?, skill)
        # set up user damage display if necessary
        user_damage_display
        # reset action
        self.reset_action
      # if discharged
      elsif charging? && charged?
        # reset action
        self.reset_action
      end
      # effective
      return effective
    end
    # not used
    return false
  end
 
  alias call_babs_orig_use_skill use_skill
  def use_skill(skill, forced = false, after_death = false)
    if skill.is_a?(RPG::Skill)
      call_babs_orig_use_skill(skill, forced, after_death)
    else
      call_babs_orig_use_skill($data_skills[skill], forced, after_death)
    end
  end
 
  def skill_can_use?(id, forced = false, after_death = false)
    if (forced)
      # If low SP, incapacitated, or silent and non-physical, can't use
      return $data_skills[id].sp_cost <= @battler.sp && (!@battler.dead? || after_death)
         ($data_skills[id].atk_f != 0 || @battler.restriction != 1)
    end
    return @battler.skill_can_use?(id)
  end
end



4.) Create a dummy-enemy in your database. This enemy gives no EXP and items. Define its stats accordingly (i.e. give it low evasion and agility and high attack).

When creating this enemy on the map, give it a Name
\e[id1] \g[id2]
where id1 is the ID of your dummy-enemy in the database and id2 is the ID of the new group we created. Set its graphic to your exploding box.

For the Event Commands, use a 'Script' call and put in the following:

e = $game_map.events[@SELF]
e.use_skill(ID, true, true)
replacing ID with the exploding skill's ID in the database.
Event Setup: ShowHide
 


And that's all there is to it! Have fun~
Special thanks to Sin86 for requesting and suggesting I put this up.





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!