Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Stats/Attributes to be universal

I'm using RTAB, Animated Battlers, as well as a display script i found in a demo of Utopian Chaos.
Within all of their code I can easily do something like battler.sp, @battler.index, or self.hp, etc...
How do I add a new sort of 'stat' so to speak?
It doesn't need to actually affect anything (like strength or speed or whatever), it just needs to be a variable that applies to every battler.
I thought I had it figured out by messing with Game_Battler, but I'm still missing something and I don't know what it is.
So, again...

I need to add a new stat/parameter/value/variable to Game_Battler and it need simply be a value I can reference easily with battler, self, user, etc...

EDIT
NEVERMIND!! I got it. Just realized I made a silly mistake. When defining the new attribute I used attr_reader instead of accessor. I also did
def newattribute
@newattribute = 0
end

instead of

def new attribute
@newattribute
end

Dunno if that last part makes a difference... either way its fixed and this thread can be burninated.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top