Help - Search - Members - Calendar
Full Version: Attribute System
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS2-Submissions
Pages: 1, 2, 3, 4, 5
332211
Attribute System

Version: 3.2.1.1
Author: 332211/uresk
Release Date 24th August 2009


Exclusive Script at RPG RPG Revolution


Introduction
This script allow actors to have attributes that enhance their stats, damage when using certain elements, learn skills.

Features
  • custom attributes - each actor has its own attributes
    Attributes give:
  • Stat bonus
  • Boost certain elements (skills/items damage) and resistance
  • May actiave a skill while attacking (Eg: You attack a monster, but the skill Fire activated and you use Fire on that monster.)
  • Influence status resistance.
  • more customization for each attribute by level
    Also:
  • more customization: you can chose at which level the character learn an attribute
  • Each level you gain points equal to your level (start with 1)
  • Cost formula is now easily changed
  • It has become easy to create items which teach attributes
  • Attribute points can be bought at regular shops (if you want them to sell them)
  • Killing enemies awards the party with extra attriute points
  • characters can be stopped from using a items based on their class
  • added an info window on the attributes (see screenshot)
  • 3: enemies can have attributes, revised structure
  • 3.1: some bugs corrected, more details for each attribute, bigger and better info window.
  • 3.2: weapons, armors and skill may require certain Attributes ( of a level or higher) to be equiped / used
  • 3.2.1: 2 bug fixes
  • 3.2.1.1: fixed a bug caused by the last bugfix


Script
Click to view attachment
Click to view attachment
Click to view attachment (No demo)
Click to view attachment (no demo)

Customization
See Script and try the Demo

Screenshot
Version 2.5


Version 2.5.4 (Info Window)


Version 3 (Confirmation box)


Verion 3.1 (new Info Window)


DEMO
Attribute System 3.2

Installation
Plug & Customize & Play.

Terms and Conditions
Don't post this script on other forums, link them here.

Notes
The demo includes: Yanfly Engine RD - Scene Status ReDux for an easier menu access.
From_Ariel
interesting can you use negative values for the attribute effects too?

like if i want one attribute to raise some stuff and lower others and another do the opposite ....
332211
Yes, it should work too.
warn me if somethin goes wrong.
RuGeaR1277
woah... looks cool! i'm gonna check it out! happy.gif
Putri
this script is awesome dude, but how do i call it from the menu? instead of having some random npc tell my hero "want some fresh attributes at a gipsy price?"
RuGeaR1277
okies... i've checked it... and I LOVE IT! happy.gif
i'm a newbie, i admit it... and i dont understand the script... can you explain better? smile.gif

CODE
module Attibute_Def
  ATTRIBUTES = {
    # 0 - attribute name => [
    "Flame Mastery" => [
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [6,8,1,0,6,1],
    # [element_booster],
    [9],
    # {level => skill id}
    {3 => 34, 4 => 45},
    # auto_skill id]
    59,
    # desc line 1
    "Flame Mastery: affects the user's spirit and damage made",
    # desc line 2
    "by fire skills, may activate Flame kick while attacking.",
    # picture name
    "155"
    ],
    # 1 - attribute name => [
    "Swordsmanship" => [
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [9,2,7,3,0,1],
    # [element_booster],
    [2],
    # {level => skill id}
    {3 => 34, 4 => 45},
    # auto_skill id]
    nil,
    # desc line 1
    "Swordsmanship: affects the user's spirit and damage made",
    # desc line 2
    "by fire skills, may activate Flame kick while attacking.",
    # picture name
    "154"
    ]
    # scene desc
    }
  ATTRIBUTE_names = ATTRIBUTES.keys
  Actor_attributes = { 1 => [0,1],
                       2 => [1]
                      }
end


okay, i'll try my best to tell you what i don't understand. wink.gif

CODE
    # 0 - attribute name => [
    "Flame Mastery" => [

okay, i'm sure i know what's attribute name and the number before it... always starts with 0, and so on...

CODE
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [6,8,1,0,6,1],

so, each of this attribute increases the actor's stats by this much per level, right? hold on, for which actor? for all actors with this attribute?

CODE
    # [element_booster],
    [9],

what's this? i know 9 is Fire... does that mean it'll boost up Fire damage? where do i see the percentage?

CODE
    # {level => skill id}
    {3 => 34, 4 => 45},

what's this again? does that mean all actors with this attribute learns this skill at this level?

CODE
    # auto_skill id]
    59,

this is something like auto-unleash a skill with normal attack, right? so does the chance of unleash increases? maybe by attribute level or actor level?

CODE
    # desc line 1
    "Flame Mastery: affects the user's spirit and damage made",
    # desc line 2
    "by fire skills, may activate Flame kick while attacking.",

yeah... i'm sure i know what's this... pinch.gif

CODE
    # picture name
    "155"

and this too! pinch.gif

CODE
  ATTRIBUTE_names = ATTRIBUTES.keys
  Actor_attributes = { 1 => [0,1],
                       2 => [1]

i'm sure this means which actors has what attribute...

so, overall, the attributes are for whole party?
and how do you get the points again?

hope you can clear my doubts... i'm really interested in using this script though... happy.gif
332211
use cmpsr2000's Menu Patch
And ad this below everything and above the Menu:
CODE
class Scene_Title < Scene_Base
  alias oldCreateGameObj_Attributes create_game_objects
  def create_game_objects
    oldCreateGameObj_Attributes
    menuItem = ["Attributes", "start_actor_selection", true, "$scene = Scene_Attributes.new(@status_window.index)"]
    $game_menu.insert(4, menuItem) #for is the position in the menu
end
end
Putri
Thnks dude.
HeavensLastHope
I got this while trying to heal myself with a spell using the first char.
Click to view attachment
332211
ups...
replace line 164 (part 1) with this:
CODE
    if !user.attributes.nil?
RuGeaR1277
overall, what i'm asking is, if you got 3 actors with, let's say A, B and C... A has Flame Mastery, B has Swordsmanship and C has both... and at some point of the game, my Flame Mastery is level 5 and Swordsmanship is Level 3... Then a new actor, D, joins the party and actually have Swordsmanship... so is his Swordsmanship level 3 too?
gosh, my english sucks! i hardly understand myself...
332211
QUOTE (RuGeaR1277 @ Oct 20 2008, 05:48 AM) *
overall, what i'm asking is, if you got 3 actors with, let's say A, B and C... A has Flame Mastery, B has Swordsmanship and C has both... and at some point of the game, my Flame Mastery is level 5 and Swordsmanship is Level 3... Then a new actor, D, joins the party and actually have Swordsmanship... so is his Swordsmanship level 3 too?
gosh, my english sucks! i hardly understand myself...


Nope, it works like this example:
A has Flame Mastery (lvl 5)
B has Swordsmanship (lvl 3)
C has both (lvl 2 and lvl 3)
D joins your party and has Swordsmanship lvl 1
RuGeaR1277
owh... okies... now i get it... each person will have their own attribute levels... nice! happy.gif
dark_prince_razor
Is it possible to add in another attribute?
I tried to copy the attribute from Flame Mastery and pasted it below it.
changed the name to Water Mastery and changed the stat values and it gave me an error here
0 # 2 - attribute name => [
1 "Water Mastery" => [ Syntax Error Begining of this line
2 #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
3 [3,7,1,9,4,3],
332211
QUOTE (dark_prince_razor @ Oct 23 2008, 10:49 PM) *
Is it possible to add in another attribute?
I tried to copy the attribute from Flame Mastery and pasted it below it.
changed the name to Water Mastery and changed the stat values and it gave me an error here
0 # 2 - attribute name => [
1 "Water Mastery" => [ Syntax Error Begining of this line
2 #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
3 [3,7,1,9,4,3],

CODE
# picture name
"156"
], # <-- this is what's missing, the comma at the end of the previous attribute
# 2 - attribute name => [
"Water Mastery" => [
#[bonus values: HP, MP, ATK, DEF, SPI, AGI],
[3,7,1,9,4,3],
dark_prince_razor
Okay I got it to add some.

But now I'm testing out a sideview battle system but it's giving me an attribute error when the enemy tries to use a Skill.
it says
"Script 'Attribute System' line 190: NoMethodError occured.
undefined method 'attributes' for #<Game_Enemy:0x194fb78"

and remember that 190 is essentially the
if !user.attributes.nil?
line, I just have my extra attributes making more lines.

Is there no enemy attribute method? That's what it sounds like
carbajosa
This script looks neat~

But uhm, can you reupload the demo please?
Like in mediafire... cause rapidshare bugs me saying that I already reached the
maximum download limit even though I didnt download anything from them. (Really odd bug that RS should fix)


It works now, but in a different browser biggrin.gif

Many thanks biggrin.gif Gonna put you on my credit list smile.gif
This script is what Im looking for~ Thanks again biggrin.gif
332211
QUOTE (dark_prince_razor @ Oct 27 2008, 08:49 PM) *
Okay I got it to add some.

But now I'm testing out a sideview battle system but it's giving me an attribute error when the enemy tries to use a Skill.
it says
"Script 'Attribute System' line 190: NoMethodError occured.
undefined method 'attributes' for #<Game_Enemy:0x194fb78"

and remember that 190 is essentially the
if !user.attributes.nil?
line, I just have my extra attributes making more lines.

Is there no enemy attribute method? That's what it sounds like

My bad...
try and replace that line with this:
CODE
    if user.is_a?(Game_Actor) and !user.attributes.nil?
dark_prince_razor
Thank you, worked perfectly.
I didn't think there was an enemy attribute method that I could find... but I haven't played in RGSS in at least a couple years.. so I'm rusty.. Glad to see I didn't forget as much as I thought.
332211
QUOTE (dark_prince_razor @ Oct 28 2008, 09:37 PM) *
Thank you, worked perfectly.
I didn't think there was an enemy attribute method that I could find... but I haven't played in RGSS in at least a couple years.. so I'm rusty.. Glad to see I didn't forget as much as I thought.


Yep, you were right on target... maybe I could give enemies attributes too, that would made them different, or not...
When I find the time and patience I just might do that.
tomatogal
Hello!

First, just wanted to say that I love the script. It was just what I had been looking for!

But, I have one quick question. Is it possible to add or remove certain attributes during in the course of the game? For example, if one character is taught how to use another type of magic, would I be able to add another attribute, or would that attribute (of the new magic) have to be there from the start of the game?

Please let me know if that didn't make sense. >_< I'll do my best to clarify.

Thanks in advance. ^^

332211
To add a new attribute, you can use:
CODE
$game_actors[actor_id].start_attributes(attribute id)


The remove feature is no included yet.
Znikomek
link to version 1.3 is broken.
RuGeaR1277
uhh... it says something about maximum exceeded...
i wasnt even donwloading anything...
i tried on Internet Explorer... same thing...
help, plz? smile.gif
332211
I didn't know that Rapidhsare had a limited number of downloads.
Reuploaded the demo with zshare.
Garlyle
Hmm. Hmm... Hmm! Yes! +_+ This is -almost- what I was looking for. ...Almost. T_T;

But I might be able to use this as the basis for coding my own system along these lines; so thank you very much.
tomatogal
QUOTE (332211 @ Nov 4 2008, 01:56 PM) *
To add a new attribute, you can use:
CODE
$game_actor[actor_id].start_attributes(attribute id)


The remove feature is no included yet.


So, I tried this out today, copy-pasted this into the editor and changed the numbers, as you can see in the screen shot.
[Show/Hide] Screen Shot of Script


But, when I actually tried it out, I got this error:
No Method Error occured while running script.

Undefined method '[]' for nil:NilClass
Click to view attachment


I attached a seperate screen shot with the message, as well. Did I put in the script incorrectly, or is there something else that I forgot to do in order to make it work?

Thanks again. ^^

332211
QUOTE (tomatogal @ Nov 6 2008, 01:05 AM) *
QUOTE (332211 @ Nov 4 2008, 01:56 PM) *
To add a new attribute, you can use:
CODE
$game_actor[actor_id].start_attributes(attribute id)


The remove feature is no included yet.


So, I tried this out today, copy-pasted this into the editor and changed the numbers, as you can see in the screen shot.


But, when I actually tried it out, I got this error:
No Method Error occured while running script.

Undefined method '[]' for nil:NilClass
Click to view attachment


I attached a seperate screen shot with the message, as well. Did I put in the script incorrectly, or is there something else that I forgot to do in order to make it work?

Thanks again. ^^

Distracted old me:
It's $game_actors instead of $game_actor
CODE
$game_actors[actor_id].start_attributes(attribute id)

tomatogal
QUOTE (332211 @ Nov 6 2008, 12:38 PM) *
QUOTE (tomatogal @ Nov 6 2008, 01:05 AM) *
QUOTE (332211 @ Nov 4 2008, 01:56 PM) *
To add a new attribute, you can use:
CODE
$game_actor[actor_id].start_attributes(attribute id)


The remove feature is no included yet.


So, I tried this out today, copy-pasted this into the editor and changed the numbers, as you can see in the screen shot.


But, when I actually tried it out, I got this error:
No Method Error occured while running script.

Undefined method '[]' for nil:NilClass
Click to view attachment


I attached a seperate screen shot with the message, as well. Did I put in the script incorrectly, or is there something else that I forgot to do in order to make it work?

Thanks again. ^^

Distracted old me:
It's $game_actors instead of $game_actor
CODE
$game_actors[actor_id].start_attributes(attribute id)



Just tried it out and it worked like a charm.

Thank you so much for all of your help! happy.gif
Naridar
Can you add an attribute to a character with a script call (e.g the main character learns darkness skills after a certain story event)? Also, can you make the character learn a skill when he/she reaches a certain level of an attribute?
scottso06
How much does the element boster increase damage of that element by? Also, can this affect healing spells as well? I looked but I couldn't figure this out.

Thanks!
332211
Each level of an attribute increases damage by 10%. This also applies to healing.

Note: If a skills has to elements to be 'boosted' it will be boosted twice.
Example: Meteor (Fire + Earth)
Fire Mastery - level 4
Earth Mastery - level 7
skill damage = damage * 140 % * 170 %
Garge
This is quite an enjoyable script you have. It makes for a good talent tree system. Would it be possible of adding in a feature to allow these skills to be applied to class id instead of actor id?

Two problems and an error that I found are:
1) This script creates alot of lag on some computers. On my P4 3.0 with 1gig ram, the FPS drops 89% from 60 to 6-7 fps, but only when actors have stuff to be drawn on the screen, like actor 1 & 2 on your demo.

2) The levels are behind by one in point cost and costing too many points I.E. going from 0 to 1 is free, 1 to 2 only costs 1 point, but lv 2 to 3 costs 4 points while 3 to 4 costed 9 points, etc. Ah, i found the problem to be line 270 in Attr_scene. I changed that line to read the following and now it's working fine.
CODE
@actor.attr_points -= (1 + ((@actor.attr_levels[attribute_index] ** 2 + @actor.attr_levels[attribute_index])/2))


E1) Script 'Attr_Scene' line 251: TypeError occurred. No implicit conversion from nil to interger. This happened while trying to train skills on those that don't have any, like actors 3 & 4.
332211
QUOTE (Garge @ Nov 28 2008, 10:00 PM) *
This is quite an enjoyable script you have. It makes for a good talent tree system. Would it be possible of adding in a feature to allow these skills to be applied to class id instead of actor id?

Two problems and an error that I found are:
1) This script creates alot of lag on some computers. On my P4 3.0 with 1gig ram, the FPS drops 89% from 60 to 6-7 fps, but only when actors have stuff to be drawn on the screen, like actor 1 & 2 on your demo.

2) The levels are behind by one in point cost and costing too many points I.E. going from 0 to 1 is free, 1 to 2 only costs 1 point, but lv 2 to 3 costs 4 points while 3 to 4 costed 9 points, etc. Ah, i found the problem to be line 270 in Attr_scene. I changed that line to read the following and now it's working fine.
CODE
@actor.attr_points -= (1 + ((@actor.attr_levels[attribute_index] ** 2 + @actor.attr_levels[attribute_index])/2))


E1) Script 'Attr_Scene' line 251: TypeError occurred. No implicit conversion from nil to interger. This happened while trying to train skills on those that don't have any, like actors 3 & 4.

In the first script, in lines 84/85 replace actor_id with @class_id
CODE
    if !Actor_attributes[@class_id].nil?
      for attr_i in Actor_attributes[@class_id]
        start_attributes(attr_i)
      end
    end

1)Yeah, I've noticed the lag too... I'll let you know if I happen to solve it.

2)I've changed the points formula for the display window and forgot to do the same for the method which removes the points.

E1) You need to 'teach' them the attributes with this:
CODE
$game_actors[actor_id].start_attributes(attribute id)

I don't really know what're you doing, but my guess is that you want them to have new attributtes mid-game
Garge
QUOTE (332211 @ Nov 29 2008, 07:13 AM) *
In the first script, in lines 84/85 replace actor_id with @class_id
CODE
    if !Actor_attributes[@class_id].nil?
      for attr_i in Actor_attributes[@class_id]
        start_attributes(attr_i)
      end
    end

1)Yeah, I've noticed the lag too... I'll let you know if I happen to solve it.

2)I've changed the points formula for the display window and forgot to do the same for the method which removes the points.

E1) You need to 'teach' them the attributes with this:
CODE
$game_actors[actor_id].start_attributes(attribute id)

I don't really know what're you doing, but my guess is that you want them to have new attributtes mid-game


Thanks, works like a charm. For E1, I was just pointing out that if an actor has no attribute to train in, that the script still allows the player to try and level one up, giving an error, instead of just having nothing happen.

Edit - When I make new attributes, either in a fresh version or the one I've been playing with, they lose their order and keep chaging placement the more I add, so like instead of Divine Magic being attribute #2, with what I have below, it's coming out as #4, while Flame Mastery becomes attribute #5. Am I adding them in wrong or do I just need to go through each one by one after I complete my list to find their real placement?

[Show/Hide] Attributes
CODE
module Attibute_Def
  ATTRIBUTES = {
    # 0 - attribute name => [
    "Flame Mastery" => [
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [6,8,1,0,6,1],
    # [element_booster],
    [9],
    # {level => skill id}
    {3 => 34, 4 => 45},
    # auto_skill id]
    59,
    # desc line 1
    "Flame Mastery: affects the user's spirit and damage made",
    # desc line 2
    "by fire skills, may activate Flame kick while attacking.",
    # picture name
    "155"
    ],
    # 1 - attribute name => [
    "Swordsmanship" => [
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [9,2,7,3,0,1],
    # [element_booster],
    [2],
    # {level => skill id}
    {3 => 34, 4 => 45},
    # auto_skill id]
    59,
    # desc line 1
    "Swordsmanship: affects the user's spirit and damage made",
    # desc line 2
    "by fire skills, may activate Flame kick while attacking.",
    # picture name
    "154"
    ],
    # 2 - attribute name => [
    "Divine Magic" => [
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [2,5,0,3,4,1],
    # [element_booster],
    [],
    # {level => skill id}
    {},
    # auto_skill id]
    [],
    # desc line 1
    "Divine Magic: affects the user's spirit and healing made",
    # desc line 2
    "by recovery skills.",
    # picture name
    "166"
    ],
    # 3 - attribute name => [
    "Dark Magic" => [
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [2,5,0,3,4,1],
    # [element_booster],
    [],
    # {level => skill id}
    {},
    # auto_skill id]
    [],
    # desc line 1
    "Dark Magic: affects the user's spirit and damage made",
    # desc line 2
    "by offensive magic.",
    # picture name
    "162"
    ],
    # 4 - attribute name => [
    "Sword Magic" => [
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [2,5,0,3,4,1],
    # [element_booster],
    [],
    # {level => skill id}
    {},
    # auto_skill id]
    [],
    # desc line 1
    "Sword Magic: affects the user's spirit and damage made",
    # desc line 2
    "by offensive magic.",
    # picture name
    "165"
    ],
    # 5 - attribute name => [
    "Strength" => [
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [2,5,0,3,4,1],
    # [element_booster],
    [],
    # {level => skill id}
    {},
    # auto_skill id]
    [],
    # desc line 1
    "Strength: Affects the users physcial prowness when using",
    # desc line 2
    "physcial attacks and skills.",
    # picture name
    "164"
    ]
    # scene desc
    }
  # max level any attribute may have
  MAX_Level = 12
  # actor id => [attributes indexes]
  Actor_attributes = { 1 => [0,1],
                       2 => [1],
                       3 => [1,2],
                       4 => [4,3]
                       }
dark_prince_razor
I've noticed that if I put a new attributed Below my last one, it becomes place 0 in the array. Thus I've been putting my new attributes first and it isn't changing the ones I already had in the script.
Garge
Well I'm glad that error got fixed. But now when I try using this:
CODE
# Case you're having trouble with the Attributes Indexes
# instead pf this line
ATTRIBUTE_names = ATTRIBUTES.keys
# write the attributes names yourself, like this.
#~ ATTRIBUTE_names = ["Swordmanship","Flame Mastery"]


and change it to like the example you give, I get this:
Script 'Attribute System' line 103: NoMethodError occurred
undefined method '[]' for nil:NilClass.

Edit: Some suggestions for this script would be to show a pop up window showing when a new skill is learned and having the ability to define the max level of individual attributes. Thank you for your time.
332211
QUOTE (Garge @ Dec 1 2008, 07:19 PM) *
Well I'm glad that error got fixed. But now when I try using this:
CODE
# Case you're having trouble with the Attributes Indexes
# instead pf this line
ATTRIBUTE_names = ATTRIBUTES.keys
# write the attributes names yourself, like this.
#~ ATTRIBUTE_names = ["Swordmanship","Flame Mastery"]


and change it to like the example you give, I get this:
Script 'Attribute System' line 103: NoMethodError occurred
undefined method '[]' for nil:NilClass.

Edit: Some suggestions for this script would be to show a pop up window showing when a new skill is learned and having the ability to define the max level of individual attributes. Thank you for your time.

Assuming you're trying my demo: That's probably happening out of a spelling error... (made by me :[ It's "Swordsmanship" instead of "Swordmanship")

Max level for each... it's doable, but I'm lazy. If you're lucky, it'll be in the next version.

As for the Skill Pop up Window, here it his (I had already done this for myself biggrin.gif)
Beware: when you add a character to the party(1st time), if you initialize it, it'll show its skills twice.
[Show/Hide] Show New Skill (applies to ALL skills)
CODE
#================================================================
==============
# ** Window_Line
#------------------------------------------------------------------------------
# this class handles a one lined window.
#==============================================================================
class Window_Line < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(skill_id)
super(0, 500, 544, WLH + 32)
set_skill_text(skill_id)
for i in 1..33
self.y -= 10
Graphics.update
end
Audio.se_play('Audio/SE/Item2') # Change Sound here
Sound.play_use_skill
for i in 0..100
Graphics.update
end
while y > -66
self.y -= 10
Graphics.update
end
self.dispose
end
#--------------------------------------------------------------------------
# * Set Skill Text
# skill_id : id of the new skill
#--------------------------------------------------------------------------
def set_skill_text(skill_id)
self.contents.clear
self.contents.font.color = normal_color
draw_icon($data_skills[skill_id].icon_index, 4, 0)
text = sprintf("%s was learnt!", $data_skills[skill_id].name) # Change Message Here
self.contents.draw_text(32, 0, self.width - 40, WLH, text)
end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Learn Skill
# skill_id : skill ID
#--------------------------------------------------------------------------
alias show_learn_skill learn_skill
def learn_skill(skill_id)
Window_Line.new(skill_id) if !@skills.include?(skill_id)
show_learn_skill(skill_id)
end
end
Garge
Good stuff. I like the pop up skill window, even if it works on all skills learnt, no matter the scene. Keep up the good work! biggrin.gif Hope you can get to the root of the lag issue.
sprx11
QUOTE (332211 @ Oct 28 2008, 11:08 AM) *
QUOTE (dark_prince_razor @ Oct 27 2008, 08:49 PM) *
Okay I got it to add some.

But now I'm testing out a sideview battle system but it's giving me an attribute error when the enemy tries to use a Skill.
it says
"Script 'Attribute System' line 190: NoMethodError occured.
undefined method 'attributes' for #<Game_Enemy:0x194fb78"

and remember that 190 is essentially the
if !user.attributes.nil?
line, I just have my extra attributes making more lines.

Is there no enemy attribute method? That's what it sounds like

My bad...
try and replace that line with this:
CODE
    if user.is_a?(Game_Actor) and !user.attributes.nil?




Well i did that but when i try again i get this message. Click to view attachment
Me = Newbie and i really need help ohmy.gif
332211
QUOTE (sprx11 @ Dec 3 2008, 12:33 AM) *
QUOTE (332211 @ Oct 28 2008, 11:08 AM) *
QUOTE (dark_prince_razor @ Oct 27 2008, 08:49 PM) *
Okay I got it to add some.

But now I'm testing out a sideview battle system but it's giving me an attribute error when the enemy tries to use a Skill.
it says
"Script 'Attribute System' line 190: NoMethodError occured.
undefined method 'attributes' for #<Game_Enemy:0x194fb78"

and remember that 190 is essentially the
if !user.attributes.nil?
line, I just have my extra attributes making more lines.

Is there no enemy attribute method? That's what it sounds like

My bad...
try and replace that line with this:
CODE
    if user.is_a?(Game_Actor) and !user.attributes.nil?




Well i did that but when i try again i get this message. Click to view attachment
Me = Newbie and i really need help ohmy.gif


Try the latest version, I might just work.

EDIT: just uploaded version 2. I hope it has slightly less lag.
Garge
Nice update. It's becoming more user friendly imo. Using icons instead of separate pictures is a lot better. There's less lag when an actor only has 1 attribute, FPS is about 10-12. Once there are two or more, it drops back to the 7-8 range.

Edit: Found the source of the lag. It's the description lines having too many characters to draw and refresh is the problem. I trimmed down the what was said for the descriptions and ignored line 110 in attr_scene from updating and got my FPS up to 55-56. If it's possible, you might want to break up the description from the level/points line, kinda like below. With what's changed in the attr_scene, I've got all that text and still 60fps. I just can't get the new points window to update on the attribute level. Here's to hoping it all gets fixed one way or another. thumbsup.gif



[Show/Hide] Attr_scene changed starting at line 137
CODE
=================================================================
=============
# ** Window_Attr_Desc
#------------------------------------------------------------------------------
# This window shows attribute explanations.
#==============================================================================

class Window_Attr_Desc < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 544, 3 * WLH + 32)
end
#--------------------------------------------------------------------------
# * Set Text lines 1..3
# text : character string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text1(text, align = 0)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_wrap_text(4, -4, self.width - 40, WLH, text, align)
@text = text
@align = align
end
end
def set_text2(text, align = 0)
if text != @text or align != @align
self.contents.font.color = normal_color
self.contents.draw_text(4, WLH, self.width - 40, WLH, text, align)
@text = text
@align = align
end
end
def set_text3(text, align = 0)
if text != @text or align != @align
self.contents.font.color = normal_color
self.contents.draw_text(4, 2*WLH, self.width - 40, WLH, text, align)
@text = text
@align = align
end
end
end

class Bitmap
def draw_wrap_text(x,y,width, height, text, align)
array = text.split
for i in array
word = i + ' '
word_width = text_size(word).width
if x + word_width > width
y += (height + 10) / 2
x = 0
end
self.draw_text(x, y, width, height, word)
x += (word_width + 0)
end
end
end


#==============================================================================
# ** Window_Atrr_List
#------------------------------------------------------------------------------
# This window displays a list of attributes
#==============================================================================

class Window_Atrr_List < Window_Selectable
include Attibute_Def
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
# actor : actor
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
@column_max = 1
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# * Get Attribute
#--------------------------------------------------------------------------
def on_attribute
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@line = 0
@data = []
for attr in @actor.attributes
@data.push(attr)
draw_attribute(attr)
@line += 1
end
@item_max = @data.size
end
#--------------------------------------------------------------------------
# * Draw Attribute
# attr_i : attribute ID
#--------------------------------------------------------------------------
def draw_attribute(attr_i)
attr_name = Attibute_Def::ATTRIBUTES[attr_i][0]
y = @line * WLH
self.contents.draw_text(4, y, 544, WLH, attr_name)
for level in 0...@actor.attr_levels[attr_i]
draw_icon(ATTRIBUTES[attr_i][7],150 + level * 30, y)
end
end
#--------------------------------------------------------------------------
# * Update Attr Window text
#--------------------------------------------------------------------------
def update_help
if on_attribute == nil
text1 = ""; text2 = ""; text3 = ""
else
attr_text = ATTRIBUTES[on_attribute]
text1 = sprintf(attr_text[5])
text2 = sprintf(attr_text[6])
level = @actor.attr_levels[on_attribute]
points = @actor.attr_points
if level == attr_text[8]
text3 = sprintf("Level: %s Not Upgradable",level)
else
up = cost?(level)
text3 = sprintf("Level: %s Upgrade Cost: %s",level,up)
end
end
@help_window.set_text1(text1)
#@help_window.set_text2(text2)
#@help_window.set_text3(text3)
end
end

#==============================================================================
# ** Window_Points_Status
#------------------------------------------------------------------------------
# This window displays the user's Points, Attribute level, and Cost to Upgrade
# on the attrbitutes screen. Could only get points to update correctly.
# Not quite working as intended as I don't have much of a clue on what needs
# to be done, if it's at all possible. biggrin.gif
#==============================================================================

class Window_Point_Status < Window_Base
include Attibute_Def
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y corrdinate
# actor : actor
#--------------------------------------------------------------------------
def initialize(x, y, actor)
super(x, y, 240, WLH*3 + 32)
@actor = actor
refresh
end

def points
points = @actor.attr_points
end

def level
level = 5 # No clue on how to get Attribute level
end

def upgrade
upgrade = cost?(level)
end



#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0, (WLH - 26), 172, WLH, "Points: ")
self.contents.draw_text(70, (WLH - 26), 172, WLH, points)
self.contents.draw_text(0, WLH - 2 , 172, WLH, "Level: ")
self.contents.draw_text(70, WLH - 2, 172, WLH, level)
self.contents.draw_text(0, WLH + 24, 172, WLH, "Cost to Upgrade: ")
self.contents.draw_text(160, WLH + 24, 172, WLH, upgrade)
end
end


#==============================================================================
# ** Window_Attr_Status
#------------------------------------------------------------------------------
# This window displays the user's status on the attrbitutes screen.
#==============================================================================

class Window_Attr_Status < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y corrdinate
# actor : actor
#--------------------------------------------------------------------------
def initialize(x, y, actor)
super(x, y, 304, WLH*3 + 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
contents.font.size = 16
self.contents.font.color = system_color
self.contents.draw_text(0, WLH, 172, WLH, "ATK:")
self.contents.draw_text(0, (WLH + 10) , 172, WLH, "DEF:")
self.contents.draw_text(0, (WLH + 20), 172, WLH, "SPI:")
self.contents.draw_text(0, (WLH + 30), 172, WLH, "AGI:")
self.contents.font.color = normal_color
self.contents.draw_text(40, WLH, 172, WLH, @actor.atk)
self.contents.draw_text(40, (WLH + 10), 172, WLH, @actor.def)
self.contents.draw_text(40, (WLH + 20), 172, WLH, @actor.spi)
self.contents.draw_text(40, (WLH + 30), 172, WLH, @actor.agi)


draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 100, 0)
draw_actor_graphic(@actor, 110, 70)
draw_actor_hp(@actor, 140, 20)
draw_actor_mp(@actor, 140, 40)

# draw_actor_parameter(@actor, 180, WLH, 0)
# draw_actor_parameter(@actor, 160, (WLH * 1), 1)
# draw_actor_parameter(@actor, 80, (WLH * 2), 2)
# draw_actor_parameter(@actor, 0, (WLH * 1), 3)
end
end

#==============================================================================
# ** Scene_Attributes
#------------------------------------------------------------------------------
# This class performs the skill screen processing.
#==============================================================================

class Scene_Attributes < Scene_Base
include Attibute_Def
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@viewport = Viewport.new(0, 416-104, 544, 416)
@help_window = Window_Attr_Desc.new
@help_window.viewport = @viewport
@attr_window = Window_Atrr_List.new(0, 104, 544, 304-96, @actor)
# @attr_window.viewport = @viewport
@attr_window.help_window = @help_window
@attr_window.active = true
@status_window = Window_Attr_Status.new(0, 0, @actor)
#@status_window.viewport = @viewport
@status2_window = Window_Point_Status.new(304, 0, @actor)
#@status2_window.viewport = @viewport
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@help_window.dispose
@attr_window.dispose
@status_window.dispose
@status2_window.dispose
end
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(1)
end
#--------------------------------------------------------------------------
# * Switch to Next Actor Screen
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
$scene = Scene_Attributes.new(@actor_index)
end
#--------------------------------------------------------------------------
# * Switch to Previous Actor Screen
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
$scene = Scene_Attributes.new(@actor_index)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@attr_window.update
@status_window.update
@status2_window.update
update_attr_selection
end
#--------------------------------------------------------------------------
# * Update Attribute Selection
#--------------------------------------------------------------------------
def update_attr_selection
if Input.trigger?(Input::cool.gif
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
if @attr_window.on_attribute.nil?
Sound.play_buzzer
else
attr_i = @attr_window.on_attribute
level = @actor.attr_levels[attr_i]
up = cost?(level)
points = @actor.attr_points
if points >= up and level < ATTRIBUTES[attr_i][8]
Sound.play_decision
@actor.upgrade_attr(attr_i)
@attr_window.contents.clear
@attr_window.refresh
@status_window.refresh
@status2_window.refresh
else
Sound.play_buzzer
end
end
end
end
end
sprx11
QUOTE (332211 @ Dec 3 2008, 09:21 AM) *
QUOTE (sprx11 @ Dec 3 2008, 12:33 AM) *
QUOTE (332211 @ Oct 28 2008, 11:08 AM) *
QUOTE (dark_prince_razor @ Oct 27 2008, 08:49 PM) *
Okay I got it to add some.

But now I'm testing out a sideview battle system but it's giving me an attribute error when the enemy tries to use a Skill.
it says
"Script 'Attribute System' line 190: NoMethodError occured.
undefined method 'attributes' for #<Game_Enemy:0x194fb78"

and remember that 190 is essentially the
if !user.attributes.nil?
line, I just have my extra attributes making more lines.

Is there no enemy attribute method? That's what it sounds like

My bad...
try and replace that line with this:
CODE
    if user.is_a?(Game_Actor) and !user.attributes.nil?




Well i did that but when i try again i get this message. Click to view attachment
Me = Newbie and i really need help ohmy.gif


Try the latest version, I might just work.

EDIT: just uploaded version 2. I hope it has slightly less lag.



The problem is every time an enemy falls into some state like confusion or somtin like that.
It even happens on the V2.0 i just cant get it to work with states. confused.gif
332211
@sprx11
try adding this to bottom of the script
CODE
class Game_Enemy < Game_Battler
  def attributes
    return nil
  end
end


@Garge
I like your layout, I hope you don't mind if I copy that for the next version biggrin.gif.
For your problem:
Add this method in Scene_Attributes
CODE
#--------------------------------------------------------------------------
# * Get current Attribute
#--------------------------------------------------------------------------
  def on_attribute
    @attr_window.on_attribute
  end

And then do it like this in Window_Point_Status
CODE
def level
  if $scene.on_attribute.nil? #For Attributeless characters
    level = 0
  else
    level = @actor.attr_levels[$scene.on_attribute]
  end
end
sprx11
Woops my bad
Garge
Go ahead. thumbsup.gif
The Wizard 007
Hey great script. But I've run into a problem and am using your latest script. I went and made about 16 skills and starting with the 8th skill the menu will start to scroll down. It scrolls fine but it doesn't show the skill name or the icon. The text and icon for the skill name doesn't show up. Hopefully its a quick fix or a couple lines I can add in somewhere. I think it may have something to do with the refresh or draw attribute method but I'm not sure. If you (or anyone) knows of a fix I would be very thankful. This system will take up the core of my character stat development so it's pretty mandatory for my game. Thanks.
mafisa2
Hello.
I'm having a problem:
After I installed your Attribute sistem (last version), everytime any actor or battler suffers a status change, the game crashes. I'm receiving this error message:

CODE
Script 'Game_battler' line 786: ArgumentError ocurred.

comparision of Fixnum with Array failed


What should I do to fix it? Thanks.
Mickadell
Comment
Rate: Good

Nice, I might try it.
jens009
QUOTE (Mickadell @ Jan 17 2009, 03:57 PM) *
Comment
Rate: Good

Nice, I might try it.

This is considered as a spam, consider this your verbal warning.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.