Skip to main content

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

We've investigated, and thanks to your detailed report we've figured out the problem! The issue is with this line of code in the CardReward Common Events:

for(var i = 0; i < 3; i++) rewardPicks.push(cardPoolIDs.splice(Math.random() * cardPoolIDs.length, 1));

We wrote it this way to make it fit in the tiny Script Call line limit, but it was producing an error we didn't notice until now. We were pushing one-length arrays containing numbers instead of the numbers themselves! That is doing weird things when it comes time to group cards together.

To fix the issue, replace this line with the following inside your Common Events:

for (var i = 0; i < 3; i++) { 
var index = Math.randomInt(cardPoolIDs.length); 
rewardPicks.push(cardPoolIDs[index]); 
cardPoolIDs.splice(index, 1); 
}

You may need to condense it to fit in the Script Call, or reorganize the calls, but that should be fine.

Let us know if this resolves the issue, and thank you for your patience on this.

--Isiah

(2 edits) (+1)

Due to limited script space, I used ChantGPT to condense the corresponding code into a single line and replaced it.

Array.from({length: 3}, () => (index => (rewardPicks.push(cardPoolIDs[index]), cardPoolIDs.splice(index, 1)[0]))(Math.randomInt(cardPoolIDs.length)));
After testing, the card misalignment bug no longer occurred. Thank you very much.