"COUNTER" MECHANIC
Posts
Pages:
1
I would like to know if I properly coded this so that certain items give you "counter", where enemies take damage based on their own attack power.
Here is the code:
def make_attack_damage_value(attacker)
damage = attacker.atk * 4 - self.def * 2 # base calculation
if self.element_set.include?(18)
then
damage = attacker.atk
damage = apply_variance(damage, 20) # variance
@hp_damage = damage
it at least didn't bust my game, so that's a start.
But, will it serve my purpose?
Thanks to all who help!
-Beakmanthegreat
Here is the code:
def make_attack_damage_value(attacker)
damage = attacker.atk * 4 - self.def * 2 # base calculation
if self.element_set.include?(18)
then
damage = attacker.atk
damage = apply_variance(damage, 20) # variance
@hp_damage = damage
it at least didn't bust my game, so that's a start.
But, will it serve my purpose?
Thanks to all who help!
-Beakmanthegreat
So, do you mean an actual counter attack where the person being attacked will process the full action of an attack against the monster that him them, or just "reflect damage" mechanic that will reflect a portion of the damage dealt to that character back to the monster?
I meant a type of damage reflection based on the original monsters attack power, not how much damage they deal.
if rand(200)> self.element_rate(18) #Determine if counter
user.hp- = attacker.atk * 1 - self.def * 0 #Do damage
end
Would THIS work?
user.hp- = attacker.atk * 1 - self.def * 0 #Do damage
end
Would THIS work?
post=97516
if rand(200)> self.element_rate(18) #Determine if counter
user.hp- = attacker.atk * 1 - self.def * 0 #Do damage
end
Would THIS work?
Change the second line to :
user.hp -= user.atkand it'll work. You can keep the "* 1 - self.def * 0" part, but it's useless.
if self.states_include?(24) #Determine if counter
user.hp- = attacker.atk * 1 - self.def * 0 #Do damage
So would this work If I would rather it work based on a state than an element?
Also, How would I force an armor to give an actor a state when equipped?
user.hp- = attacker.atk * 1 - self.def * 0 #Do damage
So would this work If I would rather it work based on a state than an element?
Also, How would I force an armor to give an actor a state when equipped?
post=97520
if self.states_include?(24) #Determine if counter
user.hp- = attacker.atk * 1 - self.def * 0 #Do damage
So would this work If I would rather it work based on a state than an element?
Also, How would I force an armor to give an actor a state when equipped?
if @states.include?(24)This'll do what you're trying to get to work, assuming you want the one to counterattack to be the one with the state. "attacker.atk" won't work. I can vaguely guess it has to do with "def execute_damage(user)" mentioning "user", but I still don't completely understand.
user.hp -= user.atk
end
A problem I've encountered with this counterattack method is that if a monster's HP reaches 0 through a "counterattack", it'll die but its image will still be there. Thus, I suggest you to find an actual counterattack script through Google or something. :(
As for the auto-state through armor thing, there's probably a script for that. I briefly looked through the editor and it doesn't seem to be a way to do it directly through it. You could do it with events, but copying & pasting a script would seem much easier.
Editz0rz: Google found this for me: http://www.rpgrevolution.com/forums/index.php?showtopic=14981&st=0
It seemingly allows a character to counterattack if they have a skill. I don't know if it activates passively or if you have to activate it since I did not try it. You're apparently required to register before you can view it though.
Pages:
1














