Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Aqua on July 13, 2009, 05:40:41 pm

Title: [XP]Request - Reflect Physical Attack State
Post by: Aqua on July 13, 2009, 05:40:41 pm
Rawr!

Anyone be willing to make a script that allows for states to reflect a certain % of physical attacks (including physical skills) back at the attacker?

So if Giant Blob attacks Arshes who has state with reflection of 1%...
Giant Blob deals 10,000 damage to Arshes.
Arshes's state reflects 100 damage back to the Giant Blob.

(Then Arshes dies because I said so.)

Compatible with DBS pu-lease =X

Thaaaaaaaaaaank youuuuuuuuuuuu! :D


(Lolz I hate making request topics... I sound so weird D:)
Title: Re: [XP]Request - Reflect Physical Attack State
Post by: Punn on July 14, 2009, 03:02:56 pm
Already made, SD-fails, so you know the drill.

Spoiler: ShowHide

#==========================================================================
# ** SG Counter Attack
#==========================================================================
# sandgolem
# Version 2
# 2.07.06
#==========================================================================

Scene_Battle::SG_Counter_States = { 74 => [100,100] }
Scene_Battle::SG_Counter_Messages = ['Counter!']

#==========================================================================
#
# To check for updates or find more scripts, visit:
# http://www.gamebaker.com/rmxp/scripts/
#
# To use this script, copy it and insert it in a new section above "Main",
# under the default scripts, and the SDK if you're using it.
#
# Have problems? Official topic:
#   http://forums.gamebaker.com/showthread.php?t=129
#
#==========================================================================

begin
 SDK.log('SG Counter Attack', 'sandgolem', 2, '2.07.06')
 if SDK.state('SG Counter Attack') != true
   @sg_counterattack_disabled = true
 end
 rescue
end

if !@sg_counterattack_disabled
#--------------------------------------------------------------------------
 
class Game_Battler
 alias sandgolem_counter_battler_atkeff attack_effect
 def attack_effect(attacker)
   sandgolem_counter_battler_atkeff(attacker)
   if $scene.active_battler == attacker
     $scene.sg_atkcounter_test(self)
   end
 end
end

class Scene_Battle
 attr_accessor :active_battler
 
 def sg_atkcounter_test(battler)
   sg_temp = SG_Counter_States.keys
   for i in 0...sg_temp.size
     if battler.state?(sg_temp[i])
       if SG_Counter_States[sg_temp[i]][0] > rand(99)
         @sg_counter = SG_Counter_States[sg_temp[i]][1]
         @sg_countertarget = battler
         return
       end
     end
   end
 end
 
 alias sandgolem_counter_battle_up4s5 update_phase4_step5
 def update_phase4_step5
   sandgolem_counter_battle_up4s5
   if @sg_countertarget != nil
     @phase4_step = 1337
     @sg_atkcounter = 28
   end
 end
 
 def sg_counter_update
   if @sg_countertarget.dead? or @sg_atkcounter == 0
     @sg_atkcounter = nil
     @sg_counter = nil
     @sg_countertarget = nil
     @phase4_step = 6
     return
   end
   @sg_atkcounter -= 1
   if @sg_atkcounter == 10
     @sg_countertarget.animation_id = @sg_countertarget.animation1_id
     @active_battler.animation_id = @sg_countertarget.animation2_id
     sg_temp = rand(SG_Counter_Messages.size)
     sg_temp = SG_Counter_Messages[sg_temp].clone
     sg_temp.gsub!(/\\[Mm]/) { @sg_countertarget.name }
     @help_window.set_text(sg_temp, 1)
     @active_battler.attack_effect(@sg_countertarget)
     if !@active_battler.damage.is_a?(String)
       @active_battler.hp += @active_battler.damage
       @active_battler.damage = @active_battler.damage * @sg_counter / 100
       @active_battler.hp -= @active_battler.damage
       @status_window.refresh
     end
     @active_battler.damage_pop = true
   end
 end
 
 alias sandgolem_counter_battle_update update
 def update
   if @sg_atkcounter != nil
     sg_counter_update
   end
   sandgolem_counter_battle_update
 end
end

#--------------------------------------------------------------------------
end
Title: Re: [XP]Request - Reflect Physical Attack State
Post by: Aqua on July 14, 2009, 04:48:52 pm
That script /requires/ the SDK rewrites; it doesn't work even with taking out the SDK checker
Title: Re: [XP]Request - Reflect Physical Attack State
Post by: Blizzard on July 15, 2009, 05:10:46 am
And besides: Missing code tags fail.
Title: Re: [XP]Request - Reflect Physical Attack State
Post by: Punn on July 23, 2009, 05:34:05 pm
Thats why I said SD-Fails.