Error "getChildAt: Index (-1) does not exist" need help please

Snarkyfork

Veteran
Veteran
Joined
Oct 29, 2015
Messages
308
Reaction score
30
First Language
English
Primarily Uses
First time this error has popped up for me was today, I had been doing some work on tile sheets but honestly I have no idea what the error might be. Is there a list somewhere of all the different error codes?
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,678
Reaction score
1,094
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi!
Trigger the error again, press f12 or f8, and show us the print of the console tab.
 

Snarkyfork

Veteran
Veteran
Joined
Oct 29, 2015
Messages
308
Reaction score
30
First Language
English
Primarily Uses
I think this has to do with the event I am using to fade out a layer added by Galv's Layer Graphics plugin. If you like I can take screenshots of the event in the morning and post them here.

Does this error message information give any clue as to what I can do to fix it?

rpg_managers.js:1954 Error: getChildAt: Index (-1) does not exist.
at ShaderTilemap.getChildAt (pixi.js:9147)
at ShaderTilemap.removeChildAt (pixi.js:9201)
at Spriteset_Map.createLayerGraphics (GALV_LayerGraphics.js:494)
at Object.Galv.LG.createLayer (GALV_LayerGraphics.js:263)
at Object.Galv.pCmd.LAYER (GALV_LayerGraphics.js:244)
at Game_Interpreter.pluginCommand (GALV_LayerGraphics.js:234)
at Game_Interpreter.pluginCommand (Shaz_MultiTimers.js:90)
at Game_Interpreter.pluginCommand (YEP_PartySystem.js:731)
at Game_Interpreter.pluginCommand (SRD_BattleEndEvents.js:152)
at Game_Interpreter.command356 (rpg_objects.js:10492)
SceneManager.catchException @ rpg_managers.js:1954
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7863
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1902
SceneManager.updateMainNoFpsSynch @ YEP_FpsSynchOption.js:212
SceneManager.updateMain @ YEP_FpsSynchOption.js:203
SceneManager.update @ YEP_X_CoreUpdatesOpt.js:7860
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,678
Reaction score
1,094
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hmm... I think this may be the issue!
When I use that plugin a long time ago, I have this error too, because I was setting the Map note tag wrong.
How do you set up the layers? With plugin commands or map note tags?
I think will be helpful if you send the event in the case of the plugin command.
 

Snarkyfork

Veteran
Veteran
Joined
Oct 29, 2015
Messages
308
Reaction score
30
First Language
English
Primarily Uses
Hey, sorry for the late response, we lost power yesterday and it just came back on. I have never had this issue before with Galv's layer plugin, it's odd. I was kinda wondering if maybe another plugin was using the same variable it uses to fade layers. It takes time to get the error to repeat and it seems very random. Here are the screenshots of the event.

Edit: Tried changing the variable and it still happens.

1.png2.png3.png4.png5.png
 
Last edited:

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,678
Reaction score
1,094
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi there!

On page 2, are you sure you have to call the plugin command again to update the layer opacity?
Maybe you can just reduce the layer opacity through the variable, or using directly a script call:
$gameMap.layerSettings[mapId][layerId].opacity--;
And check if
Code:
$gameMap.layerSettings[mapId][layerId].opacity <= 0
break the loop

Well, I see that you have 3 events page(3,4,5) removing the same layer.
Do you know for sure that these events are not playing again after you have already removed the layer?
Maybe you can put a conditional check for this, just to be safe.
Use the script field of the conditional branch:

$gameMap.layerSettings[mapId][layerId]
I don't remember if this returning an object or an array... But maybe you can check with this. So the layer will only be removed when it indeed exists.

The error getChildAt: Index (-1) does not exist Is happening because the plugin is trying to find a layered graphic in a position of the array of layers, but he is not finding it, so it will return -1.
 

Snarkyfork

Veteran
Veteran
Joined
Oct 29, 2015
Messages
308
Reaction score
30
First Language
English
Primarily Uses
On page 2, are you sure you have to call the plugin command again to update the layer opacity?
Maybe you can just reduce the layer opacity through the variable, or using directly a script call:
$gameMap.layerSettings[mapId][layerId].opacity--;
And check if


Code:

$gameMap.layerSettings[mapId][layerId].opacity <= 0
break the loop
Wow, you speak like your a RPG Maker scientist, heh. I would love to know if there are college classes I can take to know as much about this as some of you guys do.

To answer your question, I have wondered that myself. That maybe there is some other more simple method to reduce the opacity. Honestly I am not very advanced with using RPG Maker and many of the events I use are from examples other people have given me or ones I have found in demo's. You gave an example of a script call and code above but I am not sure how to implement it, should I try just plugging it in and see if it works?'

'
Well, I see that you have 3 events page(3,4,5) removing the same layer.
Do you know for sure that these events are not playing again after you have already removed the layer?
Maybe you can put a conditional check for this, just to be safe.
It has a conditional branch to check if self switch A is on but in the original event, that I used as an example for this one, there was no actual tab/event that had the "self switch A" checked so I just assumed that it wasn't necessary to create a blank event page with it.

Could that be an issue?

So you are saying I should maybe change the "self switch A" condition to one using the script call " $gameMap.layerSettings[mapId][layerId]" right?

Thanks for your feedback, some of this is pretty far above my pay grade. I am going to fiddle around with what you have given me and see what happens.

Edit: On a side note I have noticed that when i zone from one map to another after the time change'switch flip from sunrise to day sometimes the sunray layer is still on the next map and then it starts to fade out immediately... I would think looking at the event that if I am NOT on that map during the time change that the sunray layer should be completely removed and should not fade out. It makes me think that the script is still maybe reading something when it shouldn't be. Maybe I should use a different variable (0004 is the default) for each map I have the sunray layer on?

Edit: Okay... I changed the conditional branch on events 3, 4, and 5 to use the script rather than self switch A and I haven't gotten the error again... yet. Lets cross our fingers, heh.
 
Last edited:

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,678
Reaction score
1,094
First Language
Portuguese - Br
Primarily Uses
RMMZ
Wow, you speak like your a RPG Maker scientist, heh. I would love to know if there are college classes I can take to know as much about this as some of you guys do.
Not at all xD. I'm just someone who spent some time in RPG Maker. You will get there with time too ^^

Edit: On a side note I have noticed that when i zone from one map to another after the time change'switch flip from sunrise to day sometimes the sunray layer is still on the next map and then it starts to fade out immediately... I would think looking at the event that if I am NOT on that map during the time change that the sunray layer should be completely removed and should not fade out.
Hmm... Do you set up the sunray in the plugin command before entering the map? If that is the case, maybe you should try to set up the sunray(only in this case)in the current map. So you check:
If switch Id is on, then call the plugin command to show the sunray. Otherwise, you don't call it.

Edit: Okay... I changed the conditional branch on events 3, 4, and 5 to use the script rather than self switch A and I haven't gotten the error again... yet. Lets cross our fingers, heh.
Ok! So let's hope everything works! ^^

You gave an example of a script call and code above but I am not sure how to implement it, should I try just plugging it in and see if it works?'
Yeah, try it and see if works. If not, maybe I do a patch for fade layers(if Galv let me share, I have to ask him first). Because I also use that on my old game.
 

Snarkyfork

Veteran
Veteran
Joined
Oct 29, 2015
Messages
308
Reaction score
30
First Language
English
Primarily Uses
Hmm... Do you set up the sunray in the plugin command before entering the map? If that is the case, maybe you should try to set up the sunray(only in this case)in the current map. So you check:
If switch Id is on, then call the plugin command to show the sunray. Otherwise, you don't call it.
I think I figured out why the sunrays appear on other maps at odd times, what is happening is... If I am on that map during the hours of 6am to 9am (when self switch A is flipped for the event on said map) then it moves the event for that map into the second tab where it begins to fade out the layer but it doesn't fade out the layer until I go BACK onto that map after 9am. On maps that I haven't been to during 6am to 9am the sunray layer doesn't appear on if the clock is past 9am. Not sure how I would get around that one... but its not a bid deal.

As for the error, I haven't had it again so far so hopefully its fixed. Thanks again for your help!
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,701
Reaction score
4,659
First Language
English
Primarily Uses
RMMZ

I've moved this thread to Javascript/Plugin Support. Please be sure to post your threads in the correct forum next time. Thank you.

 

Snarkyfork

Veteran
Veteran
Joined
Oct 29, 2015
Messages
308
Reaction score
30
First Language
English
Primarily Uses
It seems I have may have spoke too soon, I am still getting the error it's just more infrequent now.

Again, any help is greatly appreciated. I really want to have working sunrays in my game and it's not hard to just have them "blink" off rather than fade out slowly... but its not as ascetically appealing. I would love to get this to work without error.

Here is the message I am getting from the console and the event I am using currently:
Error.png1.png2.png
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Oh no. That moment when you try to fix something you modified in your game, like, a year ago but didn't want to fix then, and you now have no idea what you even did. Me right now, trying to figure out why my gold window is over stretched?
LittlePIGGY wrote on atreyoray's profile.
Where are you TT^TT
We need ARP_InGameManual for MZ
Oh my gosh. Thank you, Macy's! Thank you so much! You have made me very happy!
Happy Thanksgiving everyone! What are you thankful for? I'm thankful that I no longer have PTSD, and that I get to enjoy a good meal with my mom and stepdad! It might not be the same as before COVID, but at least I still get to enjoy the holiday!

Forum statistics

Threads
105,549
Messages
1,014,561
Members
137,225
Latest member
Eryndor
Top