Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

[SOLVED] CoreEngine Custom Parameters clash with identical short name Locked

A topic by Jacie1krece created 25 days ago Views: 94 Replies: 3
This topic was locked by Hakuen Studio 7 days ago
Viewing posts 1 to 4
(1 edit)

There is a problem with custom parameter failing to initialize when VisuMZ_0_CoreEngine defines a custom stat with the same short name, even if it refers to the same thing. The ordering of the plugins doesn't impact it - both placing Custom Parameters after and before CoreEngine on the plugin list still causes the problem.

Here is the JS I'm using for that custom stat (inside of CoreEngine):

// Declare Constants

const user = this;

let actorID = this.actorId();

// Calculations

return $gameActors.actor(actorID).sat;


When the Abbreviation of the CoreEngine Custom Parameter is also `sat`, the actor doesn't get applied the `sat` property at all, and accessing it either gives out a 0 or an error. Changing the CoreEngine Custom Parameter's Abbreviation to something else, like `satk`, solves the issue.

This is also my solution for this issue - so the problem doesn't happen anymore for me due to that solution, but I still want to let you know about this problem so you can decide whether it's possible to fix it (or worth to fix it).

Here is a sample project showcasing the issue, if you want to investigate it further: https://drive.google.com/file/d/1vC4Ycs9Z1ECRpD0lZ-bMVJk5Zp5aaz8f/view?usp=shari...

Developer

Hi!

As I can see, the problem is a "RangeError: Maximum call stack size exceeded". Which basically means JavaScript kept “calling functions nonstop” until it exceeded the memory limit reserved for that process.

Imagine a stack of plates: every time one function calls another, a plate is added to the stack. When the function finishes, the plate is removed. But if a function keeps calling itself repeatedly, the stack grows too large and collapses.

So, I don't know what VS is doing. My guess is, they are creating a property with the abreviation name for the Actor. And inside of that same property creation, you are also making it call itself. That is why when you change the abreviation to another name it kinda works. But that is only my guess, I don't know for sure due to obfuscation.

Lucky to us, there is a quick fix for that, and you just need to change the JS you are using on the Visu Core plugin to that:

//Change the Abbreviation to sat to cause the issue
 
//Otherwise it will not appear
// Declare Constants
const paramId = Eli.CustomParameter.findCParamId("sat")
// Calculations
return this.cparam(paramId);

You only need this line, if you want to refer to your parameter by the abreviation name. 

const paramId = Eli.CustomParameter.findCParamId("sat")

Otherwise, you can just use that on the whole formula:

return this.cparam(paramId);

And replace "paramId" with the id of your custom parameter.

Let me know the results!

...wait, so that's it? Just a stack overflow? I didn't notice that, likely because I was getting a bit different error (that there is no `sat` property on the actor, not that it started calling itself until stack overflowed...)

Also while my workaround worked in terms of resolving the issue, your fix feels much more elegant. Thank you!

Developer

Glad it worked! Have fun ^^

Developer locked this topic