Jump to content
Sign in to follow this  
EXVA

Script Editing For RPG MAKER ACE.

Recommended Posts

Posted (edited)

EDIT, I've found a work around with a different script, Alistair's-Critical Hit, adds damage to the state & I can have an equip apply state.

 

I finally managed to find a critical damage script, had to search forever for this one cause the OG SITE's is Code Messed Up.

 

Anyways, I was wondering if it was possible to edit the additional ARMOR NOTETAG to this script, Weapons work fine but

I need armor in my game that boosts critical damage dealt, I known this is a big ask & I already tried replacing All Weapon Entries with Armor but it didn't work.

I lack the needed scripting skills to make the needed edit.

Edited by EXVA

Share this post


Link to post
Share on other sites
Posted (edited)
Spoiler

#Critical Effects and Multipliers
#----------#
#Features: Provides the ability to tweak the damage modifier of critical hits for
#   skills, weapons, classes, actors, and monsters, as well as determining
#   if they apply specific states (i.e critical hit means instant death)
#
#Usage: Place any of the following into the note boxes of skills, weapons, armor,
#   classes, actors, or monsters:
#   <crit multiplier [multiplier]>  
# - [multiplier] is the percent difference in damage, can be any number
#   <crit state[#] [state id]>
# - [#] is 1-4, allowing one notebox to apply 4 states
# - [state id] is the id# of the state to be applied
#
#Examples: <crit multiplier 1000>
#   <crit state1 2>
#   <crit state2 6>
#
#Game hangs or freezes up? Check the noteboxes related to last used skill for
# a missing ">"
#----------#
#-- Script by: V.M of D.T
#--- Free to use in any project with credit given


class Game_Battler
  alias crit_effect_make_damage_value make_damage_value
  alias crit_effect_execute_damage execute_damage
  alias crit_apply_critical apply_critical
  def make_damage_value(user, item)
		@crit_item = item
		@crit_target = user
		crit_effect_make_damage_value(user, item)
  end
  def apply_critical(damage)
		damage = crit_apply_critical(damage)
		damage = apply_actor_multiplier(damage)
		damage = apply_class_multiplier(damage)
		damage = apply_armor_multiplier(damage)
		damage = apply_weapon_multiplier(damage) if @crit_item.physical?
		damage = apply_skill_multiplier(damage)
  end
  def execute_damage(user)
		crit_effect_execute_damage(user)
		crit_apply_state if @result.critical
  end
  def apply_multiplier(note, start, damage)
		ends = start
		while ends != "banana"
			if note[ends] == ">" or note[ends] == '\n' then break end
			ends += 1
		end
		ends -= 1
		damage * (1 + (note[start..ends].to_f / 100.0))
  end
  def apply_skill_multiplier(damage)
		note = $data_skills[self.attack_skill_id].note
		if note.index('<crit multiplier') == nil then return damage end
		start = note.index('<crit multiplier') + 17
		apply_multiplier(note, start, damage)
	end
  def apply_actor_multiplier(damage)
		if @crit_target.is_a?(Game_Actor)
			note = $data_actors[@crit_target.id].note
		else
			note = $data_enemies[@crit_target.enemy_id].note
		end
		if note.index('<crit multiplier') == nil then return damage end
		start = note.index('<crit multiplier') + 17
		apply_multiplier(note, start, damage)
  end
  def apply_class_multiplier(damage)
		if @crit_target.is_a?(Game_Actor)
			note = $data_classes[@crit_target.class_id].note
			if note.index('<crit multiplier') == nil then return damage end
			start = note.index('<crit multiplier') + 17
			apply_multiplier(note, start, damage)
		else
			damage
		end
  end
	def apply_armor_multiplier(damage)
    if @crit_target.is_a?(Game_Actor)
		for i in 2..@crit_target.equips.size - 1
	      if @crit_target.equips[i] != nil
			note = $data_armors[@crit_target.equips[i].id].note
		  else
			note = ""
		  end
			if note.index('<crit multiplier') == nil then return damage end
			start = note.index('<crit multiplier') + 17
			apply_multiplier(note, start, damage)
        end
	else
		damage
	end
  end
  def apply_weapon_multiplier(damage)
		if @crit_target.is_a?(Game_Actor)
			if @crit_target.equips[0] != nil
				note = $data_weapons[@crit_target.equips[0].id].note
			else
				note = ""
			end
			if note.index('<crit multiplier') == nil then return damage end
			start = note.index('<crit multiplier') + 17
			apply_multiplier(note, start, damage)
		else
			damage
		end
  end
  def crit_apply_state
		@states_apply = []
		note = $data_skills[self.attack_skill_id].note
		push_apply_states(note)
		if @crit_target.is_a?(Game_Actor)
			note = $data_actors[@crit_target.id].note
		else
			note = $data_enemies[@crit_target.enemy_id].note
		end
		push_apply_states(note)
		if @crit_target.is_a?(Game_Actor)
			note = $data_classes[@crit_target.class_id].note
			push_apply_states(note)
		end
		if @crit_target.is_a?(Game_Actor)
			if @crit_target.equips[0] != nil
				note = $data_weapons[@crit_target.equips[0].id].note
			else
				note = ""
			end
			push_apply_states(note)
		end
		for i in @states_apply
			self.add_state(i)
		end
  end
  def push_apply_states(note)
		for i in Range.new(1,5)
			if note.index('<crit state' + i.to_s) != nil
				get_start_end(note, i)
				@states_apply.push(note[@start..@ends].to_i)
			end
		end
  end
  def get_start_end(note, i)
		start = note.index('<crit state' + i.to_s) + 13
		ends = start
		while ends != "banana"
			if note[ends] == ">" or note[ends] == "\n" then break end
			ends += 1
		end
		@start = start
		@ends = ends - 1
  end
end

 

 

Edited by roninator2

Share this post


Link to post
Share on other sites
Posted (edited)

Its close, I believe, but not dice,  the

note = $data_armors[@crit_target.class_id].note

 

the target.class might be whats holding it back, I think it needs a .equip[0] like the weapon not sure I'll mess around with it abit.

 

Edit Nope,  Didn't work trying this either. hmm, maybe it just wasn't meant to be.

 

def apply_armor_multiplier(damage)
        if @crit_target.is_a?(Game_Actor)
          if @crit_target.equips[0] != nil
                    note = $data_armors[@crit_target.equips[0].id].note
        else
                note = ""
    end
      if note.index('<crit multiplier') == nil then return damage end
            start = note.index('<crit multiplier') + 17
            apply_multiplier(note, start, damage)
    else
            damage
        end
  end

Edited by EXVA

Share this post


Link to post
Share on other sites

Got it to work with this.

 

def apply_armor_multiplier(damage)
        if @crit_target.is_a?(Game_Actor)
            if @crit_target.equips[6] != nil
                note = $data_armors[@crit_target.equips[6].id].note
            else
                note = ""
            end
            if note.index('<crit multiplier') == nil then return damage end
            start = note.index('<crit multiplier') + 17
            apply_multiplier(note, start, damage)
        else
            damage
        end
  end

 

You have to add it to the right slots, aka I have amulet in slot 6 so 6 worked I believe, so I'll have to add this 6-7 times to cover all 8 of my custom slots.

 

THX SO MUCH FOR THE BRAINSTORMING!

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, EXVA said:

I think it needs a .equip[0] like the weapon

You're right, I didn't even think about it much or look at the weapon example (which only accounts for single handed weapons.

I updated the script above with a version that may go through each armor slot

Give that a test.

And is there a link to the other page you mentioned OG SITE?

Edited by roninator2

Share this post


Link to post
Share on other sites
Posted (edited)
Spoiler

class Game_Battler
  alias crit_effect_make_damage_value make_damage_value
  alias crit_effect_execute_damage execute_damage
  alias crit_apply_critical apply_critical
  def make_damage_value(user, item)
        @crit_item = item
        @crit_target = user
        crit_effect_make_damage_value(user, item)
  end
  def apply_critical(damage)
        damage = crit_apply_critical(damage)
        damage = apply_actor_multiplier(damage)
        damage = apply_class_multiplier(damage)
        damage = apply_armor_multiplier(damage)
        damage = apply_weapon_multiplier(damage) if @crit_item.physical?
        damage = apply_skill_multiplier(damage)
  end
  def execute_damage(user)
        crit_effect_execute_damage(user)
        crit_apply_state if @result.critical
  end
  def apply_multiplier(note, start, damage)
        ends = start
        while ends != "banana"
            if note[ends] == ">" or note[ends] == '\n' then break end
            ends += 1
        end
        ends -= 1
        damage * (1 + (note[start..ends].to_f / 100.0))
  end
  def apply_skill_multiplier(damage)
        note = $data_skills[self.attack_skill_id].note
        if note.index('<crit multiplier') == nil then return damage end
        start = note.index('<crit multiplier') + 17
        apply_multiplier(note, start, damage)
    end
  def apply_actor_multiplier(damage)
        if @crit_target.is_a?(Game_Actor)
            note = $data_actors[@crit_target.id].note
        else
            note = $data_enemies[@crit_target.enemy_id].note
        end
        if note.index('<crit multiplier') == nil then return damage end
        start = note.index('<crit multiplier') + 17
        apply_multiplier(note, start, damage)
  end
  def apply_class_multiplier(damage)
        if @crit_target.is_a?(Game_Actor)
            note = $data_classes[@crit_target.class_id].note
            if note.index('<crit multiplier') == nil then return damage end
            start = note.index('<crit multiplier') + 17
            apply_multiplier(note, start, damage)
        else
            damage
        end
  end

    
  def apply_armor_multiplier(damage)
        if @crit_target.is_a?(Game_Actor)
      if @crit_target.equips[6]!= nil
         note = $data_armors[@crit_target.equips[6].id].note
         else
      if @crit_target.equips[7]!= nil
         note = $data_armors[@crit_target.equips[7].id].note
                     else
                note = ""
            end
      end
            if note.index('<crit multiplier') == nil then return damage end
            start = note.index('<crit multiplier') + 17
            apply_multiplier(note, start, damage)
        else
            damage
        end
    end
    

  def apply_weapon_multiplier(damage)
        if @crit_target.is_a?(Game_Actor)
            if @crit_target.equips[0] != nil
                note = $data_weapons[@crit_target.equips[0].id].note
            else
                note = ""
            end
            if note.index('<crit multiplier') == nil then return damage end
            start = note.index('<crit multiplier') + 17
            apply_multiplier(note, start, damage)
        else
            damage
        end
  end
  
  def crit_apply_state
        @states_apply = []
        note = $data_skills[self.attack_skill_id].note
        push_apply_states(note)
        if @crit_target.is_a?(Game_Actor)
            note = $data_actors[@crit_target.id].note
        else
            note = $data_enemies[@crit_target.enemy_id].note
        end
        push_apply_states(note)
        if @crit_target.is_a?(Game_Actor)
            note = $data_classes[@crit_target.class_id].note
            push_apply_states(note)
        end
        if @crit_target.is_a?(Game_Actor)
            if @crit_target.equips[0] != nil
                note = $data_weapons[@crit_target.equips[0].id].note
            else
                note = ""
            end
            push_apply_states(note)
        end
        for i in @states_apply
            self.add_state(i)
        end
  end
  def push_apply_states(note)
        for i in Range.new(1,5)
            if note.index('<crit state' + i.to_s) != nil
                get_start_end(note, i)
                @states_apply.push(note[@start..@ends].to_i)
            end
        end
  end
  def get_start_end(note, i)
        start = note.index('<crit state' + i.to_s) + 13
        ends = start
        while ends != "banana"
            if note[ends] == ">" or note[ends] == "\n" then break end
            ends += 1
        end
        @start = start
        @ends = ends - 1
  end
end

 

Edited by EXVA

Share this post


Link to post
Share on other sites

Being Able to expand functionally in a game is important, thats whymost buffs/

modifiers should apply to all places equally so you can craft the best custom gear.

Share this post


Link to post
Share on other sites
20 minutes ago, EXVA said:

should apply to all places equally

Well try this if you want to. Tried to account for dual wield.

Spoiler

#Critical Effects and Multipliers
#----------#
#Features: Provides the ability to tweak the damage modifier of critical hits for
#   skills, weapons, classes, actors, and monsters, as well as determining
#   if they apply specific states (i.e critical hit means instant death)
#
#Usage: Place any of the following into the note boxes of skills, weapons, armor,
#   classes, actors, or monsters:
#   <crit multiplier [multiplier]>  
# - [multiplier] is the percent difference in damage, can be any number
#   <crit state[#] [state id]>
# - [#] is 1-4, allowing one notebox to apply 4 states
# - [state id] is the id# of the state to be applied
#
#Examples: <crit multiplier 1000>
#   <crit state1 2>
#   <crit state2 6>
#
#Game hangs or freezes up? Check the noteboxes related to last used skill for
# a missing ">"
#----------#
#-- Script by: V.M of D.T
#--- Free to use in any project with credit given


class Game_Battler
  alias crit_effect_make_damage_value make_damage_value
  alias crit_effect_execute_damage execute_damage
  alias crit_apply_critical apply_critical
  def make_damage_value(user, item)
		@crit_item = item
		@crit_target = user
		crit_effect_make_damage_value(user, item)
  end
  def apply_critical(damage)
		damage = crit_apply_critical(damage)
		damage = apply_actor_multiplier(damage)
		damage = apply_class_multiplier(damage)
		damage = apply_armor_multiplier(damage)
		damage = apply_weapon_multiplier(damage) if @crit_item.physical?
		damage = apply_skill_multiplier(damage)
  end
  def execute_damage(user)
		crit_effect_execute_damage(user)
		crit_apply_state if @result.critical
  end
  def apply_multiplier(note, start, damage)
		ends = start
		while ends != "banana"
			if note[ends] == ">" or note[ends] == '\n' then break end
			ends += 1
		end
		ends -= 1
		damage * (1 + (note[start..ends].to_f / 100.0))
  end
  def apply_skill_multiplier(damage)
		note = $data_skills[self.attack_skill_id].note
		if note.index('<crit multiplier') == nil then return damage end
		start = note.index('<crit multiplier') + 17
		apply_multiplier(note, start, damage)
	end
  def apply_actor_multiplier(damage)
		if @crit_target.is_a?(Game_Actor)
			note = $data_actors[@crit_target.id].note
		else
			note = $data_enemies[@crit_target.enemy_id].note
		end
		if note.index('<crit multiplier') == nil then return damage end
		start = note.index('<crit multiplier') + 17
		apply_multiplier(note, start, damage)
  end
  def apply_class_multiplier(damage)
		if @crit_target.is_a?(Game_Actor)
			note = $data_classes[@crit_target.class_id].note
			if note.index('<crit multiplier') == nil then return damage end
			start = note.index('<crit multiplier') + 17
			apply_multiplier(note, start, damage)
		else
			damage
		end
  end
	def apply_armor_multiplier(damage)
    if @crit_target.is_a?(Game_Actor)
			if dual_wield? && weapons[1].is_a?(RPG::Weapon)
        for i in 2..@crit_target.equips.size - 1
          if @crit_target.equips[i] != nil
            note = $data_armors[@crit_target.equips[i].id].note
          else
            note = ""
          end
          if note.index('<crit multiplier') == nil then return damage end
          start = note.index('<crit multiplier') + 17
          apply_multiplier(note, start, damage)
        end
      else
        for i in 1..@crit_target.equips.size - 1
          if @crit_target.equips[i] != nil
            note = $data_armors[@crit_target.equips[i].id].note
          else
            note = ""
          end
          if note.index('<crit multiplier') == nil then return damage end
          start = note.index('<crit multiplier') + 17
          apply_multiplier(note, start, damage)
        end
      end
		else
			damage
		end
  end
  def apply_weapon_multiplier(damage)
		if @crit_target.is_a?(Game_Actor)
			if dual_wield? && weapons[1].is_a?(RPG::Weapon)
        for i in 0..1
          if @crit_target.equips[i] != nil
            note = $data_weapons[@crit_target.equips[i].id].note
          else
            note = ""
          end
          if note.index('<crit multiplier') == nil then return damage end
          start = note.index('<crit multiplier') + 17
          apply_multiplier(note, start, damage)
       end
      else
        if @crit_target.equips[0] != nil
          note = $data_weapons[@crit_target.equips[0].id].note
        else
          note = ""
        end
        if note.index('<crit multiplier') == nil then return damage end
        start = note.index('<crit multiplier') + 17
        apply_multiplier(note, start, damage)
      end
		else
			damage
		end
  end
  def crit_apply_state
		@states_apply = []
		note = $data_skills[self.attack_skill_id].note
		push_apply_states(note)
		if @crit_target.is_a?(Game_Actor)
			note = $data_actors[@crit_target.id].note
		else
			note = $data_enemies[@crit_target.enemy_id].note
		end
		push_apply_states(note)
		if @crit_target.is_a?(Game_Actor)
			note = $data_classes[@crit_target.class_id].note
			push_apply_states(note)
		end
		if @crit_target.is_a?(Game_Actor)
			if @crit_target.equips[0] != nil
				note = $data_weapons[@crit_target.equips[0].id].note
			else
				note = ""
			end
			push_apply_states(note)
		end
		for i in @states_apply
			self.add_state(i)
		end
  end
  def push_apply_states(note)
		for i in Range.new(1,5)
			if note.index('<crit state' + i.to_s) != nil
				get_start_end(note, i)
				@states_apply.push(note[@start..@ends].to_i)
			end
		end
  end
  def get_start_end(note, i)
		start = note.index('<crit state' + i.to_s) + 13
		ends = start
		while ends != "banana"
			if note[ends] == ">" or note[ends] == "\n" then break end
			ends += 1
		end
		@start = start
		@ends = ends - 1
  end
end

 

 

Share this post


Link to post
Share on other sites

Its so nice to see coders still around to help people with this soft of stuff for ACE.

I dabble, with edits but I couldn't actually write code thats for sure, but I've systematically

hacked apart & pieced all my game scripts to function next to each other its insane as I

got some wicked script combos that just shouldn't be compatible period with each other.

 

BUT NOW IF YOU CAN ONLY HELP ME WITH MY OTHER TOPIC LOL JK! 

Share this post


Link to post
Share on other sites
11 minutes ago, EXVA said:

I couldn't actually write code thats for sure,

I can't say I'm a coder at all even though my college background is programming. I am usually quite skilled at modifying something somebody else wrote. Within reason. I don't know everything about ruby or RGSS.

Happy to help (if it works)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted