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
> Found a strange bug with rmxp default script
Vexus
post Jan 22 2012, 06:05 AM
Post #1


Level 19
Group Icon

Group: Revolutionary
Posts: 394
Type: Mapper
RM Skill: Intermediate




So was experimenting with status effects and tried to do one that reduces your hit rate by 5% (So written 95 in hit rate) and made it as auto status on a shield strangely enough if you try to fight with a status effect like this ALL your skills will miss 100% of the times O.o

Kinda strange as I wanted to add some pieces that reduced accuracy :/

[Edit]

Thanks to Jens of Zanicuud now it's solved was a mistake of enterbrain.

QUOTE
Game_Battler 3, line 120

Replace this

CODE
hit *= user.hit / 100


with this:

CODE
hit = hit * user.hit / 100


It's just weird but this is Enterbrain's fault...

Jens


So everyone can fix it if they intend to add status effects on armour that reduces hit rate.

This post has been edited by Vexus: Jan 22 2012, 06:15 AM


__________________________
Current Project/s:
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Jan 22 2012, 06:16 AM
Post #2


Dark Jentleman
Group Icon

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




Maybe it should result useful if I post what I found...

It's RGSS core scripts' fault.

Game_Battler 3, line 120.

CODE
hit *= user.hit/100


This means that if user.hit < 100, user.hit/100 will result in 0 (Amazing but true and tested! Divisions between integers result in zero if the dividend is lesser than the divisor, and user.hit is an integer! So, e.g. 95/100 = 0 in every programming language!)

Two ways to fix this horror:

1. replace line 120 with this:

CODE
hit = hit * user.hit/100


or with this

2.

CODE
hit *=user.hit/100.0


And the problem is fixed.
Basic variables operation smile.gif

100.0 is treated as a float and 95/100.0 is equal to 0.95 smile.gif

Jens

This post has been edited by Jens of Zanicuud: Jan 22 2012, 06:21 AM


__________________________
"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
   

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: 19th May 2013 - 04:43 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker