I'm trying to write a small plugin that creates an array of variables I can access when calculating a damage formula. I'm using Yanfly's Skill Learn system to create a system where actor's can upgrade their skills, and I want the Attack skill to be upgradeable. The obvious issue is that Attack is hard coded to skill #1, and while I thought about using Yanfly's Weapon Unleash, I feel it's unnecessary because the only functional difference between the base Attack and its higher levels is a single variable. So I was thinking of simply writing a plugin to give me a function that creates an array where each index is equal to an Actor ID. I've written the function, but I don't know how to give it access to Game_Actor or $dataActors so that it can properly execute. The code is posted below.
The damage formula for Attack is: (a.atk * arrayAtkPower[a.actorId()]) - b.def
This is also my first time writing a plugin for RPG Maker from scratch. Any advise is welcome!
MAX_ACTORS = 10; //The current max Actor ID, increase manually if more actors are addedconst arrayAtkPower = new Array(MAX_ACTORS); //Declares global array userAtkPower, which stores the multiplier of Attack for each actorfunction initAtkPower() { for (let i = 0; i < MAX_ACTORS; i++) { if (i == 0) { arrayAtkPower[i] = -1; //Empty Actors and head of list designated with -1 } else { arrayAtkPower[i] = 0.65; } }}$gameParty.allMembers().forEach(function(m) { var userAttackPower = 0.65; if (m.isLearnedSkill(13)) { userAttackPower = 2.9; } else if (m.isLearnedSkill(12)) { userAttackPower = 2.45; } else if (m.isLearnedSkill(11)) { userAttackPower = 2.05; } else if (m.isLearnedSkill(10)) { userAttackPower = 1.7; } else if (m.isLearnedSkill(9)) { userAttackPower = 1.4; } else if (m.isLearnedSkill(8)) { userAttackPower = 1.15; } else if (m.isLearnedSkill(7)) { userAttackPower = 0.95; } else if (m.isLearnedSkill(6)) { userAttackPower = 0.8; } else if (m.isLearnedSkill(5)) { userAttackPower = 0.7; } arrayAtkPower[m.actorId()] = userAttackPower; //Sets value of actor's attack power at a position in the array that correlates to their ID});The damage formula for Attack is: (a.atk * arrayAtkPower[a.actorId()]) - b.def
This is also my first time writing a plugin for RPG Maker from scratch. Any advise is welcome!