Multiplying arrays, passing them through function args

● ARCHIVED · READ-ONLY
Started by Bloodmorphed 2 posts View original ↗
  1. So, I've ran into a nother problem. I've been playing with this loop for awhile now, and I cant get it produce anything more than 9 0's. (Which is weird cause it doesn't mess with battlers.)

    Code:
        switch (diffSetting) {
          case 0:
            var total = 0;
            for (var i = 0; i < this.enemy().params[paramId].length; i++) {
              total = this.enemy().params[i] * easyParam[i];
    
            }
            console.log(total);
            return this.enemy().params[total];
          break;

    I'm thinking I either am setting up the loop wrong, or I'm using the wrong array.

    EDIT:
    Well I thought I found an easier way to do this (less code), but I keep getting an "unexpected '=>'" found. I'm not sure if this engine doesn;t support it, or I'm using it wrong (most likely case)

    Code:
            var enp = this.enemy().params[paramId];
            var esp = easyParam;
            var total = enp.map((a, i) => a + esp[i]).reduce((t, n) => t * n);
            console.log(this.enemy().params[total])
            return this.enemy().params[total];

    EDIT2:

    I am an absolute idiot. Like really. I tried to make this more complicated then it really is LOL.

    Code:
            var easyDifficulty = Math.floor(this.enemy().params[paramId] * easyParam[paramId]);
            return easyDifficulty;
    Man oh man...
  2. For the record yea arrow functions don't work in MV.