Edit:
[Redacted] Outdated info.
[Redacted] Outdated info.
let x = 5;
let y = x; //the actual value 5 gets assigned
y = 3;
console.log(x); //still 5
console.log(y); //now 3
let a = {foo:'bar', bar:'foo'};
let b = a; //the actual value in a still gets copied to b
//but since the actual value is only a pointer to where the object is stored, a and b point to the same object.
b.foo = 'foo';
console.log(a); //even though we changed b.foo, now a.foo is also 'foo'
Putting it simply, you can look at a primitive as a type of variable that only holds one value at any given time. For example, a number variable can only hold one number at any given time, so it is a primitive. The same goes for a boolean variable, as it can only hold either
true or false at any given time--never both. In JavaScript, strings are also considered primitives.Huh, I didn't know that. In every other language I regularily work with they are considered complex, as they are an array of the actually primitive character "under the hood".
Math.ceil()
thank you
Why are you using this second
user._stockpile variable? If you're also using state counters, everything you're doing with the stockpile variable can just be done with the counters directly...I don't see the point of messing with two different things.if (user._stockpile = 0){if (user._stockpile==0)No. For one, 1 and 0.1 are completely different numbers (I know that's obvious, and I don't intend it to come across as snarky, but you typed them both as ideas 😛).
this._buffs[paramId] is going to be 2, and the formula's result of 1.5 is what your ATK is multiplied by. You simply make it add the buffRate instead of multiply it.
No, not quite right. You don't want to mess with the paramRate, that's nothing to do with elemental anything, we're talking about parameters. If you go into an Actor, Class or State, one of the traits you can select is Parameter and it's a multiplier.
(base + plus) * paramRate + buffRate + flat
this._buffs[paramId] and it will add 1 point for each stack of buff.You are also repeatedly using the variable "stateId" but that should be a number - the ID of the state.
i am using the correct state number the one i originally put here a was a blank version i made so when i was working on the skill
Okay...it makes the most sense to post the current actual code you're using. Otherwise, how are we to know there isn't some other little change that's causing your problems?
<Custom Apply Effect>
// Increase the stockpile stack by 1
user.addStateCounter(stateId, 1);
// Cap the stockpile stack at 3
user.clampStateCounter(stateId, 1, 3);
</Custom Apply Effect>
<Custom Respond Effect>
user.addStateCounter(stateId, -1);
if (user.getStateCounter(stateId) == 0)
user.removeState(stateId);
</Custom Respond Effect>
The states as buffs idea sounds cleaner than messing too much with stuff I don't understand well. I will give it a try, thanks!
Original thread: https://forums.rpgmakerweb.com/threads/javascript-questions-that-dont-deserve-their-own-thread.46341/