RPG Maker Forums

hi why i get error when i delete example DiceSlotBig[3][2 and 3]


i add a conditional if 


if (DiceSlotBig[2]!== null) { 


So, if no found 2d array after de x, y, is suppose to jump the for, and not give me error ?!


the msg error is 


TypeError: Cannot read property 'id' of undefined


Tanks for help guys


 


DiceSlotBig = [
[1206, 571, 'dice-1', 120], // slot 1 [x, y, 'filename', $dataItems[id]] type dice (note: fileName and id are temporly here, need to delete)
[1111, 571, 'dice-2', 121], // slot 2 [x, y, 'filename', $dataItems[id]] type dice
[1013, 571, 'dice-3', 122], // slot 3 [x, y, 'filename', $dataItems[id]] type dice
[917, 571], // slot 4 [x, y, 'filename', $dataItems[id]] type dice ################# this give me error if i delete file name and id like thats ?
[1206, 656, 'dice-5', 124], // slot 5 [x, y, 'filename', $dataItems[id]] type dice
[1111, 656, 'dice-6', 125], // slot 6 [x, y, 'filename', $dataItems[id]] type dice
[1013, 656, 'dice-7', 126], // slot 7 [x, y, 'filename', $dataItems[id]] type dice
[917, 656, 'dice-8', 127], // slot 8 [x, y, 'filename', $dataItems[id]] type dice
[829, 571, 'dice-key-sivler', 128], // slot 9 [x, y, 'filename', $dataItems[id]] type ITEM
[750, 571, 'dice-potion-red', 129], // slot 10 [x, y, 'filename', $dataItems[id]] type ITEM
[829, 656, 'dice-key-gold', 130], // slot 11 [x, y, 'filename', $dataItems[id]] type ITEM
[750, 656, 'dice-potion-blue', 131], // slot 12 [x, y, 'filename', $dataItems[id]] type ITEM
]
var PidDice = 31;
var NBXmargin = 20,
NBYmargin = 20; // marge x y for small Number quantity indicator Dtext
for (i = 0; i <= DiceSlotBig.length - 1; i++) {
console.log(i);
if (DiceSlotBig[2] !== null) {
// check if has item in slot by array ( need filename and dataItems) if null do nothing
//show dice to the X dice to x, y coor slot only if filename exist (fileName will be added in other item menu selector)
//PID start to 31 and max Pid 47
$gameScreen.showPicture(PidDice + i, DiceSlotBig[2], 1, DiceSlotBig[0], DiceSlotBig[1] + 100, 0, 0, 255, 0);
new IAVRA.ANIMATE.Tween($gameScreen.picture(PidDice + i), {
_y: DiceSlotBig[1],
_scaleX: 100,
_scaleY: 100,
_opacity: 255
}).easing(IAVRA.EASING.elastic.out).duration(30).start();
$gameScreen.setDTextPicture('\\OW[5] ' + '\\v[' + $dataItems[DiceSlotBig[3]].id + ']' + ' ', 16); //plugincall dtext
$gameScreen.setFont('GameFont');
$gameScreen.dTextBackColor = 'rgba(0, 0, 0, 0.6)';
$gameScreen.showPicture(PidDice + i + 1, '', 1, DiceSlotBig[0] + NBXmargin, (DiceSlotBig[1] + NBYmargin) + 100, 0, 0, 255, 0);
new IAVRA.ANIMATE.Tween($gameScreen.picture(PidDice + i + 1), {
_y: DiceSlotBig[1] + NBYmargin,
_scaleX: 100,
_scaleY: 100,
_opacity: 255
}).easing(IAVRA.EASING.elastic.out).duration(80).start();
$gameScreen.setPictureCallCommon(PidDice + i, 8, 1); // set able picture to click, bring to CommunEvent 8
PidDice++;
}


}

}


 

Latest Threads

Latest Posts

Latest Profile Posts

He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!

Forum statistics

Threads
106,036
Messages
1,018,461
Members
137,821
Latest member
Capterson
Top