Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Timed Hit script error
Xeto
post Dec 1 2012, 12:28 AM
Post #1



Group Icon

Group: Member
Posts: 3
Type: None
RM Skill: Undisclosed




I'm using Zephren's Timed Hit script [which can be found here http://houseslashers.b1.jcink.com/index.php?showtopic=116 ] and have been running into a strange problem.

Problem is, when I use a skill like remedy [anything that removes status effects] or I use a skill that would cause a status effect, it says "Script 'Timed Hit 1' line 38: TypeError occurred. String can't be coerced into fixnum" then closes.

Line 38 is this part: "Integer((@timed_hit_hit_percent * self.damage) / 100.0)"

Strangely when I add power to the skills that give or cure status effects and make it cause damage it works fine without the error.

Though obviously I don't want to get hurt every time I use a remedy skill.

Here is the whole script in case anyone can see why this is happening:

class Game_Battler
attr_accessor :timed_hit_hit_percent
attr_accessor :timed_hit_use_percent
attr_accessor :timed_hit_state_to_add

alias timed_hit_attack_effect attack_effect
def attack_effect(attacker)
if @timed_hit_use_percent
hp = self.hp

timed_hit_attack_effect(attacker)

if self.damage != "Miss"
self.hp = hp
self.damage = Integer((@timed_hit_hit_percent * self.damage) / 100.0)
self.hp -= Integer(self.damage)
if @timed_hit_state_to_add != nil
self.add_state(@timed_hit_state_to_add)
end
end
elsif attacker.is_a?(Game_Enemy)
timed_hit_attack_effect(attacker)
end

@timed_hit_use_percent = false
@timed_hit_state_to_add = nil
end

alias timed_hit_skill_effect skill_effect
def skill_effect(user, skill)
if @timed_hit_use_percent
hp = self.hp

timed_hit_skill_effect(user, skill)

if self.damage != "Miss"
self.hp = hp
self.damage = Integer((@timed_hit_hit_percent * self.damage) / 100.0)
self.hp -= Integer(self.damage)
end
elsif user.is_a?(Game_Enemy)
timed_hit_skill_effect(user, skill)
end

@timed_hit_use_percent = false
end
end

Go to the top of the page
 
+Quote Post
   
Shaddow
post Dec 1 2012, 12:39 AM
Post #2


The Eventer Inventor
Group Icon

Group: Local Mod
Posts: 1,250
Type: Event Designer
RM Skill: Masterful
Rev Points: 90




This actually belongs in the script support section, I'll gladly move that over for you so you can get the help you are looking for.


__________________________




I support these projects! -------------





Go to the top of the page
 
+Quote Post
   
Xeto
post Dec 1 2012, 01:06 AM
Post #3



Group Icon

Group: Member
Posts: 3
Type: None
RM Skill: Undisclosed




QUOTE (Shaddowval @ Dec 1 2012, 12:39 AM) *
This actually belongs in the script support section, I'll gladly move that over for you so you can get the help you are looking for.


Oh, that was stupid of me - thank you smile.gif
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Dec 1 2012, 10:44 AM
Post #4


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




Try replacing this
CODE
if self.damage != "Miss"

with this:
CODE
if self.damage.is_a?(Numeric)

I don't know if this will fix the problem, however there's a high chance it could be the solution.
I think that skills which give status has a damage expressed by the blank string "" which is different from "Miss" but isn't a number.
This could cause that script crisis.

I hope this can help,

Jens


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   
Xeto
post Dec 1 2012, 01:20 PM
Post #5



Group Icon

Group: Member
Posts: 3
Type: None
RM Skill: Undisclosed




QUOTE (Jens of Zanicuud @ Dec 1 2012, 10:44 AM) *
Try replacing this
CODE
if self.damage != "Miss"

with this:
CODE
if self.damage.is_a?(Numeric)

I don't know if this will fix the problem, however there's a high chance it could be the solution.
I think that skills which give status has a damage expressed by the blank string "" which is different from "Miss" but isn't a number.
This could cause that script crisis.

I hope this can help,

Jens


Thank you!!!

This fixed the problem, I seriously love you!
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 02:20 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker