Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: ForeverZer0 on July 06, 2010, 09:30:52 pm

Title: [XP] Zer0 CMS
Post by: ForeverZer0 on July 06, 2010, 09:30:52 pm
Zer0 CMS
Authors: ForeverZer0
Version: 1.3
Type: Command Menu
Key Term: Custom Menu System



Introduction

This is my first complete CMS that I have created. Originally it was going to be used exclusively for my own project, but I decided to release it for anybody to use. I have added as much compatability as possible to it for other scripts since it also uses its own save/load system, etc.


Features




Screenshots

Main: ShowHide
(http://i1086.photobucket.com/albums/j452/ForeverZer0/CMSMain.png)

Item: ShowHide
(http://i1086.photobucket.com/albums/j452/ForeverZer0/CMSItem.png)

Equip: ShowHide
(http://i1086.photobucket.com/albums/j452/ForeverZer0/CMSEquip.png)

Skill: ShowHide
(http://i1086.photobucket.com/albums/j452/ForeverZer0/CMSSkill.png)

Quest: ShowHide
(http://i1086.photobucket.com/albums/j452/ForeverZer0/CMSQuest.png)

Status: ShowHide
(http://i1086.photobucket.com/albums/j452/ForeverZer0/CMSStatus.png)

Options: ShowHide
(http://i1086.photobucket.com/albums/j452/ForeverZer0/CMSOptions.png)

Data: ShowHide
(http://i1086.photobucket.com/albums/j452/ForeverZer0/CMSData.png)



Demo
Demo Download (http://www.mediafire.com/?5lzkg19ekay54p9)


Script
Use script from demo.


Instructions

See script.
Download this file (http://www.mediafire.com/download.php?tltqzucnnaytgmo) for the font installer.


Compatibility

Requires Blizzard's Tons-of-Addons (http://forum.chaos-project.com/index.php/topic,105.0.html) (v.6.03 or higher), and either ATES (http://forum.chaos-project.com/index.php/topic,710.0.html) or CCTS (http://forum.chaos-project.com/index.php/topic,6346.0.html). It is possible to use another Time System other than them, but it will require some edits to one section (see script).
This script makes many of the default scripts obsolete, almost all that deal with the default CMS and the save system, therefore it will likely not be compatible with other scripts that affect these classes.


Credits and Thanks




Author's Notes

See script.
Title: Re: [XP] Zer0 CMS
Post by: G_G on July 06, 2010, 09:51:26 pm
Small bug. If you go to status, choose a character, then go back it goes back to the command window. Items, Equip etc.
Now if you go to equip, choose a character, then go back it goes back to character selection. I'd rather it be character selection for both.

Nice menu by the way. Its quite nice!
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on July 06, 2010, 09:53:03 pm
Quote from: game_guy on July 06, 2010, 09:51:26 pm
Small bug. If you go to status, choose a character, then go back it goes back to the command window. Items, Equip etc.
Now if you go to equip, choose a character, then go back it goes back to character selection. I'd rather it be character selection for both.

Nice menu by the way. Its quite nice!


Thank you! I'll check the bug out, I didn't intend for it to be like that. Thanks for the feedback, and for the Quest system. It is basically an adapted version of yours  ;)
Title: Re: [XP] Zer0 CMS
Post by: WhiteRose on July 06, 2010, 09:53:14 pm
Quote from: ForeverZero on July 06, 2010, 09:30:52 pm
  • Ability to allow player to unlock Windowskins and Fonts that can be used, much like Chrono Cross.

Awesome. Chrono Cross is one of my top five favorite games ever, and I always thought that was a cool feature.
Title: Re: [XP] Zer0 CMS
Post by: G_G on July 06, 2010, 09:54:16 pm
Quote from: ForeverZero on July 06, 2010, 09:53:03 pm
Quote from: game_guy on July 06, 2010, 09:51:26 pm
Small bug. If you go to status, choose a character, then go back it goes back to the command window. Items, Equip etc.
Now if you go to equip, choose a character, then go back it goes back to character selection. I'd rather it be character selection for both.

Nice menu by the way. Its quite nice!


Thank you! I'll check the bug out, I didn't intend for it to be like that. Thanks for the feedback, and for the Quest system. It is basically an adapted version of yours  ;)


No problem! And thanks ^_^
Title: Re: [XP] Zer0 CMS
Post by: Blazblue Fan on July 07, 2010, 06:57:23 pm
I downloaded the demo but there was no text it was all blank
Title: Re: [XP] Zer0 CMS
Post by: G_G on July 07, 2010, 06:59:20 pm
install the fonts that the demo came with then
Title: Re: [XP] Zer0 CMS
Post by: Blazblue Fan on July 07, 2010, 07:50:38 pm
Are you saying that the demo came with the fonts to install in case I don't have them? If so I don't see any, sorry if I'm asking stupid questions that everyone should know

Edit: never mind I have the fonts now
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on July 07, 2010, 07:57:58 pm
Quote from: Blazblue Fan on July 07, 2010, 07:50:38 pm
Are you saying that the demo came with the fonts to install in case I don't have them? If so I don't see any, sorry if I'm asking stupid questions that everyone should know


No, the demo did not come with fonts, but you will need them in your system, else no text will be displayed.
Title: Re: [XP] Zer0 CMS
Post by: G_G on July 07, 2010, 08:05:03 pm
my bad i thought there was a fonts folder :S
Title: Re: [XP] Zer0 CMS
Post by: Yin on July 08, 2010, 09:05:58 pm
Something happens with the equip menu where everything gets all screwed up. Like my accessory slot was pointing to shields and stuff like that. Then when it gets to weapon, it crashes on line 2274. undefined method atk for rpg::armor
This is the line.
      atk = item1.is_a?(RPG::Weapon) ? item2.atk - item1.atk : 0
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on July 08, 2010, 09:25:22 pm
Quote from: Yin on July 08, 2010, 09:05:58 pm
Something happens with the equip menu where everything gets all screwed up. Like my accessory slot was pointing to shields and stuff like that. Then when it gets to weapon, it crashes on line 2274. undefined method atk for rpg::armor
This is the line.
      atk = item1.is_a?(RPG::Weapon) ? item2.atk - item1.atk : 0


I'll check it out. I admit I didn't test this script super good. So please everyone let me know any issues that are occurring, and I'll fix them as soon as possible.
Title: Re: [XP] Zer0 CMS
Post by: AresWarrior on July 09, 2010, 12:28:28 pm
this cms looks great i'll try to figure out how you added the latest map name in the save screen.  :) thanks
Title: Re: [XP] Zer0 CMS
Post by: nathmatt on July 09, 2010, 05:13:05 pm
just a suggestion
def self.name(id)
  text = case id
  when 1 then 'Picking Fruit'
  when 2 then 'Example #2'
  end
  return text != nil ? text : '?????' # <-- Default for undefined
end

can be done easier with
def self.name(id)
  case id
  when 1 then return 'Picking Fruit
  end
  return '?????'
end)
Title: Re: [XP] Zer0 CMS
Post by: luchs on July 09, 2010, 06:46:00 pm
i get this error ... when i will call the menue in the game

(http://www.abload.de/img/error-zer0jelu.png)
Title: Re: [XP] Zer0 CMS
Post by: nathmatt on July 09, 2010, 09:21:51 pm
Do you have zeros ATS
Title: Re: [XP] Zer0 CMS
Post by: luchs on July 10, 2010, 04:40:39 am
ATES isn't from zero, or not?

I used http://forum.chaos-project.com/index.php/topic,710.0.html
Title: Re: [XP] Zer0 CMS
Post by: Blizzard on July 10, 2010, 04:46:07 am
What does it say in the "Authors" part on top of the topic?
Title: Re: [XP] Zer0 CMS
Post by: luchs on July 10, 2010, 04:57:31 am
see script :) but ... in the comments of the script ... i don't find any helpfull information to use the script with ates....

are there two different scripts called ATES?
Title: Re: [XP] Zer0 CMS
Post by: element on July 10, 2010, 07:55:21 am
This would look GREAT for a in-game cms for rmx-os
Title: Re: [XP] Zer0 CMS
Post by: Agckuu Coceg on July 10, 2010, 05:04:23 pm
Quote from: luchs on July 10, 2010, 04:57:31 am
are there two different scripts called ATES?


This is one script called ATES: It's Blizzard Advanced Time Environment System.
That it what you used.

But... WHAT THE? What the ATES::WEEKDAYS and ATES::MONTHS? Where did you find them in a original ATES?
Title: Re: [XP] Zer0 CMS
Post by: luchs on July 10, 2010, 06:46:05 pm
i don't know xD

I have the codelines for the date and the weekdays now simply deleted :) now it works
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on July 11, 2010, 03:46:37 pm
Quote from: luchs on July 10, 2010, 04:57:31 am
see script :) but ... in the comments of the script ... i don't find any helpfull information to use the script with ates....

are there two different scripts called ATES?


The time system is only used on the "Time" section when the menu is open. It doesn't require any config, it will recognize if ATES is present, and use ATES time on the menu if it is, or it will use CCTS if it is present.

By the way, I updated the script. Fixed possible bug on the equip screen, and added a Font Installer that will automatically install fonts on the system if they are not there already.
Title: Re: [XP] Zer0 CMS
Post by: Agckuu Coceg on July 11, 2010, 11:13:08 pm
Quote from: ForeverZero on July 11, 2010, 03:46:37 pm
By the way, I updated the script. Fixed possible bug on the equip screen, and added a Font Installer that will automatically install fonts on the system if they are not there already.


Demo and script had one link: to the text script...  :huh:
Title: Re: [XP] Zer0 CMS
Post by: WhiteRose on July 12, 2010, 09:16:31 pm
Quote from: Agckuu Coceg on July 11, 2010, 11:13:08 pm
Quote from: ForeverZero on July 11, 2010, 03:46:37 pm
By the way, I updated the script. Fixed possible bug on the equip screen, and added a Font Installer that will automatically install fonts on the system if they are not there already.


Demo and script had one link: to the text script...  :huh:

This is indeed correct. In addition, the Ruby file used by the font installer seems to be absent from both downloads.

Also, the script crashes if you attempt to view the status screen with no weapon equipped.
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on July 14, 2010, 05:33:42 pm
Oops!  :wacko:
I'll fix that.
Title: Re: [XP] Zer0 CMS
Post by: Jragyn on July 23, 2010, 03:04:54 pm
Whenever I try to peek at my status, it pops:

Line 2436: Name error.
undefined local variable or method 'stat1' for
#<Window_Zer0_Status:memorydigits>

Any idea what kind of script would mess with that? Of course I use a plentiful amount of them ._.
Oh, and I didn't notice this until after I dropped the CMS into the game, but it shows decimal stats?

ie: ATK=11.5 versus ATK=12 (rounded up)
?



--J
Title: Re: [XP] Zer0 CMS
Post by: SquareMan on August 15, 2010, 04:24:01 pm
you should add an option to the menu where you can quit to the title screen
Title: Re: [XP] Zer0 CMS
Post by: Ryex on August 15, 2010, 10:18:24 pm
Fant's window movement methods are flawed, I fixed a few bugs in them when I made Window Advanced, consider changing methods.
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on August 16, 2010, 12:22:48 pm
Quote from: Ryexander on August 15, 2010, 10:18:24 pm
Fant's window movement methods are flawed, I fixed a few bugs in them when I made Window Advanced, consider changing methods.


I may. What flaws?
Title: Re: [XP] Zer0 CMS
Post by: Draco6slayer on August 20, 2010, 04:56:50 pm
Hi, I just downloaded this, and I'd like to make a few notes:
This is not compatible with Zer0's Title Script. Using the two together prevented it from working for me. Very difficult to decipher.
This may or may not be important, but in the demo he made an edit to "Scene_Debug" as well, though I'm not entirely sure what.
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on August 23, 2010, 12:29:48 pm
Quote from: Draco6slayer on August 20, 2010, 04:56:50 pm
Hi, I just downloaded this, and I'd like to make a few notes:
This is not compatible with Zer0's Title Script. Using the two together prevented it from working for me. Very difficult to decipher.
This may or may not be important, but in the demo he made an edit to "Scene_Debug" as well, though I'm not entirely sure what.


I'll check the compatibility issue out. As for the Scene_Debug, that is likely just something I forgot to change back for the demo. I often switch the key needed to call it. Just an anal little thing I do... :???:
Title: Re: [XP] Zer0 CMS
Post by: Ryex on August 23, 2010, 07:33:32 pm
when moving windows there can be inaccuracy
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on August 24, 2010, 12:15:54 pm
Quote from: Ryexander on August 23, 2010, 07:33:32 pm
when moving windows there can be inaccuracy


Okay. I didn't pick the script apart, but I wondered if that was a possibility with how the decimal correction is done, where it could maybe be a pixel off.
Title: Re: [XP] Zer0 CMS
Post by: Jragyn on August 24, 2010, 04:57:07 pm
Quote from: jragyn00 on July 23, 2010, 03:04:54 pm
Whenever I try to peek at my status, it pops:

Line 2436: Name error.
undefined local variable or method 'stat1' for
#<Window_Zer0_Status:memorydigits>

Any idea what kind of script would mess with that? Of course I use a plentiful amount of them ._.
Oh, and I didn't notice this until after I dropped the CMS into the game, but it shows decimal stats?

ie: ATK=11.5 versus ATK=12 (rounded up)
?



--J


Any umm...
...response?

Is there more information I somehow need to come up with?
I've disabled the selection of Status until it is resolved :\
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on August 25, 2010, 12:12:16 pm
@jragynn00
Sorry! Completely forgot  :???:.
I'll fix this within the week. I have a few scripts of mine I need to go back into and edit. I'll make this top priority when I start doing that, and once again, sorry.
Title: Re: [XP] Zer0 CMS
Post by: Jragyn on August 27, 2010, 09:07:52 pm
'iz alright.
Can you do me a favor though?
Erm, explain why the issue arose?
I'm trying to learn a bit here and there, and an explanation of what the issue is, and how its fixed could be nice :D


--J
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on August 30, 2010, 12:07:27 pm
Quote from: jragyn00 on August 27, 2010, 09:07:52 pm
'iz alright.
Can you do me a favor though?
Erm, explain why the issue arose?
I'm trying to learn a bit here and there, and an explanation of what the issue is, and how its fixed could be nice :D


--J


I'll be sure to let you know for sure once I take a look at it myself, but from how it sounds, for one reason or another a local variable is not getting defined, so an error is thrown when it attempts to access it.
Title: Re: [XP] Zer0 CMS
Post by: Ryex on August 30, 2010, 04:54:55 pm
Quote from: ForeverZer0 on August 24, 2010, 12:15:54 pm
Quote from: Ryexander on August 23, 2010, 07:33:32 pm
when moving windows there can be inaccuracy


Okay. I didn't pick the script apart, but I wondered if that was a possibility with how the decimal correction is done, where it could maybe be a pixel off.

ya up to 4-5 pixels but I corrected that
Title: Re: [XP] Zer0 CMS
Post by: Draco6slayer on August 30, 2010, 11:07:46 pm
Jragy: I used to get that error, and I don't know what happened, but since then I have added second options to all of the features on the options menu and I don't get it anyomore. I'm not sure if they're related, but I doubt it. Nonetheless, if you don't have a second option in any of the features and try to change them, you get an error. I'm not really sure what the error is called, but it should be pretty easy to reproduce.
Title: Re: [XP] Zer0 CMS
Post by: Holyrapid on September 04, 2010, 03:57:40 am
This looks great. I'm definately using this in my game. Nice job Zer0!
Title: Re: [XP] Zer0 CMS
Post by: bboyd93 on September 05, 2010, 03:41:54 pm
I have all the requirements fulfilled, but when I try to change the font or windowskin under the options menu in game, I get errors on lines
870, or 862 respectively.

The error are taking place in the CMS scripts itself, saying "undefined method '+' for nil:NilClass"

Being that I'm not a scripter, I have no idea what this means  I have the fonts in a Fonts folder under Data.  As of now, it only has the fonts from the demo installed.  Ultimate Font Override is enabled, as well as the Auto Font installer.

And I don't have any idea why the Windowskins won't work.

Any help would be great, thanks in advance.
Title: Re: [XP] Zer0 CMS
Post by: Jragyn on September 05, 2010, 04:00:58 pm
Isn't there an array you has to add the names of the windowskins to if your adding your own windowskins?
I had an error similer to that, but it only happened because it was trying to change to a windowskin I didn't have, ie: the ones that zer0 listed himself in the script. Same with the fonts, too.

 
  # These are the available windowskins that your game begins with.
  Windowskins = ['Black', 'Thorns', 'Simple Line']      <---- You has to replace this with your windowskin names.
 
  # Available fonts that are available at the start of the game.
  Fonts = ['Calibri', 'Times New Roman', 'Tahoma']    <---- You has to change this with your font names.



Title: Re: [XP] Zer0 CMS
Post by: bboyd93 on September 05, 2010, 06:37:18 pm
I just figured it out, thanks though.
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on September 07, 2010, 12:04:52 pm
Was it an error with the script, or just something you were overlooking?
Title: Re: [XP] Zer0 CMS
Post by: rlm1000 on September 10, 2010, 04:42:38 pm
Ok I think i found a bug in the demo. I went to the equip screen and set the equipment for the first character, then went to do the same with the second character, and got this message:

Script 'Zer0_CMS' Line 2335: NoMethodError Occurred
undefined method 'eva' for #<RPG::Weapon:0x93962c8>

And when i copy the scripts from the demo to my own game, changing the windowskins always crashes the game, saying there's a error with this message:

Script 'Zer0_CMS' Line 862: NoMethodError Occurred
undefined method '+' for nil:NilClass
Title: Re: [XP] Zer0 CMS
Post by: idler on September 10, 2010, 09:55:50 pm
Quote from: rlm1000 on September 10, 2010, 04:42:38 pm
Ok I think i found a bug in the demo. I went to the equip screen and set the equipment for the first character, then went to do the same with the second character, and got this message:

Script 'Zer0_CMS' Line 2335: NoMethodError Occurred
undefined method 'eva' for #<RPG::Weapon:0x93962c8>

And when i copy the scripts from the demo to my own game, changing the windowskins always crashes the game, saying there's a error with this message:

Script 'Zer0_CMS' Line 862: NoMethodError Occurred
undefined method '+' for nil:NilClass


He's right... But i just found out that you need to set up the windowskins and fonts in the script, that solves the second error.

However, I still get the first error.

And when I copy the script to my game and enter the status screen it says:

Script 'Zer0_CMS' Line 1513: NoMethodError Occurred
undefined method 'element_set' for nil:NilClass

And what's the "elemental/status attack/guard" thing?

So:
1) Equipment error
2) Status screen error
3) The "elemental/status attack/guard" thing, what is it?

The menu looks just amazing, it's the best one I've seen, I'm really looking forward to it  ;)

EDIT: I solved the save problem, the thing was that I had a previous non-menu save. I also changed the Scene-title thing, which I had not noticed. I still get the equipment/statur error though.
Title: Re: [XP] Zer0 CMS
Post by: Holyrapid on September 12, 2010, 03:25:00 am
I don't know if it will help, but try removing that # from the #<RPG::Weapon:0x93962c8> so that it becomes <RPG::Weapon:0x93962c8> because in Ruby (which RGSS is) # in front means that that line is a comment, and not used anywhere...
Title: Re: [XP] Zer0 CMS
Post by: idler on September 12, 2010, 05:53:48 pm
Quote from: DesPKP on September 12, 2010, 03:25:00 am
I don't know if it will help, but try removing that # from the #<RPG::Weapon:0x93962c8> so that it becomes <RPG::Weapon:0x93962c8> because in Ruby (which RGSS is) # in front means that that line is a comment, and not used anywhere...


The # only shows up in the error screen, it doesn't show up in the script. Thanks anyways ;)

EDIT: I have tried everything I could and I can't get it to work... When I enter into the status screen I get the previous mentioned error, and the equip thing too...

And BTW, I tried using ATES instead of CCTS to see if it worked, and i got an error message... (Can't tell what it said now).

Is there any chance you could fix the script, Zer0? It's great, It has a Quest system *-*
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on September 14, 2010, 12:03:39 pm
Yeah, I have been procrastinating a little on this one.... :<_<:

EDIT:
Okay, fixed the bugs, plus made a few other minor improvements.
Will upload soon as I get a chance. They are on my other computer at the moment.

EDIT 2:
It is now uploaded. Follow the demo link.
Title: Re: [XP] Zer0 CMS
Post by: Jragyn on October 05, 2010, 03:42:59 pm
Mister Zer0,

Thank you for updating and fixing the silly little problems that people mentioned.
This CMS is quite classy and I like the feel it has with the moving windows, and unlockables.
Its also out of the way, not a huge menu screen that eats the screen, and it works well with BlizzABS.

Maybe its just my personal opinion, but this is a pretty l33t CMS.
Keep up the superb work as always. :]

PS_Look! Your l33tnes radiates everywherrrrrrrrrrrrrrrreeeeeeeeeeeeeeeeeeeeeeeeeeeee:
Spoiler: ShowHide
(http://i54.tinypic.com/s42tjt.png)


--J
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on October 05, 2010, 04:48:04 pm
@jragyn00
Thanks for the compliments, man. :-*
This is just a hobby of mine, but I am glad others appreciate and like it.
I got some new things qued to release here shortly, so keep an eye out for'em.  :)
Title: Re: [XP] Zer0 CMS
Post by: Jragyn on October 05, 2010, 04:56:10 pm
Oh?
Like what?
Star Ocean skills/talents & crafting system? :D?


--J

PS_ Please just J, or Jragyn works. 'jragyn00' sounds kinda goofy X_X
[wishes he put more thought into his login name years ago]
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on October 05, 2010, 04:57:38 pm
You'll have to wait and see.  ;)

As for your name, just ask a mod to change it.
Winkio changed mine from ForeverZero, to ForeverZer0.
Title: Re: [XP] Zer0 CMS
Post by: Jragyn on October 05, 2010, 05:19:29 pm
You are heartless to conceal your secret scripts from me.
I will have to do that, someday in the near future.

I look forward to seeing your next pieces of work, I cannot get enough customization in a game XD


--J
Title: Re: [XP] Zer0 CMS
Post by: Landith on October 06, 2010, 05:25:00 am
Small bug, easy fix.
In the Equip Screen, since you have the input on repeat, you can hold down the down or the up button and the sequence gets messed up because it's not updating everytime the window is being refreshed. For example if your on shields and you hold down and land on accessories, you will be on helmets but it shows you on accessories.
So all you have to do is change the input to pressed instead of repeat, I believe.

(Btw, I'm not into RMXP anymore I was just bored and decided to try out new scripts)

Good job on this btw.
Title: Re: [XP] Zer0 CMS
Post by: Jragyn on October 06, 2010, 09:06:36 pm
Mister Zer0,

I have a suggestion/request:

In your equip menu, perhaps you could add an additional button press (input::z ?) to bring up a small window that shows progress in regards to EQUAP skills on said equipment?

An aesthetic idea for those who use tons of different equipment and want to gauge what to equip based on this.
(ie: precisely what I'm doing XD)


--J
Title: Re: [XP] Zer0 CMS
Post by: LiTTleDRAgo on November 10, 2010, 07:29:55 am
uncompatible with CCTS v.1.2.2

(http://www.tinyimg.org/images/204untitled.jpg)
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on November 10, 2010, 12:28:30 pm
At what point is it doing it?

If it soes it before the game even starts, it will be a script order issue. 

I just find it odd since the constant it is referring to has not changed in CCTS since the first version, so for it to say that it is undefined is a little odd.

I will check it out tonight or tomorrow and get back to you, but let me know if swapping the order of the two scripts around helps at all.
Title: Re: [XP] Zer0 CMS
Post by: LiTTleDRAgo on November 11, 2010, 05:40:54 am
Quote from: ForeverZer0 on November 10, 2010, 12:28:30 pm
At what point is it doing it?

If it soes it before the game even starts, it will be a script order issue. 

I just find it odd since the constant it is referring to has not changed in CCTS since the first version, so for it to say that it is undefined is a little odd.

I will check it out tonight or tomorrow and get back to you, but let me know if swapping the order of the two scripts around helps at all.


I changed line 1939
      month = CCTS::Months[$game_system.time.month - 1]

with
      if $ccts <= 1.2
        month = CCTS::Months[$game_system.time.month - 1]
      elsif $ccts >= 1.2
        month = CCTS::MONTHS[$game_system.time.month - 1]
      end

and it worked

probably because you change Months at CCTS v.1.1 into MONTHS at CCTS v.1.2.2?
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on November 11, 2010, 10:05:07 am
Yeah, I checked it out last night and noticed the sasme thing. Will post update in a little bit.

EDIT:

Okay I uploaded the new script, which has been updated to version 1.3.
  - Fixed incompatibility issue with CCTS v.2.0 and higher. (Thanks to LiTTleDRAgo for pointing it out)
  - Fixed bug with items getting scrambled on Equip screen if the player held the Up or Down buttons.
  - Fixed bug that would crash game if player attempted to change the windowskin or font when none were unlocked.
Title: Re: [XP] Zer0 CMS
Post by: Xuroth on March 15, 2011, 04:49:33 pm
Scripts I'm using(in order): ShowHide


  • This CMS

  • Tons

  • Advanced Weather

  • CCTS

  • Leon_Westbrooke's Shop Layout

  • Blizzard's Pay to Heal

  • your Add-on collection

so far. I'm planning on adding more scripts as I continue the game...
[/list]


Im not sure what's causing this. I also have difficulty reading your scripts because your code is too 1337 for my n00b brain... but seriously, I tried seeing what could cause this, and nothing jumped out at me...
Title: Re: [XP] Zer0 CMS
Post by: Blizzard on March 15, 2011, 04:51:27 pm
What about your script order?
http://forum.chaos-project.com/index.php/topic,23.0.html
Title: Re: [XP] Zer0 CMS
Post by: Xuroth on March 15, 2011, 05:06:11 pm
Oops! Due to preference on graphics, I placed Pay to heal before Zer0's add on collection script, simply because one of the add-ons has been configured to modify the PTH script. Though i did try it the "correct" way with no luck. No errors, just not changing skins...
New order:
REVISED script order: ShowHide


  • Leon_Westbrooke's Shop Layout

  • This CMS

  • Advanced Weather

  • CCTS

  • Blizzard's Pay to Heal

  • your Add-on collection

  • Tons

[


EDIT: *facepalms* it might help if the default starting windowskin is defined in the array as well... after reviewing the code a bit more, i realized my skin (defined in the Database) was not included in the script... I feel like an idiot for making such a mistake...

Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on March 15, 2011, 06:03:04 pm
Quote from: Xuroth on March 15, 2011, 05:06:11 pm
EDIT: *facepalms* it might help if the default starting windowskin is defined in the array as well... after reviewing the code a bit more, i realized my skin (defined in the Database) was not included in the script... I feel like an idiot for making such a mistake...


It's all good. We've all been there. I've spent hours trying to track a bug in a script that was nothing more than a I didn't use parentheses correctly.
Title: Re: [XP] Zer0 CMS
Post by: TJ01 on April 30, 2011, 08:48:02 am
I`ve got one small Question, how does the Questlog arrange the quests?
The quest 6 is before the quest 1, but quest 11 is after quest 3 :???:
I get crazy...
Title: Re: [XP] Zer0 CMS
Post by: nathmatt on April 30, 2011, 11:31:26 am
its most likely the order you add them
Title: Re: [XP] Zer0 CMS
Post by: Shalaren on April 30, 2011, 10:55:27 pm
small suggestion o:
i tried using it with Mouse Controller, and it works really good and its fun to use, but it only works for everything bu the Main manu that is placed on top, for every scene the Mouse Controller works but for the Menu it doesnt, just thought I should say.
Title: Re: [XP] Zer0 CMS
Post by: karldaylo on May 01, 2011, 01:54:36 am
Quote from: Shalaren on April 30, 2011, 10:55:27 pm
small suggestion o:
i tried using it with Mouse Controller, and it works really good and its fun to use, but it only works for everything bu the Main manu that is placed on top, for every scene the Mouse Controller works but for the Menu it doesnt, just thought I should say.


ive ve been reading your previous threads,as i see you got many problems with blizz's mouse controller... hope ur not usin blizz abs or tons of addon cuz i now a mouse system that perfectly work with everything (like perhaps when your about to pick hot key skill in blizz abs.. you need to atleast trigger leright button so that you can pick an item as a hotkey) :naughty:
Spoiler: ShowHide

Quote from: Shalaren link=http://www.rpgrevolution.com/forums/index.php?showtopic=43942Terms and Conditions
You can use this script in your freeware or commercial game.
Please put Amaranth, Near Fantastica, SephirothSpawn and Shaz in your credits.


EDITED: the script is too long the thread cant handle the whole., i hate double psoting so i should give you the link :/
http://www.rpgrevolution.com/forums/index.php?showtopic=43942


EDITTED: not compatible with other mouse script... and blizz abs (cuz of the centipede path finding system) also with tons of addon(same reason)
Title: Re: [XP] Zer0 CMS
Post by: TJ01 on May 01, 2011, 02:54:53 am
Quote from: nathmatt on April 30, 2011, 11:31:26 am
its most likely the order you add them

No, it`s not the order how I add them.
I added Quest 1, 4, 5, 6, 10, 16 and 21 in this order.

But this is the order in the Questlog:
16, 5, 6, 1, 4, 21, 10
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on May 01, 2011, 03:06:19 am
Around line 930, find this method:
Spoiler: ShowHide

  def update_quest_select
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @quest_list.active, @command_window.active = false, true
      [@quest_info, @quest_list].each {|win| move(win)}
    elsif Input.trigger?(Input::C)
      if @quest_info == nil
        @quests = []
        $game_party.quests.each_key {|i| @quests.push(i)}
        @quest_info = Window_QuestInfo.new(@quests[@quest_list.index])
        @all_windows.push(@quest_info)
      end
      se = @quests.empty? ? $data_system.buzzer_se : $data_system.decision_se
      $game_system.se_play(se)
      unless @quests.empty?
        @quest_info.quest = @quests[@quest_list.index]
        move(@quest_info, false)
      end
    end
  end


Change the line that reads:
$game_party.quests.each_key {|i| @quests.push(i) }


to...

$game_party.quests.keys.sort.each {|i| @quests.push(i) }


That will list them by there ID. I should have done that in the first place.
Title: Re: [XP] Zer0 CMS
Post by: TJ01 on May 01, 2011, 05:42:24 am
Quote from: ForeverZer0 on May 01, 2011, 03:06:19 am
Around line 930, find this method:
Spoiler: ShowHide

 def update_quest_select
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     @quest_list.active, @command_window.active = false, true
     [@quest_info, @quest_list].each {|win| move(win)}
   elsif Input.trigger?(Input::C)
     if @quest_info == nil
       @quests = []
       $game_party.quests.each_key {|i| @quests.push(i)}
       @quest_info = Window_QuestInfo.new(@quests[@quest_list.index])
       @all_windows.push(@quest_info)
     end
     se = @quests.empty? ? $data_system.buzzer_se : $data_system.decision_se
     $game_system.se_play(se)
     unless @quests.empty?
       @quest_info.quest = @quests[@quest_list.index]
       move(@quest_info, false)
     end
   end
 end


Change the line that reads:
$game_party.quests.each_key {|i| @quests.push(i) }


to...

$game_party.quests.keys.sort.each {|i| @quests.push(i) }


That will list them by there ID. I should have done that in the first place.



This doesn`t change anything, the order is the same.
It`s such a great script and I like the questlog too, but I think, the player will be confused by this...

Note: I used a new project; The original Questlog(by Gamer-Guy) works correctly, but I`m really bad in scripting, so I don`t know how to move the old one in the menu, or modify the new one :shy:
Title: Re: [XP] Zer0 CMS
Post by: Shalaren on May 03, 2011, 09:04:33 pm
jUST WANNA POINT OUT THAT if you use the mouse controller, you cant use the mouse for this menu >:
so just a suggestion o:
Title: Re: [XP] Zer0 CMS
Post by: ForeverZer0 on May 03, 2011, 09:19:33 pm
Maybe somebody should fix that.

Wait--- damn.  We'll see, I don't really want to promise anything for right now. I kind of have a lot on my plate at the moment.
Title: Re: [XP] Zer0 CMS
Post by: Jragyn on May 04, 2011, 12:01:09 pm
I know this doesn't break anything, but in my attempts to make sure that the config from 1.2 -> 1.3 of this script were the same so I could copypasta over, I discovered that your global variable of $zer0_CMS = 1.2, even in the 1.3 script.


...
Jus' sayin'.  :uhm:
Title: Re: [XP] Zer0 CMS
Post by: Darkner on June 05, 2011, 07:50:30 am
Hi, I'm new to this forum. I've started using Zer0's CMS, which requires ATES or CCTS. I ran into trouble with ATES showing an error for the CMS: undefined method 'day' for #<ATES::Time:0x3eb1718 @min=0, @hour=0>. Therefore I started using the CCTS.  :)

But, I don't want time in my game, nor do i want weather or tints. How do i disable everything from the ATES or CCTS, but to still allow me to use the CMS?

I think the CCTS script lack some turning off-abilities. I know there's the change of "time.clock = false"-script to be used in the beginning to turn off the clock, and theres the ability to turn it off in the script under the Game_System section, but when you open the menu and exits it, it flashes the clock for a short period of time.

I think the CCTS is a cool script as well as the CMS, but I really don't want to use the CCTS for this game, and only the CMS. But since it requires CCTS I've come to a stop in my progress... Please help me! Can I change it for the CMS or for the CCTS?
Title: Re: [XP] Zer0 CMS
Post by: Darkner on June 06, 2011, 09:11:26 am
Hmm, correction. I noticed that once turned off by the Input::Z-button, it stays gone, even with menu enter/exit. Let me thus rephrase my earlier question. Is there a way to make this turned off by default? I have no problem with it being able to appear once a button is pressed, as long as it doesn't do it as default.
Title: Re: [XP] Zer0 CMS
Post by: Spoofus on August 08, 2011, 06:46:47 pm
hey been awhile but i was wondering if someone could help out editing something in this CMS in the equipment
i was planning on only using body armor and 3 accessories and whenever i try, lets just say i am very unsuccessful.....just help whenever you have the time :)
Title: Re: [XP] Zer0 CMS
Post by: sellyx on August 16, 2011, 06:18:00 pm
Just asking : can i add option to the menu ??
Im new to scripting, but i know how to add things to the base menu , but when i try to add some the
this one , it works, but when it open it does not show it all, i mean the word of my new option
is cut.

Sry for my poor english, im french ^^
Title: Re: [XP] Zer0 CMS
Post by: Xuroth on September 08, 2011, 09:12:13 am
funny... demo is 1.3, but CMS script contained inside says 1.2...
Title: Re: [XP] Zer0 CMS
Post by: Magus on August 31, 2012, 10:13:00 am
:/ annoying argument error from blizzabs script 2. I guess it isn't compatible with 2.84
Title: Re: [XP] Zer0 CMS
Post by: Moshan on February 11, 2013, 02:19:17 pm
 It is possible to make it compatible with scripts which modify equipment window? Like Multi-slots scripts?
Title: Re: [XP] Zer0 CMS
Post by: KK20 on February 11, 2013, 07:58:14 pm
Probably but I need to know what script you are using first. He created new windows for some instances rather than modify the default RMXP window classes. I think one of the equip windows falls under this which is probably why the two scripts aren't compatible.
Title: Re: [XP] Zer0 CMS
Post by: Moshan on February 12, 2013, 01:47:22 am
 There are 4 scripts...
Spoiler: ShowHide
#==============================================================================
# Multi-slot equipment script
#------------------------------------------------------------------------------
# Section 1:  Modules
#------------------------------------------------------------------------------
# Guillaume777
# 6.2.2
# 2006/02/14
#==============================================================================

# To change slots of character
#     $game_actors[1].weapon_slots = [0,0]
#     $game_actors[1].armor_slots = [2,3,4,5,6,7]
#
# To make armor equipable in new slot :
#     Add (5) in its name, where 5 is its slot number
# To make 2handed weapons :
#     Add an element called 2handed to a weapon
#     or, adds its id in TWO_HANDED_WEAPONS = []
#     or, adds (2handed) in its name
# To make a weapon double attack
#     Add an element called 2attacks to a weapon
#     or, adds its id in DOUBLE_ATTACK_WEAPONS = []
#     or, adds (2atks) in its name
# To make a weapon/armor cursed
#     Adds its id in CURSED_WEAPONS or CURSED_ARMORS, or
#     put (cursed) in its name
# To make a weapon require an offhand instead of any weapon
#     Adds its id in NEEDS_OFFHAND or
#     Adds (needs_offhand) in its name

#==============================================================================
# *** MODULE:  Guillaume777's Multi-Slot Module
#------------------------------------------------------------------------------
#  This is the configuration module of the Multi-Slot system.  It allows you to
#  set the default names of your slots, tag your weapons and/or armors for many
#  types of enhancements and features, and etc.
#==============================================================================
module G7_MS_MOD
 
  #--------------------------------------------------------------------------
  # * Configuration Section
  #--------------------------------------------------------------------------
  #========Set weapon/armor properties ======================================
  CURSED_WEAPONS        = []             # ids of weapons to be cursed
  CURSED_ARMORS         = []             # ids of armors to be cursed
  TWO_HANDED_WEAPONS    = []             # ids of 2handed weapons
  DOUBLE_ATTACK_WEAPONS = []             # ids of double attack weapons
  NEEDS_OFFHAND         = [] # ids of weapons requiring an offhand

  SWITCH_EQUIP_WEAPONS  = []  # ids of weapons switched when equipped
  SWITCH_EQUIP_ARMORS   = []  # ids of switched armors(same above)
  # Use 1 array, first value of array = false item, second value = true item
  #
  # First value in the above arrays is displayed in the weapons/armors you can
  # choose.  When the weapon/armor is chosen, the second id value IS the weapon
  # or armor that you've chosen.  Example:  Trick someone to equip a cursed bow.

  #=========Set weapon/armor properties with element tagging and name edit===
  CURSED_STRING = 'cursed'  # put (cursed) in item name for it to be cursed
  HANDS_ELEMENT = 'handed'  # no. of hands in front of HANDS_ELEMENT in database
  HANDS_STRING  = 'handed'  # name of string in item name like (2handed)

  MULTI_ATTACK_ELEMENT = 'attacks' # name of element to tag to multi attacks
                                   # like (2attacks)
  MULTI_ATTACK_STRING = 'atks'     # string in item name, like (3atks)

  NEEDS_OFFHAND_STRING = 'needs_offhand' #string in item name if the weapon
                                         #needs an offhand like (needs_offhand)
                                         
  #=====Set character slots properties =======================================
  WEAPON_KINDS = [0]                     # number of weapons,  0 = weapon
  WEAPON_KIND_NAMES = ['Weapon']  # custom name of extra weapon slots
  WEAPON_KIND_POWERS = [100]           # 100 = normal power, 90 = 90% power
                                            # Leave empty or put nil inside
                                            # if you want the default names.
  ARMOR_KINDS = [1,2,3,4,5,6,7]
  # 1 = shield
  # 2 = helmet
  # 3 = armor
  # 4 = acc
  # 5 = and more : extra slot
  EXTRA_SLOT_NAMES = ['Gauntlet','Boots','Amulet']
  # Name of the extra slots in equip window
  # You need as many words as there are '5' or more in armor_kinds
  # The first order of the slots names reflect the order of the 5 in armor_kinds
  # Put (5) or more to in the armor name to have it assigned to the extra slot


  #=============Set multi-weapon behavior====================================
  IGNORE_OFFHAND          = false # ignore off_hand support
  TWOHANDED_IN_OFFHAND    = true  # If false don't show two handed weapons in
                                  # the offhand window
  ALL_WEAPONS_FOR_SKILLS  = true  # true  = combined pwr of all weaps for skills
                                  # false = only power of first weapon
  SHIELD_HAND_SLOT        = 1     # slot number to be used for shield hand
  WEAPON_SHIELD_SHARE     = true  # if true, can't use a shield and a second
                                  # weapon at the same time
  SHIELD_HAND_WIELD       = true  # true = can use shield hand for 2handed weap.
  WEAPON_HAND_WIELD       = true  # true = can use weapon hand for 2handed weap.
  MULTI_WEAPONS_PENALITY  = 0     # percent of atk that will be subtracted if
                                  # you use two weapons at the same time.
                                 
  #============Set appearance properties ====================================
  FONT_NAME       = 'Arial'      # Font to use
  CURSED_COLOR    = Color.new(255, 50, 50)  # Color of cursed equiped items
  SHOW_REMOVE     = false                   # Show empty in offhand window

  WINDOWS_STRETCH = true    # true : equip_right stretch to adjust to # of slots
  MAX_SHOW_SLOTS  = 6       # Maximum number of slots in 1 screen in equip right
                            # window.  Useless if windows_stretch = false
  HELP_AT_BOTTOM  = false   # If true,  will leave place for help window at bot-
                            # tom.  Useless if you didn't modify the help window
                            # y-coordinate.

  STATUS_WINDOW_ARRANGE = true  # If true, you get a new status window.
  STATUS_WINDOW_SPACING = 24    # Space between each item in new status window.
  EVADE                 = false # If draw_actor_parameter is configured to
                                # receive parameter number 7 (evade), then it
                                # will show in new status window.
  # EVADE = true has no effect if STATUS_WINDOW_ARRANGE is false
 
  #================ end of settings =========================================

  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super
    RPG.set_new_item_types #fix armor and weapon properties at start of game
  end
  #--------------------------------------------------------------------------
  # * End of MODULE:  Guillaume777's Multi-Slot Module
  #--------------------------------------------------------------------------
end



#============================================================================
# ** MODULE:  RPG Module
#----------------------------------------------------------------------------
#  This sprite is used as an arrow cursor for the battle screen. This class
#  is used as a superclass for the Arrow_Enemy and Arrow_Actor classes.
#============================================================================
module RPG
  #--------------------------------------------------------------------------
  # * Set New Item Types
  #--------------------------------------------------------------------------
  def RPG.set_new_item_types
    if @initialized_item_types then return end
    for armor in $data_armors     # for each armor
      unless armor == nil         # if armor
        armor.set_adv_type        # set new type
        armor.set_cursed          # set if item is cursed or not
      end
    end
    for weapon in $data_weapons  # for each armor
      unless weapon == nil       # if armor
        weapon.set_needs_offhand # set if it needs an offhand or not
        weapon.set_nb_hands      # set the number of hands to wield it
        weapon.set_nb_attacks    # set the number of attacks it can do
        weapon.set_cursed        # set if item is cursed or not
      end
    end
    @initialized_item_types = true
  end
  #--------------------------------------------------------------------------
  # * Initialized Item Types
  #     bool      : boolean value (true/false)
  #-------------------------------------------------------------------------- 
  def RPG.initialized_item_types=(bool)
    @initialized_item_types = bool
  end
   
  #==========================================================================
  # ** Armor
  #--------------------------------------------------------------------------
  # Data class for armors, adds new armor types
  #==========================================================================
  class Armor
    attr_accessor :cursed
    #------------------------------------------------------------------------
    # * Set Adv Type
    #------------------------------------------------------------------------ 
    def set_adv_type
      pattern =  /\((\d+)\)/
      if @name.sub!(pattern, '') != nil
        # Set kind to the number in name of armor
        @kind = $1.to_i - 1
      end
    end
    #------------------------------------------------------------------------
    # * Set Cursed
    #------------------------------------------------------------------------   
    def set_cursed
      pattern = '('+G7_MS_MOD::CURSED_STRING+')'     
      if @name.sub!(pattern, '') != nil then cursed = true end
      if G7_MS_MOD::CURSED_ARMORS.include?(@id) then cursed = true end
      @cursed = cursed
    end
    #------------------------------------------------------------------------
    # * End of Armor Class
    #------------------------------------------------------------------------
  end

  #==========================================================================
  # ** Weapon
  #--------------------------------------------------------------------------
  # Data class for weapons, adds new weapon types
  #==========================================================================
  class Weapon
    #------------------------------------------------------------------------
    # * Public Instance Variables
    #------------------------------------------------------------------------
    attr_accessor :needs_offhand  # does it need an offhand weapon
    attr_accessor :nb_hands       # numbers of hands it requires
    attr_accessor :nb_attacks     # number of attacks it can do
    attr_accessor :cursed         # true if item is cursed
    #------------------------------------------------------------------------
    # * Set Cursed
    #------------------------------------------------------------------------ 
    def set_cursed
      pattern = '('+G7_MS_MOD::CURSED_STRING+')'
      if @name.sub!(pattern, '') != nil then cursed = true end
      if G7_MS_MOD::CURSED_WEAPONS.include?(@id) then cursed = true end
      @cursed = cursed
    end
    #------------------------------------------------------------------------
    # * Set Needs OffHand
    #------------------------------------------------------------------------   
    def set_needs_offhand
      pattern = '('+G7_MS_MOD::NEEDS_OFFHAND_STRING+')'
      if @name.sub!(pattern, '') != nil then
        @needs_offhand = true
      elsif G7_MS_MOD::NEEDS_OFFHAND.include?(self.id) then
        @needs_offhand = true
      elsif @needs_offhand== nil then
        @needs_offhand = false
      end
    end
    #------------------------------------------------------------------------
    # * Returns number of hands needed for weapons
    #------------------------------------------------------------------------
    def set_nb_hands
      if G7_MS_MOD::TWO_HANDED_WEAPONS.include?(self.id) then
         nb_hands = 2
      end
      pattern = /\((\d+)#{G7_MS_MOD::HANDS_STRING}\)/
      if @name.sub!(pattern, '') != nil
        nb_hands = $1.downcase.delete('a-z')
        nb_hands = $1.to_i
      end
      # Search through the elements
      for elementnb in self.element_set
        elementname = $data_system.elements[elementnb].downcase
        # If the weapon has an element for another attack
        if elementname.delete('0-9') == G7_MS_MOD::HANDS_ELEMENT.downcase
          # Get the number of attacks
          elementname = elementname.delete('a-z')
          if elementname != '' then
            nb_hands = elementname.to_i
            # Delete the element
            self.element_set.delete(elementnb)
          end
        end
      end
      if nb_hands.is_a?(Integer) == false or nb_hands <= 0 then nb_hands = 1 end
      @nb_hands = nb_hands
    end
    #------------------------------------------------------------------------
    # * Returns the number of attack the weapon can do
    #------------------------------------------------------------------------
    def set_nb_attacks
      if G7_MS_MOD::DOUBLE_ATTACK_WEAPONS.include?(self.id) then
        nb_attacks = 2
      else
        nb_attacks = 1
      end
      pattern = /\((\d+)#{G7_MS_MOD::MULTI_ATTACK_STRING}\)/
      if @name.sub!(pattern, '') != nil
        nb_attacks = $1.downcase.delete('a-z')
        nb_attacks = $1.to_i
      end
      # Search elements that could add more attacks 
      for elementnb in self.element_set
        elementname = $data_system.elements[elementnb].downcase
        # If the weapon has an element for another attack
        if elementname.delete('0-9') == G7_MS_MOD::MULTI_ATTACK_ELEMENT.downcase
          # Get the number of attacks
          elementname = elementname.delete('a-z')
          if elementname != '' then
            nb_attacks = elementname.to_i
            # Delete the element
            self.element_set.delete(elementnb)
          end
        end
      end
      if nb_attacks.is_a?(Integer) == false or nb_attacks <= 0 then nb_attacks = 1 end
      @nb_attacks = nb_attacks
    end
    #------------------------------------------------------------------------
    # * End of CLASS:  Weapon
    #------------------------------------------------------------------------
  end
  #--------------------------------------------------------------------------
  # * End of MODULE:  RPG Module
  #--------------------------------------------------------------------------
end


Spoiler: ShowHide
#==============================================================================
# Multi-slot equipment script
#------------------------------------------------------------------------------
# Section 2:  Actor
#------------------------------------------------------------------------------
# Guillaume777
# 6.2.1
# 2006/02/14
#==============================================================================

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  include G7_MS_MOD
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :equip_mode         # To restore equipment after false equip
  attr_accessor :equip_type_force   # To bypass equip_type
  attr_accessor :equip_from_menu    # To prevent users to unequip cursed items
  attr_accessor :translucent_texts  # To store translucents slots
  #--------------------------------------------------------------------------
  # * Setup (Initializing new Slots)
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  alias g7_ms_game_actor_setup setup
  def setup(actor_id)
    g7_ms_game_actor_setup(actor_id) #setup normaly
    self.order_armor_ids
  end
  #--------------------------------------------------------------------------
  # * Number of Offhand Required
  #     ignore   : ignore 
  #--------------------------------------------------------------------------
  def nb_offhand_required(ignore=nil)
    nb_offhand = 0
    nb_need_offhand = 0
    for i in 0...self.weapon_slots.size
      if i != ignore then
        weapon = self.weapon_ids[i]
        if weapon == 0 then
          nb_offhand += 1
        elsif $data_weapons[weapon].needs_offhand then
          nb_need_offhand += 1
        else
          nb_offhand += 1
        end
      end
    end
    return (nb_need_offhand - nb_offhand)
  end
 
  #--------------------------------------------------------------------------
  # * Change Equipment ( Modified for extra equipment)
  #     equip_type : type of equipment
  #     id    : weapon or armor ID (If 0, remove equipment)
  #--------------------------------------------------------------------------
  alias g7_ms_game_actor_equip equip
  def equip(equip_type, id)
    if @equip_type_force != nil then equip_type = @equip_type_force end
    # equip_type_force is used to bypass the equip_type argument
    if self.equip_mode == 'STORE' then
    # Store equipment for it to be restored after checking what the stats would 
      self.equip_mode = nil
      @stored_armors = self.armor_ids.dup
      @stored_weapons = self.weapon_ids.dup
      saved_mode = 'STORE'
    elsif self.equip_mode == 'RESTORE'
      # Restore equipment after preview of new equipment on stats
      self.equip_mode = nil
      self.restore(equip_type)
      return
    # If equipped for real
    else
      if self.enough_hands?(equip_type,id) != false then
        # Switch items to be equipped to fool the players
        id = self.switch_items(equip_type,id)
      end
    end
    # If not enough hands then don't equip
    if self.enough_hands?(equip_type,id) == false then
      id = 0
    # If cursed and player tried to remove it, do nothing
    elsif self.equip_from_menu and self.cursed?(equip_type) then
      id = 0
    # If the slot is one of the 5 basic ones
    elsif equip_type <= 4
      # Equip the goold old way
      g7_ms_game_actor_equip(equip_type, id)
    else
      # Equip in the new way
      equip_extra(equip_type,id) #equip in the new way
    end
    # Fix in case there are no enough empty hands for all the equipped weapons
    if id != 0 then self.fix_handed_weapons(equip_type) end
    # This ensure that the next equiping will restore the original equipment
    if saved_mode == 'STORE' then  self.equip_mode = 'RESTORE'  end
  end
  #--------------------------------------------------------------------------
  # * Restore Equipment once the stats are checked and adds translucent
  #     equip_type : type of equipment
  #--------------------------------------------------------------------------
  def restore(equip_type)
    if self.translucent_texts == nil then self.translucent_texts = Array.new end
    self.equip_from_menu = false
    if equip_type != 0 and @stored_weapons[0] != self.weapon_ids[0]
      self.translucent_texts[0] = true
    end
    for i in 1...@stored_weapons.size
      if i+[self.armor_slots.size,4].max != equip_type  and 
        @stored_weapons[i] != self.weapon_ids[i] then
        self.translucent_texts[i] = true
      end
    end
    for i in 0...@stored_armors.size
      if  i+1 != equip_type  and 
        @stored_armors[i] != self.armor_ids[i] then
        self.translucent_texts[self.weapon_slots.size + i] = true
      end
    end
    @equip_type_force = nil 
    copy = self.translucent_texts.dup
    self.weapon_ids = @stored_weapons
    self.armor_ids = @stored_armors
    self.translucent_texts = copy
  end
  #--------------------------------------------------------------------------
  # * Switch Items.  Switches equipment to fool a player.
  #     equip_type : type of equipment
  #     id         : id
  #--------------------------------------------------------------------------
  def switch_items(equip_type,id)
    if self.cursed?(equip_type) == false then
      if equip_type == 0 or equip_type > [self.armor_slots.size,4].max
        for i in 0...SWITCH_EQUIP_WEAPONS.size
          if SWITCH_EQUIP_WEAPONS[i][0] == id then
            $game_party.lose_weapon(SWITCH_EQUIP_WEAPONS[i][0], 1)
            $game_party.gain_weapon(SWITCH_EQUIP_WEAPONS[i][1], 1)
            id = SWITCH_EQUIP_WEAPONS[i][1]
          end
        end
      else           
        for i in 0...SWITCH_EQUIP_ARMORS.size
          if SWITCH_EQUIP_ARMORS[i][0] == id  then
            $game_party.lose_armor(SWITCH_EQUIP_ARMORS[i][0], 1)
            $game_party.gain_armor(SWITCH_EQUIP_ARMORS[i][1], 1)
            id = SWITCH_EQUIP_ARMORS[i][1]
          end
        end
      end
    end
    return id
  end
  #--------------------------------------------------------------------------
  # * Enough Hands?  Returns if there are enough hands to hold a weapon
  #     equip_type : type of equipment
  #     id         : ID
  #--------------------------------------------------------------------------
  def enough_hands?(equip_type, id)
    # Enough Hand = true if you unequip something
    if id == 0 then return true end
    # If it's a weapon 
    if equip_type == 0 or equip_type > [self.armor_slots.size ,4].max
      nb = $data_weapons[id].nb_hands
    elsif self.weapon_shield_share and self.armor_slots[equip_type-1] == self.shield_hand_slot
      nb = 1
    else
      return true #return true if not shield or weapon
    end
    nb_s = 0 #nb shield slots
    if self.shield_hand_wield then
      for i in 0...self.armor_slots.size
        if self.armor_slots[i] == self.shield_hand_slot
          if self.weapon_shield_share != true then nb_s += 1  end
          if self.cursed?(i+1) then nb += 1 end
        end
      end
    end
    if self.weapon_hand_wield
      if self.cursed?(0) then # Penalities if can't remove first weapon
        nb = nb +  $data_weapons[self.weapon_ids[0]].nb_hands
      end
      for i in 1...self.weapon_slots.size # Penalities if cant remove weapon
        if self.cursed?(self.armor_slots.size + i)
          nb = nb +  $data_weapons[self.weapon_ids[i]].nb_hands
        end
      end
    end
    if nb == 1 then # If it only takes 1 hand to hold
      return true
    elsif nb > nb_s+1 and self.weapon_hand_wield != true
      return false
    elsif nb > self.weapon_slots.size+ nb_s and self.weapon_hand_wield
      return false
    elsif self.shield_hand_wield != true and self.weapon_hand_wield != true
      return false
    else
      return true
    end
  end
  #--------------------------------------------------------------------------
  # * Equip Weapon
  #     index : Index of weapon
  #     id    : weapon ID (If 0, remove equipment)
  #--------------------------------------------------------------------------
  def equip_weapon(index,id)
    if index == 0 then
      self.equip(0, id)
    else
      self.equip([self.armor_slots.size, 4].max + index, id)
    end
  end
  #--------------------------------------------------------------------------
  # * Equip Armor
  #     index : Index of armor
  #     id    : armor ID (If 0, remove equipment)
  #--------------------------------------------------------------------------   
  def equip_armor(index, id)
    self.equip(index+1, id)
  end
  #--------------------------------------------------------------------------
  # * Equip Extra Items
  #     equip_type : Index of item being equipped
  #     id         : ID if either armor or weapon (If 0, remove equipment)
  #--------------------------------------------------------------------------
  def equip_extra(equip_type,id)
    # If its an extra armor slot
    if equip_type <= [self.armor_slots.size,4].max
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[self.armor_ids[equip_type-1]], $data_armors[id])
        $game_party.gain_armor(self.armor_ids[equip_type-1], 1)
        self.armor_ids[equip_type-1] = id
        $game_party.lose_armor(id, 1)
      end
    # If its a weapon slot
    else
      if id == 0 or $game_party.weapon_number(id) > 0
        equip_type = equip_type - [self.armor_slots.size, 4].max
        weapon = self.weapon_ids[equip_type]
        if weapon != nil then
          $game_party.gain_weapon(weapon, 1)
        end
        self.weapon_ids[equip_type] = id
        $game_party.lose_weapon(id, 1)
      end
    end
  end

  #--------------------------------------------------------------------------
  # * Fix Multi-Handed Weapons
  #     equip_keep : ID of weapon to keep
  #--------------------------------------------------------------------------
  def fix_handed_weapons(equip_keep=nil)
    array_wield_hands = Array.new         # Stores the slot of the weapon that
                                          # needs empty hands
    nb_emp_hands = 0                      # Store nb of empty hands
    penalities = 0                        # Stores extra hand required
    save_force = @equip_type_force
    save_menu = @equip_from_menu
    @equip_from_menu = false
    @equip_type_force = nil
    if self.shield_hand_wield
      for narmor in 0...self.armor_slots.size
        if self.armor_slots[narmor] == self.shield_hand_slot
          if self.weapon_shield_share == true then
            penalities += 1
          end
          if self.armor_ids[narmor] == 0 then
            nb_emp_hands += 1             # Stores empty shield hand
          end
        end
      end
    end
    for nweapon in 0...self.weapon_slots.size
      if self.weapon_ids[nweapon] == 0
        if self.weapon_hand_wield then
          nb_emp_hands += 1
        end
      else
        array_wield_hands.push(nweapon)   # Stores the hand to wield weapon
      end
    end
    for nweapon in Rg(array_wield_hands.size-1, 0, -1)
      if self.weapon_ids[array_wield_hands[nweapon]] != 0 then
        nb_hands = $data_weapons[self.weapon_ids[array_wield_hands[nweapon]]].nb_hands
        nb_hands += penalities
        penalities = 0
        save_hands = nb_hands
      end
      # If it finds an empty hand
      while nb_emp_hands != 0 and nb_hands > 1
        # Decrease the counter
        nb_hands += -1
        nb_emp_hands += -1
      end
      #if shield needs to be removed for empty hand
      if self.shield_hand_wield  then
        for namor in 0...self.armor_slots.size
          if nb_hands > 1 and self.armor_ids[namor] != 0 and
          self.armor_slots[namor] == self.shield_hand_slot and
          namor+1 != equip_keep and self.cursed?(namor+1) == false then
            nb_hands += -1
            self.equip(namor+1,0)
          end
        end
      end
      #if it must remove weapons to make room for empty hands
      if self.weapon_hand_wield == true then
        for nhand in Rg(self.weapon_slots.size-1, 0, -1)
          if nb_hands > 1 and self.weapon_ids[nhand] != 0
            if nhand == 0 then
              if equip_keep != 0 and self.cursed?(0) == false then
                n = nb_emp_hands
                nb_emp_hands += $data_weapons[self.weapon_ids[nhand]].nb_hands
                n = nb_emp_hands - n
                self.equip(0,0)
              end
            else
              if nhand+[self.armor_slots.size,4].max != equip_keep and
              self.cursed?(nhand+[self.armor_slots.size,4].max) == false
              then
                if nhand < array_wield_hands[nweapon] then
                  nb_emp_hands += 1
                else
                  nb_emp_hands += $data_weapons[self.weapon_ids[nhand]].nb_hands
                end
                self.equip([self.armor_slots.size,4].max+nhand, 0)     
              end
            end   # End of ( if nhnad == 0 )
          end     # End of ( if nb_hands != 1 )
          while nb_emp_hands != 0 and nb_hands > 1
            #if it finds empty hand
            nb_hands += -1 #decrease counter
            nb_emp_hands += -1
          end   
        end   # End of ( for nahand )
      end     # End of ( if self.weapon )
      # If still can't find a slot, remove the weapon
      if nb_hands > 1
        if array_wield_hands[nweapon] == 0 and self.cursed?(0) == false then
          nb_emp_hands = 1 + nb_emp_hands + save_hands - nb_hands
          self.equip(0, 0)
        elsif self.cursed?(array_wield_hands[nweapon]+[self.armor_slots.size,4].max) == false and
        array_wield_hands[nweapon] != 0 then
          nb_emp_hands = 1 + nb_emp_hands + save_hands - nb_hands
          self.equip(array_wield_hands[nweapon]+[self.armor_slots.size,4].max,0)
        end
      end
      # If it finds an empty hand
      while nb_emp_hands != 0 and nb_hands > 1
        # Decrease the counter     
        nb_hands += -1
        nb_emp_hands += -1
      end
      # If STILL not enough hands
      if nb_hands > 1 then
        # Remove the item the user tried to equip
        self.equip(equip_keep,0)
      end
    end
    @equip_type_force = save_force # Returns old equip_type_force
    @equip_from_menu = save_menu   # Return old equip_from_menu
  end
  #--------------------------------------------------------------------------
  # * Cursed Items
  #     equip_type : ID if either armor or weapon
  #--------------------------------------------------------------------------
  def cursed?(equip_type)
    if equip_type == 0
      weapon_id = self.weapon_ids[0]
      if weapon_id != 0 and $data_weapons[weapon_id].cursed then return true end
    # If Armor   
    elsif equip_type <= self.armor_slots.size
      armor_id = self.armor_ids[equip_type - 1]
      if armor_id != 0 and $data_armors[armor_id].cursed then return true end
    else
      weapon_id = self.weapon_ids[equip_type - [self.armor_slots.size, 4].max]
      if weapon_id != nil and weapon_id != 0 and $data_weapons[weapon_id].cursed then return true end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Remove all cursed items
  #--------------------------------------------------------------------------
  def remove_curse
    self.equip_type_force = nil
    for i in 0...(self.weapon_slots.size + self.armor_slots.size)
      if self.cursed?(i) then self.equip(i,0) end
    end
  end
  #--------------------------------------------------------------------------
  # * Order Armor IDs for Slots
  #--------------------------------------------------------------------------
  def order_armor_ids
    equipment_array = Array.new
    for i in 0...self.armor_ids.size
      if self.armor_ids[i] != nil and self.armor_ids[i] != 0
        kind = $data_armors[self.armor_ids[i]].kind
        if equipment_array[kind] == nil then
          equipment_array[kind] = Array.new
        end
        equipment_array[kind].push(self.armor_ids[i])
        #array in which 0 = array for shield, 1 = array for helmet,
        #2 = array for armor and 3 = array for accessory, etc
      end
    end
    self.armor_ids = nil # Remove all armors
    armors = Array.new
    for i in 0...self.armor_slots.size
      aitem = nil
      if equipment_array[(self.armor_slots[i])-1] == nil then
        equipment_array[(self.armor_slots[i])-1] = Array.new
      end
      while aitem == nil and equipment_array[(self.armor_slots[i])-1].size != 0
        aitem = equipment_array[(self.armor_slots[i])-1].delete_at(0)
        if aitem == 0 then aitem = nil end
      end
      if aitem != nil then
        armors.push(aitem)  # Adds armor
      else
        armors.push(0)      # Adds empty
      end   # End of ( if iaitem != nil )
    end     # End of ( for i in  )
    self.armor_ids = armors
  end
  #-------------------------------------------------------------------------- 
  # * Change Weapon Slots
  #     array      : Array for weapon slots
  #--------------------------------------------------------------------------
  def weapon_slots=(array)                        # Change slots of weapons
    if array == nil then array = WEAPON_KINDS end # Use default slots
      weapon_array = Array.new(self.weapon_ids)   # Save weapons
      self.weapon_ids = nil
      @weapon_slots = Array.new(array)            # New slots
      self.weapon_ids = weapon_array              # Re-equip items
      i = self.weapon_ids.size
      while self.nb_offhand_required > 1
        if self.weapon_ids[i] != nil and self.weapon_ids[i] != 0 then
          self.equip_weapon(i,0)
        end
      i = i-1
    end
  end

  #-------------------------------------------------------------------------- 
  # * Change Armor Slots
  #     array      : Array for armor slots
  #--------------------------------------------------------------------------
  def armor_slots=(array) # change slots of armor
    if array == nil then array = ARMOR_KINDS end #returns to default if nothing
    equipment_array = Array.new
    for i in 0...[array.max, self.armor_slots.max].max+1
      if equipment_array[i] == nil then
        equipment_array[i] = Array.new
      end
    end
    for i in 0...self.armor_ids.size
      if self.armor_ids[i] != nil and self.armor_ids[i] != 0 then
        kind = $data_armors[self.armor_ids[i]].kind + 1
        equipment_array[kind].push(self.armor_ids[i])
        # Array in which 0 = array for shield, 1 = array for helmet,
        # 2 = array for armor and 3 = array for accessory, etc
      end
    end
    for kind in 0...[array.max, self.armor_slots.max].max+1
      if array.include?(kind) and self.armor_slots.include?(kind) then
        nb_i_new = 0
        nb_i_old = 0
        for i in 0...self.armor_slots.size
          if self.armor_slots[i] == kind then nb_i_old += 1 end
        end
        for i in 0...array.size
          if array[i] == kind then nb_i_new += 1 end
        end
        for i in nb_i_new...nb_i_old
          for k in 0...equipment_array[kind].size
            index = equipment_array[kind].index(0)
            if index != nil then
              equipment_array[kind].delete_at(index)
            end
          end
        end
      end
    end
    self.armor_ids = nil        # Remove items
    @armor_slots = array        # New array
    for i in 0...self.armor_slots.size
      aitem = nil
      kind = self.armor_slots[i]
      if equipment_array[kind].size != 0
        aitem = equipment_array[kind].delete_at(0)
        self.equip(i+ 1,aitem)  # Adds armor
      else
        self.equip(i+ 1,0)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Set new array of weapons, if nil then it removes all weapon
  #     array      : Array of weapon IDs
  #--------------------------------------------------------------------------
  def weapon_ids=(array)  # Be careful.  @item_type_force needs to be nil!
    if array == nil then
      self.equip(0, 0)    # Remove first weapon
      for i in 1...self.weapon_ids.size
        self.equip(i + [self.armor_slots.size,4].max, 0 ) # Remove all weapons
      end
      return
    end
    self.weapon_ids = nil
    for i in 0...self.weapon_slots.size
      # Ensure no weapons are equipped
      if array[i] == nil then array[i] = 0 end
      if i == 0 then            # If first weapon
        self.equip(0, array[i]) # Equip weapon
      else                      # Else if extra weapons
        self.equip(i + [self.armor_slots.size, 4].max, array[i])
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Set new array of armors in ordered fashion
  #     array      : Array of armor IDs
  #--------------------------------------------------------------------------
  def armor_ids=(array)
    if array == nil then
      for i in 0...self.armor_slots.size
        self.equip(i + 1, 0)      # Remove all armors
      end
      return
    end
    self.armor_ids = nil          # Remove all armors
    for i in 0...self.armor_slots.size
      self.equip(i+ 1, array[i])  # Adds armor
    end
  end
  #--------------------------------------------------------------------------
  # * Return @armor_ids
  #--------------------------------------------------------------------------
  def armor_ids
    # Returns ids with all armor, also store 4 armor
    unless self.is_a?(Game_Actor)
      return []
    end
    if @armor_ids == nil then @armor_ids = Array.new(self.armor_slots.size) end
    ids = @armor_ids
    ids[0] = @armor1_id
    ids[1] = @armor2_id
    ids[2] = @armor3_id
    ids[3] = @armor4_id
    # Ensure no nil values are returned
    for i in 0...self.armor_slots.size
      if ids[i] == nil then ids[i] = 0 end
    end
    return ids
  end
  #--------------------------------------------------------------------------
  # * Return @Weapon_ids
  #--------------------------------------------------------------------------
  def weapon_ids
    # Returns ids with all weapon, also store first weapon
    unless self.is_a?(Game_Actor)
      return []
    end
    if @weapon_ids == nil then @weapon_ids = Array.new(self.weapon_slots.size) end
    ids = @weapon_ids
    ids[0] = @weapon_id
    # Ensure no nil values are returned
    for i in 0...self.weapon_slots.size
      if ids[i] == nil then ids[i] = 0 end
    end
    return ids
   end
  #--------------------------------------------------------------------------
  # * Returns names of armor
  #--------------------------------------------------------------------------
  def armor_slot_names
    # Return custom words for slots, or default ones
    if @armor_slot_names == nil then @armor_slot_names = Array.new end
    temp_array = Array.new(@armor_slot_names)
    # Default names of slots
    default_names = [$data_system.words.armor1,$data_system.words.armor2,$data_system.words.armor3,$data_system.words.armor4, self.extra_slot_names].flatten #default names of slots
    for i in 0...default_names.size
      if temp_array[i] == nil then temp_array[i] = default_names[i] end # If not
      # Custom then set as default
      if temp_array[i] == nil then temp_array[i] = $data_system.words.armor4 end
    end
    return temp_array
  end
  #--------------------------------------------------------------------------
  # * Returns names of weapons
  #--------------------------------------------------------------------------
  def weapon_slot_names
    # Return custom words for weapon slots, of default ones
    if @weapon_slot_names != nil then
      temp_array = Array.new(@weapon_slot_names)      # Use the custom values
    else
      temp_array = Array.new(self.weapon_slots.size)  # Use default values
    end
    default_names = WEAPON_KIND_NAMES                 # Default names of slots
    for i in 0...self.weapon_slots.size
      # If... Set as Constant     
      if temp_array[i] == nil then temp_array[i] = default_names[i] end
      if temp_array[i] == nil then temp_array[i] = $data_system.words.weapon end
      # If constant array is empty then use default one
    end
    return temp_array
  end
  #--------------------------------------------------------------------------
  # * Return all element of all equipped armor
  #--------------------------------------------------------------------------
  def guard_element_set
    # Return array with guard_element_set of all equipped armor
    set = []
    # Search all armor equipped
    for id in self.armor_ids
      next if id.nil?
      armor = $data_armors[id]
      # Add the element to set     
      set += (armor != nil ? armor.guard_element_set : [])
    end
    return set
  end
  #--------------------------------------------------------------------------
  # * Return all equipment
  #--------------------------------------------------------------------------
  def equipments
    # Return array with all equipment
    equipments = []
    self.weapon_ids.each {|id| equipments.push($data_weapons[id])}
    self.armor_ids.each {|id| equipments.push($data_armors[id])}
    return equipments
  end
  #--------------------------------------------------------------------------
  # * Return if item is equiped
  #--------------------------------------------------------------------------
  def equiped?(item)
    # Return if item is equipped, works with both armor and weapon
    case item
    when RPG::Weapon
      return self.weapon_ids.include?(item.id)
    when RPG::Armor
      return self.armor_ids.include?(item.id)
    else
      return false
    end
  end
  #-------------------------------------------------------------------------- 
  # * Return list of weapons to use for attacks
  #--------------------------------------------------------------------------
  def attacks # This return an array with the list of all attacks of a character
              # This takes in consideration extra weapon + number of attacks of
              # each weapon
    attacks = Array.new
    for i in 0...self.weapon_ids.size
      weapon = $data_weapons[self.weapon_ids[i]]
      # If the weapon is valid     
      if weapon != nil and weapon.atk != 0 then
        for counter in 0...weapon.nb_attacks
          attacks.push(i) #add attacks
        end
      end
    end
    # Give one unarmed attack if no weapons on   
    if attacks.size == 0 then attacks[0] = 0 end
    return Array.new(attacks)
  end
  #--------------------------------------------------------------------------
  # * Get the weapon to be used in attack
  #--------------------------------------------------------------------------
  def get_weapon_data
    # This returns the weapon to use for the attack.
    weaponid = self.weapon_ids[self.attacks[self.attack_count]]
    weapon = $data_weapons[weaponid]
    return weapon
  end
  #--------------------------------------------------------------------------
  # * Get Offensive Animation ID for Normal Attacks
  #--------------------------------------------------------------------------
  def animation1_id
    # Set animation for current weapon
    weapon = self.get_weapon_data
    return weapon != nil ? weapon.animation1_id : 0
  end
  #--------------------------------------------------------------------------
  # * Get Target Animation ID for Normal Attacks
  #--------------------------------------------------------------------------
  def animation2_id
    # Set animation for current weapon
    weapon = self.get_weapon_data
    return weapon != nil ? weapon.animation2_id : 0
  end
  #--------------------------------------------------------------------------
  # * Get Basic Attack Power
  #   Get the atk to be used in attack ( or shown in menu screen )
  #--------------------------------------------------------------------------
  def base_atk
    multiplier = nil
    if $game_temp.in_battle and (self.current_action.kind == 0 or self.all_weapons_for_skills? != true)
      # If in battle & doing a normal attack, only use one weapon's attack power
      weapon = self.get_weapon_data
      n = weapon != nil ? weapon.atk : 0
      # Multiplier of hand as defined in self.weapon_slot_powers
      if weapon != nil and weapon.nb_hands == 1 then
        multiplier =  self.weapon_slot_powers[self.attacks[self.attack_count]]
      end
      if multiplier == nil then multiplier = 100 end
      n = n * (multiplier/100.0)
    else # Use cumulative attack power of all weapons if in status screen or
         # if using skill and all_weapons_for_skills == true
      n = 0
      for i in 0...self.weapon_slots.size
        weapon = $data_weapons[self.weapon_ids[i]]
        atk = weapon != nil ? weapon.atk : 0
        if weapon != nil and weapon.nb_hands == 1 then
          multiplier =  self.weapon_slot_powers[i]
        else
          multiplier = nil
        end
        if multiplier == nil then multiplier = 100 end
        atk = atk * (multiplier/100.0)
        n += atk
      end
    end
    nb_weap = 0
    for i in 0...self.weapon_slots.size
      if self.weapon_ids[i] != nil and self.weapon_ids[i] != 0
        nb_weap = nb_weap + 1
      end
    end # Penality if more than 1 weapon
    penality = self.multi_weapons_penality != nil ? self.multi_weapons_penality : 0
    penality = penality /100.0
    if nb_weap > 1 then n = n * ( 1 - penality ) end
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Normal Attack Element
  #--------------------------------------------------------------------------
  def element_set
    # Return elemental set of the current weapon
    weapon = self.get_weapon_data
    return weapon != nil ? weapon.element_set : []
  end
  #--------------------------------------------------------------------------
  # * Get Normal Attack State Change (+)
  #-------------------------------------------------------------------------- 
  def plus_state_set
    # Status the weapon can give
    weapon = self.get_weapon_data
    return weapon != nil ? weapon.plus_state_set : []
  end
  #--------------------------------------------------------------------------
  # * Get Normal Attack State Change (-)
  #-------------------------------------------------------------------------- 
  def minus_state_set
    # Status the weapon can remove
    weapon = self.get_weapon_data
    return weapon != nil ? weapon.minus_state_set : []
  end
  #--------------------------------------------------------------------------
  # * Determine State Guard
  #     state_id : state ID
  #--------------------------------------------------------------------------
  def state_guard?(state_id)
    # Return state defense of all armor
    for i in self.armor_ids
      armor = $data_armors[i]
      if armor != nil
        if armor.guard_state_set.include?(state_id)
          return true
        end
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Get Element Revision Value
  #     element_id : element ID
  #--------------------------------------------------------------------------
  alias g7_ms_game_actor_element_rate element_rate
  def element_rate(element_id)
    result = g7_ms_game_actor_element_rate(element_id)
    # Methods calculate bonus of extra weapon and armor
    if self.armor_slots.size > 4
      for i in 4...self.armor_slots.size
        armor = $data_armors[self.armor_ids[i]]
        if armor != nil and armor.guard_element_set.include?(element_id)
          result /= 2
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Get Basic Strength
  #--------------------------------------------------------------------------
  alias g7_ms_game_actor_base_str base_str
  def base_str
    n = g7_ms_game_actor_base_str
    for i in 1...self.weapon_slots.size
      weapon = $data_weapons[self.weapon_ids[i]]
      n += weapon != nil ? weapon.str_plus : 0
    end
    for i in 4...self.armor_slots.size
      armor = $data_armors[self.armor_ids[i]]
      n += armor != nil ? armor.str_plus : 0
    end
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Dexterity
  #--------------------------------------------------------------------------
  alias g7_ms_game_actor_base_dex base_dex
  def base_dex
    n = g7_ms_game_actor_base_dex
    for i in 1...self.weapon_slots.size
      weapon = $data_weapons[self.weapon_ids[i]]
      n += weapon != nil ? weapon.dex_plus : 0
    end
    for i in 4...self.armor_slots.size
      armor = $data_armors[self.armor_ids[i]]
      n += armor != nil ? armor.dex_plus : 0
    end
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Agility
  #--------------------------------------------------------------------------
  alias g7_ms_game_actor_base_agi base_agi
  def base_agi
    n = g7_ms_game_actor_base_agi
    for i in 1...self.weapon_slots.size
      weapon = $data_weapons[self.weapon_ids[i]]
      n += weapon != nil ? weapon.agi_plus : 0
    end
    for i in 4...self.armor_slots.size
      armor = $data_armors[self.armor_ids[i]]
      n += armor != nil ? armor.agi_plus : 0
    end
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Intelligence
  #--------------------------------------------------------------------------
  alias g7_ms_game_actor_base_int base_int
  def base_int
    n = g7_ms_game_actor_base_int
    for i in 1...self.weapon_slots.size
      weapon = $data_weapons[self.weapon_ids[i]]
      n += weapon != nil ? weapon.int_plus : 0
    end
    for i in 4...self.armor_slots.size
      armor = $data_armors[self.armor_ids[i]]
      n += armor != nil ? armor.int_plus : 0
    end
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Physical Defense
  #--------------------------------------------------------------------------
  alias g7_ms_game_actor_base_pdef base_pdef
  def base_pdef
    n = g7_ms_game_actor_base_pdef
    for i in 1...self.weapon_slots.size
      weapon = $data_weapons[self.weapon_ids[i]]
      n += weapon != nil ? weapon.pdef : 0
    end
    for i in 4...self.armor_slots.size
      armor = $data_armors[self.armor_ids[i]]
      n += armor != nil ? armor.pdef : 0
    end
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Magic Defense
  #--------------------------------------------------------------------------
  alias g7_ms_game_actor_base_mdef base_mdef
  def base_mdef
    n = g7_ms_game_actor_base_mdef
    for i in 1...self.weapon_slots.size
      weapon = $data_weapons[self.weapon_ids[i]]
      n += weapon != nil ? weapon.mdef : 0
    end
    for i in 4...self.armor_slots.size
      armor = $data_armors[self.armor_ids[i]]
      n += armor != nil ? armor.mdef : 0
    end
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Evasion Correction
  #--------------------------------------------------------------------------
  alias g7_ms_game_actor_base_eva base_eva
  def base_eva
    n = g7_ms_game_actor_base_eva
    for i in 4...self.armor_slots.size
      armor = $data_armors[self.armor_ids[i]]
      n += armor != nil ? armor.eva : 0
    end
    return n
  end
  #--------------------------------------------------------------------------
  # * Reset all slot data to default one
  #--------------------------------------------------------------------------
  def reset_all_slots
    self.armor_slots = nil
    self.weapon_slots = nil
    self.armor_slot_names = nil
    self.weapon_slot_names = nil
    self.extra_slot_names = nil
    self.weapon_slot_powers = nil
    self.shield_hand_wield = nil
    self.weapon_hand_wield = nil
    self.shield_hand_slot = nil
    self.weapon_shield_share = nil
    self.multi_weapons_penality = nil
    self.ignore_offhand = nil
    self.all_weapons_for_skills = nil
  end
  #--------------------------------------------------------------------------
  # * Returns behavior of items on character
  #--------------------------------------------------------------------------
  def weapon_shield_share
    return @weapon_shield_share != nil ? @weapon_shield_share : WEAPON_SHIELD_SHARE
  end
  def weapon_slots
    return @weapon_slots != nil ? @weapon_slots : WEAPON_KINDS
  end
  def armor_slots
    return @armor_slots != nil ? @armor_slots : ARMOR_KINDS
  end
  def shield_hand_wield
    return @shield_hand_wield != nil ? @shield_hand_wield : SHIELD_HAND_WIELD
  end
  def multi_weapons_penality
    return @multi_weapons_penality != nil ? @multi_weapons_penality : MULTI_WEAPONS_PENALITY
  end
  def weapon_slot_powers
    return @weapon_slot_powers != nil ? @weapon_slot_powers : WEAPON_KIND_POWERS
  end
  def weapon_hand_wield
    return @weapon_hand_wield != nil ? @weapon_hand_wield : WEAPON_HAND_WIELD
  end
  def shield_hand_slot
    return @shield_hand_slot != nil ? @shield_hand_slot : SHIELD_HAND_SLOT
  end
  def extra_slot_names
    return @extra_slot_names != nil ? @extra_slot_names : EXTRA_SLOT_NAMES
  end
  def ignore_offhand?
    return @ignore_offhand != nil ? @ignore_offhand : IGNORE_OFFHAND
  end
  def attack_count
    # Returns number of attacks already made
    return @attack_count != nil ? @attack_count : 0
  end
  def all_weapons_for_skills?
    return @all_weapons_for_skills != nil ? @all_weapons_for_skills : ALL_WEAPONS_FOR_SKILLS
  end
  #--------------------------------------------------------------------------
  # * Change behavior of items on character
  #--------------------------------------------------------------------------
  def multi_weapons_penality=(value)
    @multi_weapons_penality = value
  end
  def weapon_slot_powers=(value)
    @weapon_slot_powers = value
  end
  def weapon_shield_share=(bool)
    @weapon_shield_share = bool
  end
  def shield_hand_slot=(int)
    @shield_hand_slot = int
  end
  def shield_hand_wield=(bool)
    @shield_hand_wield = bool
  end
  def weapon_hand_wield=(bool)
    @weapon_hand_wield = bool
  end
  def ignore_offhand=(bool)
    @ignore_offhand = bool
  end
  def all_weapons_for_skills=(bool)
    @all_weapons_for_skills = bool
  end
  def attack_count=(value)
    # Set number of attacks already made
    @attack_count = value
  end
  #--------------------------------------------------------------------------
  # * Change names for your slots
  #--------------------------------------------------------------------------
  def shield_name=(text)
    # Set the shield slot name with...
    # $game_actors[numberofactor].shield_name = 'Yourname'
    @armor_slot_names[0] = text
  end
  def helmet_name=(text)
    @armor_slot_names[1] = text
  end
  def armor_name=(text)
    @armor_slot_names[2] = text
  end
  def accessory_name=(text)
    @armor_slot_names[3] = text
  end
  def extra_slot_names=(array)
    @extra_slot_names = array
  end
  def armor_slot_names=(array)
    # Set a new array of names.
    @armor_slot_names = array
  end
  def weapon_slot_names=(array)
    # Set a new array of weapon names.
    @weapon_slot_names = array
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Game Actor
  #-------------------------------------------------------------------------- 
end



#==============================================================================
# ** Game_Actors
#------------------------------------------------------------------------------
#  This class handles the actor array. Refer to "$game_actors" for each
#  instance of this class.
#==============================================================================

class Game_Actors
  #--------------------------------------------------------------------------
  # * Order Items
  #-------------------------------------------------------------------------- 
  def order_items
    for actor in 0...@data.size
      if @data[actor] != nil and @data[actor] != 0 then
        # Order armors
        @data[actor].order_armor_ids
      end
    end
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Game Actors
  #-------------------------------------------------------------------------- 
end


Spoiler: ShowHide
#==============================================================================
# Multi-slot equipment script
#------------------------------------------------------------------------------
# Section 3:  Windows
#------------------------------------------------------------------------------
# Guillaume777
# 6.2.1
# 2006/02/14
#==============================================================================

#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
#  This class performs equipment screen processing.
#==============================================================================
class Scene_Equip
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias g7_ms_scene_equip_main main
  def main
    @additional_initialize_done = false
    g7_ms_scene_equip_main
    for i in 5...@item_windows.size
      @item_windows[i].dispose unless @item_windows[i].nil?
    end
  end
  #--------------------------------------------------------------------------
  # * Initialize the extra right windows
  #--------------------------------------------------------------------------
  def g7_ms_scene_equip_additional_initialize
  unless @additional_initialize_done
    @item_windows = []
    @item_windows[0] = @item_window1  # Weapon
    @item_windows[1] = @item_window2  # Shield
    @item_windows[2] = @item_window3  # Helmet
    @item_windows[3] = @item_window4  # Armor
    @item_windows[4] = @item_window5  # Accessory
    nb_old_windows = @item_windows.size
    for i in nb_old_windows...@actor.armor_slots.max+1
      # Add the remaining windows for extra slots
      @item_windows.push(Window_EquipItem.new(@actor, i) )
      @item_windows[i].help_window = @help_window
    end
    @item_windows.push(Window_EquipOffHand.new(@actor, 0))
    @item_windows[-1].help_window = @help_window
    # If windows_stretch is true, stretch window
    if G7_MS_MOD::WINDOWS_STRETCH
      h = (@actor.weapon_slots.size + @actor.armor_slots.size + 1) * 32
      h2 = (G7_MS_MOD::MAX_SHOW_SLOTS+1) * 32
      h = [h, h2].min
      @right_window.height = h
      if @right_window.index > @actor.weapon_slots.size + @actor.armor_slots.size - 1
        @right_window.index = @actor.weapon_slots.size + @actor.armor_slots.size - 1
      end
      if @left_window.y + @left_window.height == 256
        @left_window.height = @right_window.height
      elsif G7_MS_MOD::HELP_AT_BOTTOM == true and @left_window.height == 416 then
        # Make left window shorter
        @left_window.height -= 64
      end
      y_pos = (@right_window.y + @right_window.height)
      y_space = 480 - y_pos
      # If help at bottom, reduce bottom item window size
      if G7_MS_MOD::HELP_AT_BOTTOM == true then y_space -= 64  end
      for item_window in @item_windows
        next if item_window.nil?
        item_window.y = y_pos
        item_window.height = y_space
      end
    end
    @additional_initialize_done = true
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh and make visible the correct right window
  #--------------------------------------------------------------------------
  alias g7_ms_scene_equip_refresh refresh
  def refresh
    # This part is used to refresh the equipped item at the right window
    g7_ms_scene_equip_additional_initialize
    @actor.translucent_texts.fill(false)
    @actor.equip_type_force = index_to_equip_part(@right_window.index)
    @right_window.item_fix_on
    @right_window.scroll_fix_on
    save = @right_window.index
    @right_window.index = index_to_equip_kind(@right_window.index)
    if @right_window.index == 0 and @actor.ignore_offhand? != true then
      if @actor.nb_offhand_required(save) > 0 then
        @right_window.index = @item_windows.size-1
      end
    end
    @actor.equip_from_menu = true
    # Ensure current equipment will get properly stored...
    @actor.equip_mode = 'STORE'
    # ...and re-equiped
    @item_window = @item_windows[@right_window.index]
    @item_windows[@right_window.index].visible = true
    for i in 0...@item_windows.size
      if i != @right_window.index then
        @item_windows[i].visible = false
      end
    end
    # Equip and remove item
    g7_ms_scene_equip_refresh
    @actor.equip_from_menu = false                           
    @actor.equip_mode = nil
    @actor.equip_type_force = nil
    @right_window.index = save
    @right_window.scroll_fix_off
    @right_window.item_fix_off
    if @item_window.index != @old_index
      @right_window.refresh
    end
    @old_index = @item_window.index
  end
  #--------------------------------------------------------------------------
  # * Convert the right_window.index to equip_type
  #--------------------------------------------------------------------------
  alias g7_ms_scene_equip_update_item update_item
  def update_item
    # This changes the @right_window.index to the correct value to take
    # account of extra slots
    @actor.equip_type_force = index_to_equip_part(@right_window.index)
    @right_window.item_fix_on
    @right_window.scroll_fix_on
    save = @right_window.index
    @right_window.index = index_to_equip_kind(@right_window.index)
    @actor.equip_from_menu = true
    # Equip item
    g7_ms_scene_equip_update_item
    @actor.equip_from_menu = false
    @actor.equip_type_force = nil
    # If not in item_window screen
    if @item_window.index == -1
      # If shield-weapon can modify each other
      if @actor.shield_hand_wield == true and
        if @right_window.index == @actor.shield_hand_slot then
          @item_windows[0].refresh
          @item_windows[-1].refresh
        elsif @right_window.index == 0
          # Refresh the shield slot
          @item_windows[@actor.shield_hand_slot].refresh
        end
      end
      if @right_window.index == 0 and @actor.ignore_offhand? != true then
        if @item_window == @item_windows[-1] then
          @item_windows[0].refresh
        elsif @item_window == @item_windows[0] then
          @item_windows[-1].refresh
        end
      end
    end
    @right_window.index = save
    @right_window.scroll_fix_off
    @right_window.item_fix_off
    @actor.equip_type_force = nil
  end
  #--------------------------------------------------------------------------
  # * Convert index to equip part
  #     index : slot number
  #--------------------------------------------------------------------------
  def index_to_equip_part(index)
    # Return index of slot in the
    # array [0, @actor.armor_slots, actor.weapon_slots]
    # If Armor
    if index >= @actor.weapon_slots.size
      return index - (@actor.weapon_slots.size - 1)
    # If extra weapon
    elsif index >= 1
      # Make it last
      return index + [@actor.armor_slots.size, 4].max
    else
      return 0
    end
end
  #--------------------------------------------------------------------------
  # Convert index to equip kind
  #     index : slot number
  #--------------------------------------------------------------------------
  def index_to_equip_kind(index)
    # Return index of slot in either actor.weapon_slots or actor.armor_slots
    i = index_to_equip_part(index)
    # If armor
    if index >= @actor.weapon_slots.size
      set = @actor.armor_slots[i-1]
    # If weapon 
    else
      i = i == 0 ? 0 : i - [@actor.armor_slots.size, 4].max
      set = @actor.weapon_slots[i]
    end
    return set != nil ? set : 0
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Scene Equip
  #-------------------------------------------------------------------------- 
end



#==============================================================================
# ** Window_EquipRight
#------------------------------------------------------------------------------
#  This window displays items the actor is currently equipped with on the
#  equipment screen.
#==============================================================================
class Window_EquipRight < Window_Selectable
  #--------------------------------------------------------------------------
  # * Item Fix On
  #--------------------------------------------------------------------------
  def item_fix_on
    # Fix window
    @fixed_item = @data[self.index]
    @fixed = true
  end
  #--------------------------------------------------------------------------
  # * Item Fix Off
  #--------------------------------------------------------------------------
  def item_fix_off
    #stop fixing window
    @fixed_item = nil
    @fixed = false
  end
  #--------------------------------------------------------------------------
  # * Don't scroll right window if you press L or R
  #--------------------------------------------------------------------------
  def update
    if Input.repeat?(Input::R) or  Input.repeat?(Input::L) then
      return
    else
      super
    end
  end
  #--------------------------------------------------------------------------
  # Draws equipped items with support of translucent and cursed items
  #     item        : item
  #     x           : draw spot x-coordinate
  #     y           : draw spot y-coordinate
  #     translucent : draw translucent
  #--------------------------------------------------------------------------
  def draw_item_name(item, x, y, translucent = false)
    if item == nil
      return
    end
    bitmap = RPG::Cache.icon(item.icon_name)
    if item.cursed
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
      self.contents.font.color = G7_MS_MOD::CURSED_COLOR
    elsif translucent
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 128)
      self.contents.font.color = disabled_color
    else
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
      self.contents.font.color = normal_color
    end
    self.contents.draw_text(x + 28, y, 212, 32, item.name)
  end
  #--------------------------------------------------------------------------
  # * Prevent needless update of item quantities in item window
  #--------------------------------------------------------------------------
  alias g7_ms_window_equipright_item item
  def item
    # This ensures that the number of items doesn't get updated if you move
    # cursor in item window
    return @fixed_item if @fixed
    return g7_ms_window_equipright_item
  end
  #--------------------------------------------------------------------------
  # * Change the height of right windows to fit the slots
  #     actor : actor
  #--------------------------------------------------------------------------
  alias g7_ms_window_equipright_initialize initialize
  def initialize(actor)
    # Initialize with a different height
    g7_ms_window_equipright_initialize(actor)
    # Total height of right window
    h = (actor.weapon_slots.size + actor.armor_slots.size) * 32
    # Change the height                                                       
    self.contents = Bitmap.new(width - 32, h)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Shows the slot names and the name of the items you have equipped
  #--------------------------------------------------------------------------
  def refresh
    # Replaced method to show caption of all items and slot
    self.contents.clear
    @data = []
    # Begin Multi-slot equipment script Edit
    self.contents.font.name = G7_MS_MOD::FONT_NAME
    for i in 0...@actor.weapon_slots.size
      # Push the name(s) of the weapon(s)
      @data.push($data_weapons[@actor.weapon_ids[i]])
    end
    for i in 0...@actor.armor_slots.size
      # Push the names of the armors
      @data.push($data_armors[@actor.armor_ids[i]])
    end
    @caption = []
    for i in 0...@actor.weapon_slots.size
      # Push the name(s) of the weapon slots
      @caption.push(@actor.weapon_slot_names[i])
    end
    for i in 0...@actor.armor_slots.size
      # Push the names of the armor slots
      @caption.push(@actor.armor_slot_names[@actor.armor_slots[i]-1])
    end
    @item_max = @data.size
    if @actor.translucent_texts == nil then @actor.translucent_texts = Array.new end
    for i in 0...@data.size
      if @caption[i] != nil
        self.contents.font.color = system_color
        # Draw the name of the slots
        self.contents.draw_text(4, 32 * i, 92, 32, @caption[i])
      end
      # Draw the name of the equipment
      draw_item_name(@data[i], 92, 32 * i, @actor.translucent_texts[i])
    end
    # Support for other script
    if defined? xrxs_additional_refresh
      xrxs_additional_refresh
    end
  # End Multi-slot equipment script Edit
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Window EquipRight
  #--------------------------------------------------------------------------
end



#============================================================================
# ** Window_EquipOffHand
#----------------------------------------------------------------------------
#  A new window class that displays an equipped item in the actor's off hand.
#============================================================================
class Window_EquipOffHand < Window_EquipItem
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add equippable weapons
    weapon_set = $data_classes[@actor.class_id].weapon_set
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
        weapon = $data_weapons[i]
        if weapon.needs_offhand == false
          if G7_MS_MOD::TWOHANDED_IN_OFFHAND != false and weapon.nb_hands <= 1 then
            @data.push(weapon)
          end
        end
      end
    end
    # Add blank page
    @data.push(nil)
    # Make a bit map and draw all items
    @item_max = @data.size
    self.contents = Bitmap.new(width - 32, row_max * 32)
    self.contents.font.name = G7_MS_MOD::FONT_NAME
    #self.contents.font.size = 24
    for i in 0...@item_max-1
      draw_item(i)
    end
    if G7_MS_MOD::SHOW_REMOVE then
       i = @item_max -1
       x = 4 + i % @column_max * (288 + 32)
       y = i / @column_max * 32
       self.contents.draw_text(x+4, y, 100, 32, '[Remove]')
    end
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Window EquipOffHand
  #--------------------------------------------------------------------------
end



#==============================================================================
# ** Window_Selectable
#------------------------------------------------------------------------------
#  This window class contains cursor movement and scroll functions.
#==============================================================================
class Window_Selectable < Window_Base
  #--------------------------------------------------------------------------
  # * Scroll Fix On
  #--------------------------------------------------------------------------
  def scroll_fix_on
    @scroll_fixed = true
  end
  #--------------------------------------------------------------------------
  # * Scroll Fix Off
  #-------------------------------------------------------------------------- 
  def scroll_fix_off
    @scroll_fixed = false
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  alias g7_ms_update_cursor_rect update_cursor_rect
  def update_cursor_rect
    # This prevents the windows from scrolling if scroll is fixed
    # This was added to ensure that if there are few slots, the right equip
    # screen doesn't scroll needlessly
    return if @scroll_fixed
    g7_ms_update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Window Selectable
  #-------------------------------------------------------------------------- 
end



#==============================================================================
# *** Global IF condition
#     Shows a new status window if Status_window_arrange is true
#==============================================================================
if G7_MS_MOD::STATUS_WINDOW_ARRANGE
  #============================================================================
  # ** Window_Status
  #----------------------------------------------------------------------------
  #  This window displays full status specs on the status screen.
  #============================================================================
  class Window_Status < Window_Base
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      # Begin Multi-slot equipment script Edit
      self.contents.font.name = G7_MS_MOD::FONT_NAME
      # End Multi-slot equipment script Edit
      self.contents.clear
      draw_actor_graphic(@actor, 40, 112)
      draw_actor_name(@actor, 4, 0)
      draw_actor_class(@actor, 4 + 144, 0)
      draw_actor_level(@actor, 96, 32)
      draw_actor_state(@actor, 96, 64)
      draw_actor_hp(@actor, 96, 112, 172)
      draw_actor_sp(@actor, 96, 144, 172)
      draw_actor_parameter(@actor, 96, 192, 0)
      draw_actor_parameter(@actor, 96, 224, 1)
      draw_actor_parameter(@actor, 96, 256, 2)
      draw_actor_parameter(@actor, 96, 304, 3)
      draw_actor_parameter(@actor, 96, 336, 4)
      draw_actor_parameter(@actor, 96, 368, 5)
      draw_actor_parameter(@actor, 96, 400, 6)
      # Begin Multi-slot equipment script Edit
      if G7_MS_MOD::EVADE
        # Activate if you have a draw_actor_paramter method that draws evade
        draw_actor_parameter(@actor, 96, 432, 7)
      end
      self.contents.font.color = system_color
      self.contents.draw_text(320, 16, 80, 32, 'EXP')
      self.contents.draw_text(320, 48, 80, 32, 'NEXT')
      self.contents.font.color = normal_color
      self.contents.draw_text(320 + 80, 16, 84, 32, @actor.exp_s, 2)
      self.contents.draw_text(320 + 80, 48, 84, 32, @actor.next_rest_exp_s, 2)
      self.contents.font.color = system_color
      self.contents.draw_text(320, 80, 96, 32, 'Equipment')
      y = 108
      for i in 0...@actor.weapon_slots.size
        draw_item_name($data_weapons[@actor.weapon_ids[i]], 320 + 16, y)
        y += G7_MS_MOD::STATUS_WINDOW_SPACING
      end
      for i in 0...@actor.armor_slots.size
        draw_item_name($data_armors[@actor.armor_ids[i]], 320 + 16, y)
        y += G7_MS_MOD::STATUS_WINDOW_SPACING
      end
      # End Multi-slot equipment script Edit     
    end
    #------------------------------------------------------------------------
    # * End of CLASS:  Window Status
    #------------------------------------------------------------------------
  end
  #--------------------------------------------------------------------------
  # * End of Global IF condition
  #--------------------------------------------------------------------------
end


Spoiler: ShowHide
#==============================================================================
# Multi-slot equipment script
#------------------------------------------------------------------------------
# Section 4:  Other
#------------------------------------------------------------------------------
# Guillaume777
# 6.2.1
# 2006/02/14
#==============================================================================

#==============================================================================
# ** Scene_Battle (part 4)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  #-------------------------------------------------------------------------- 
  # *  Go to phase4 step2 for attack if attack_count < attacks.size
  #--------------------------------------------------------------------------
  alias g7_ms_scene_battle_phase4_step6 update_phase4_step6
  def update_phase4_step6(battler=nil)
    # This methods make the battler return to phase4 step2 if there is an
    # extra attack to be made
    # If no battler parameter
    if battler== nil then
      # First do the appropriate action
      g7_ms_scene_battle_phase4_step6
      if @active_battler.is_a?(Game_Enemy) then return end
      # Increase the number of attacks made 
      @active_battler.attack_count += 1
      # If all attacks have been made
      if @active_battler.attack_count == @active_battler.attacks.size or
      @active_battler.current_action.kind != 0 or
      @active_battler.current_action.basic != 0 or
      judge == true
        # End of turn, and return attack count to 0
        @active_battler.attack_count = 0
      else
        # Return for extra attack
        @phase4_step = 2
      end
    # If it requres the battle as a parameter 
    else
      g7_ms_scene_battle_phase4_step6(battler)
      if battler.is_a?(Game_Enemy) then return end
      # Increase the number of attacks made 
      battler.attack_count += 1
      # If all attacks have been made
      if battler.attack_count == battler.attacks.size or
      battler.current_action.kind != 0 or battler.current_action.basic != 0 or
      judge == true
        # End of turn, and return attack count to 0
        battler.attack_count = 0
      else
        # Add the battler again to the action
        if @action_battlers.include?(@active_battler) == false then @action_battlers.push(battler) end
        # Return for extra attack 
        battler.phase = 2
      end
    end
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Scene Battle
  #-------------------------------------------------------------------------- 
end



#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
#  This class performs load screen processing.
#==============================================================================

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Fix equiped item if user load saved game
  #--------------------------------------------------------------------------
  alias g7_ms_scene_load_read_save_data read_save_data
  def read_save_data(file)
    g7_ms_scene_load_read_save_data(file)
    $game_actors.order_items    # Order armor when you load a saved game in
                                # case it is an old game
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Scene Load
  #-------------------------------------------------------------------------- 
end



#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs title screen processing.
#==============================================================================

class Scene_Title
  #--------------------------------------------------------------------------
  # * Fix items as you open RMXP
  #--------------------------------------------------------------------------
  alias g7_ms_scene_title_main main
  def main
    RPG.initialized_item_types = false
    g7_ms_scene_title_main
    RPG.set_new_item_types
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Scene Title
  #-------------------------------------------------------------------------- 
end



#==============================================================================
# ** Interpreter (part 3)
#------------------------------------------------------------------------------
#  This interpreter runs event commands. This class is used within the
#  Game_System class and the Game_Event class.
#==============================================================================

class Interpreter
  #-------------------------------------------------------------------------- 
  # * Conditional Branch to make it work when comparing extra items
  #--------------------------------------------------------------------------
  alias g7_ms_interpreter_command_111 command_111
  def command_111
    result = false
    broken = false
    case @parameters[0]
    # When Actor
    when 4
      actor = $game_actors[@parameters[1]]
      if actor != nil
        case @parameters[2]
        # If weapon
        when 3
          for i in 0...actor.weapon_ids.size
            # Compare
            result |= (actor.weapon_ids[i] == @parameters[3])
          end
          broken = true
        # If Armor 
        when 4
          for i in 0...actor.armor_ids.size
            # Compare
            result |= (actor.armor_ids[i] == @parameters[3])
          end
          broken = true
        end
      end
    end
    # If other conditional branch
    unless broken
      # Do the normal condition
      g7_ms_interpreter_command_111
      return
    end
    @branch[@list[@index].indent] = result
    if @branch[@list[@index].indent] == true
      @branch.delete(@list[@index].indent)
      return true
    end
    return command_skip
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Interpreter
  #-------------------------------------------------------------------------- 
end



#==============================================================================
# ** MODULE:  Kernel
#------------------------------------------------------------------------------
#  A module defining the methods that can be referred to by all classes. Object
#  classes are included in this module.
#==============================================================================

module Kernel
  private
  def Rg(from, to, *step) Rg.new(from, to, *step) end
end



#==============================================================================
# ** Rg
#------------------------------------------------------------------------------
#   Class of modified RGSS statements, enhanced with module Kernel.
#==============================================================================
class Rg
  #Used to a more effective for ... in ...
  include Enumerable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------   
  def initialize(from, to, step = sign(to - from))
    @from, @to, @step = from, to, step
    @to += @step - ((@to - @from) % @step)
  end
  #--------------------------------------------------------------------------
  # * Each
  #--------------------------------------------------------------------------   
  def each
    x = @from
    until x == @to
      yield x
      x += @step
    end
    self
  end
  #--------------------------------------------------------------------------
  # * Sign
  #--------------------------------------------------------------------------   
  def sign(x)
    case
    when x > 0
      1
    when x == 0
      0
    else
      -1
    end
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Rg
  #-------------------------------------------------------------------------- 
end
Title: Re: [XP] Zer0 CMS
Post by: KK20 on February 18, 2013, 01:48:18 pm
Guillaume777's Multi-Slot compatibility (http://pastebin.com/mJeYRq80)

Haven't done any serious testing, but it looked like it was working. This should replace Zer0_CMS in your game project and should be placed below G777's script.
Title: Re: [XP] Zer0 CMS
Post by: Moshan on February 18, 2013, 02:53:14 pm
 First of all: Thank you very very much!
Second: I really don't understand how it works...I configured some extra slots but it seems that the items don't appear there.(the items are configurated)
Also...is not compatible with Quality Colors by game_guy.
If you have the time to check it please tell me, I will wait. If you don't have time then... I won't use it.
Title: Re: [XP] Zer0 CMS
Post by: KK20 on February 18, 2013, 03:18:15 pm
Eh, found some things while trying to reply to your post.
Title: Re: [XP] Zer0 CMS
Post by: Moshan on February 18, 2013, 03:39:35 pm
 So...you have the time. Yeeey!! Thank you again for helping me! I will make the final boss something related to you :^_^':
Title: Re: [XP] Zer0 CMS
Post by: KK20 on February 18, 2013, 06:24:56 pm
lolwut xD I'd like to see that come true~

For the sake of not having to make anything overly complicated, I've made a zipped demo project with all the script edits. Basically just drag and drop (cut/paste) the scripts into your project. The ones I made edits to are Multi-slot script : Windows and Zer0_CMS I believe.

Download (http://dl.dropbox.com/u/58874459/Multi%20Slot%20%2B%20Zero%20CMS.zip)
Title: Re: [XP] Zer0 CMS
Post by: Moshan on February 19, 2013, 04:57:28 am
 Thank you again and again and again and again! Now everything works! I will pm you about credits(make some items related to you, monsters, the final boss as I promise, and quests)
Title: Re: [XP] Zer0 CMS
Post by: Sixdd on August 23, 2013, 07:18:09 am
Just curious if anyone could help with the Quest system in this CMS. I would like to use a conditional branch to check against the status of a Quest but could not get it to work, this is what I have tried so far.

Conditional Branch
    Script Call:  Quest.status(2) 'Failed'
(Gave syntax error)

Conditional Branch
   Script Call: Quest.status(2) = 'Failed'
(Gave syntax error)

Conditional Branch
   Script Call: Quest.status(2)
(Did nothing as far as I could tell)

Any help with this would be great as I am about as nooby as it gets with Ruby. Also sorry for the necropost, I promise I searched first.
Title: Re: [XP] Zer0 CMS
Post by: Terv on August 23, 2013, 08:02:18 am
Conditional Branch (Script): Quest.status(2) == 'Failed'
Title: Re: [XP] Zer0 CMS
Post by: Sixdd on August 23, 2013, 09:54:19 am
Aha, I wish I knew more about the context for Ruby so I would have known such a simple answer  :facepalm: . Thank you for the help :)


EDIT:  Question again. Is it possible to make this CMS work with the Hermes message system? I tried to use the "installer" for it but it is not compatible out of the box with any project that has specific custom scenes. I ask because I am using ccoas UMS right now but it doesn't have some of the features I'd like, the most important being a good "Fit window to text" option as there is always a bunch of dead space at the end of the message box.

Also I just noticed that when you select either Skill, Equip, or Status the font for the character window is not the same as the font you select in the options menu. I'll look at it, but since I'll probably break it could someone tell me how to fix it?
Title: Re: [XP] Zer0 CMS
Post by: Sixdd on August 29, 2013, 01:57:19 am
So nvm, I finally figured it out! Thanks again for the help  :)