Im stupid and JavaScript isnt my main language. I'm gona rewrite this code from scratch
MZ I'm just stupid and gota rework my code
Javascript/Plugin SupportDoes it do this with no plugins installed?
I'm really curious as to why you've coded it like this, it seems pretty inefficient if I understand it correctly. That's difficult to tell, though, since you haven't explained what ep/sp/statp are intended to be and what results you're *expecting* with the test input. I can probably refactor it for you if you tell me what it's actually meant to *do*.
Also why have you declared an empty main function and then called it?
I'm really curious as to why you've coded it like this, it seems pretty inefficient if I understand it correctly. That's difficult to tell, though, since you haven't explained what ep/sp/statp are intended to be and what results you're *expecting* with the test input. I can probably refactor it for you if you tell me what it's actually meant to *do*.
Also why have you declared an empty main function and then called it?
Potentially it's just extra parameter, special parameter, and the base stat parameter.
I know what it is potentially; I'd rather know what it is actually, for which we need confirmation from OP. 😛
Something about this just doesn't add up. I don't see anything in your code that would make
a.diForm() valid in an attack formula. Is there more code you haven't posted?Barring an error in code you haven't shown us, I could speculate that the freeze might occur because the engine is calling your code several times in a row, instead of just once. The only problem with that theory is that it doesn't explain multiplying by 100…
Another minor thing I would note is that you probably want something like
Math.randInt(0,4) instead of Math.ceil(Math.random() * 4).Yeah, this is why I said we need more information. It's impossible to tell what's going on with what's been provided because things have clearly been omitted or incorrectly explained *somewhere*.
Original thread: https://forums.rpgmakerweb.com/threads/im-just-stupid-and-gota-rework-my-code.178126/