Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic Reply to topic  [ 9 posts ] 
    Neo-Bahamut
  Thu Jul 08, 2010 9:42 pm
User avatar
Member


Location: Germany
Improved Battle Codeby Neo-Bahamut aka Wurstinator

Hi :)
This is my "Improved Battle Code" script. It's a rewrite of most methods of the classes Game_Battler, Game_Actor, Game_Enemy, Game_BattleAction, Game_Party and Game_Troop. When you use it itself, without other battle addons or battle systems, you won't notice it.
It's only useful if your project has an ATB system or a well written ABS. It works like an Antilag script - just for battles :)
Actually, this script is pretty useless for everyone who isn't planning to write some battle addon script :D

Screenshots
Nothing to see here, move on.

Code
Expand to see the code.


Bugs and other insects
My script should work with the SDK.
I didn't test it much, so if someone uses this and finds a bug, contact me so I can repair it.

_________________
I don't have RMXP or RMVX installed on this computer so it's most unlikely that I can give you support to any of my scripts.


Last edited by Neo-Bahamut on Mon Jul 12, 2010 9:58 pm, edited 2 times in total.

Top Top
Profile      
 

    kyonides
  Thu Jul 08, 2010 11:05 pm
Member

Well, there are 2 things I could find... eh... not right...

First, you recreated 2 methods that already exist in Ruby and RGSS, since you didn't add any new functionality in those methods, there's no need to reimplement them. So get rid of Math.min and Math.max and use [0, 5].max or [4, 7].min or [[47, 75].min, 100].max instead.

The second thing would be not to create several

class Game_Actor
# some code
end

...when you know that you should only do that once, I mean, you just need to include all the new or reimplemented or modified methods in a single class (if they belong to Game_Actor, then they should be included in a single class Game_Actor end group or statement or declaration or whatever). That's also valid for all Constants and attr_reader or attr_accessor you might have included. There's no good reason to separate them.


Top Top
Profile      
 

    Neo-Bahamut
  Fri Jul 09, 2010 5:45 am
User avatar
Member


Location: Germany
Quote:
First, you recreated 2 methods that already exist in Ruby and RGSS, since you didn't add any new functionality in those methods, there's no need to reimplement them. So get rid of Math.min and Math.max and use [0, 5].max or [4, 7].min or [[47, 75].min, 100].max instead.

No, [0, 5].max is more than three times slower than Math.max(0, 5).

Quote:
...when you know that you should only do that once, I mean, you just need to include all the new or reimplemented or modified methods in a single class (if they belong to Game_Actor, then they should be included in a single class Game_Actor end group or statement or declaration or whatever). That's also valid for all Constants and attr_reader or attr_accessor you might have included. There's no good reason to separate them.

That's just because in the project script editor I differentiated between (non) SDK parts, constants and the normal code and I was too lazy to copy them all together :)
It doesn't really affect the code, except for maybe 0.0001 longer loading time at the beginning.

_________________
I don't have RMXP or RMVX installed on this computer so it's most unlikely that I can give you support to any of my scripts.


Top Top
Profile      
 

    silver wind
  Fri Jul 09, 2010 8:47 am
Chompil
User avatar
Member

could you give a list of changes ,
or explain why this version is faster?


Top Top
Profile      
 

    Neo-Bahamut
  Fri Jul 09, 2010 1:07 pm
User avatar
Member


Location: Germany
The list of changes is easy, just look at each method in the script :)
It is faster because I removed unnecessary code or used faster than the old (e.g. Math.max instead of [].max)

_________________
I don't have RMXP or RMVX installed on this computer so it's most unlikely that I can give you support to any of my scripts.


Top Top
Profile      
 

    Zomebody
  Thu Jul 06, 2017 8:15 pm
Member

L1 Slime
Unfortunatly, it seems to be incompatible with some other scripts. I get this error after loading save - 'undefined method 'hp' for #<RPG::Actor:0xabb6ad4> Anyone knows how to fix it?


Top Top
Profile      
 

    coyotecraft
  Fri Jul 07, 2017 12:04 am
User avatar
Sponsor

Big Dumb Guy
Zomebody, since it made changes to Game_Actor I suspect you might need to start a new save file. Or reinitialize the party members.

If that doesn't work, you might systematically remove other scripts to find out what is conflicting with what. From there, someone might be able to help you after that.


Top Top
Profile      
 

    Zomebody
  Fri Jul 07, 2017 9:11 am
Member

L1 Slime
This script crashes even on clean project after new game > save > load. I would appreciate your help.

Image


Top Top
Profile      
 

    coyotecraft
  Fri Jul 07, 2017 12:30 pm
User avatar
Sponsor

Big Dumb Guy
Ok. I see it.
I ran an autorun event that inspects the Party Actor data, and it's missing a lot of stuff when you load a game: HP, Class Names, EXP levels.
I think it's getting chopped out.

Line 759
def refresh
@actors.collect! do |i|
$data_actors[i.id]
end.compact!
end

The problem goes away if you delete this portion.
I'm not an expert on code efficiency, which is all this script does. So I don't know how much of it hinges on this one method.


Top Top
Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 


Who is online

Users browsing this forum: No users and 27 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

We are an independent, not-for-profit game making community.
Homepage
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group