Custom Stats

Forthright

Veteran
Veteran
Joined
Mar 9, 2016
Messages
60
Reaction score
10
First Language
English
Primarily Uses
So, I am using and potentially adapting Bobstah's custom stat script to use for my game.  Thank you Bobstah for all your hard work.  I'm having trouble getting it to function how I want.  I believe it will already do the first part of what I would like, but I am unable to get it to work.  Here is the part of code that I am trying to figure out if I need to change.


Bobstah.CustomStats.defineStat = function(name, percent) {
    var newObj = Bobstah.CustomStats.statList[name] = {
        'name': name,
        'percent': percent
    };
    if (typeof(Bobstah.CustomStats[name]) === "undefined") {
        Bobstah.CustomStats[name] = newObj;
    } else {
        if (Bobstah.CustomStats[name].percent !== percent) {
            console.warn("Conflicting percentage information for "+name+"!");
            Bobstah.CustomStats[name].percent = true;
        }
    }
};


Bobstah.CustomStats.createStatNode = function(baseValue, op, evl, percent) {
    if (op === "-") {
        op = -1;
    } else {
        op = 1;
    }
    evl = evl || false;
    percent = percent || false;
    var obj = {
        'baseValue': baseValue,
        'eval': evl,
        'modifiers': {},
        'modifier': 0,
        'percent': percent,
        'op': op
    };
    return obj;


What I am gathering from this, is that it will not allow the first definition of a variable to be anything other than a whole number.   I have a computation I want it to do, but I don't remember the function to get JavaScript to only value it as a whole number and not a humongous decimal.  What I am wondering, is this only allowing for a whole number to be put in and cannot use an evaluation to determine the stat, such as str=$(a.level / 3 + 12).
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,070
Members
137,577
Latest member
SadaSoda
Top