Possible event sheet glitch?

Discussion and feedback on Construct 2

Post » Sat Sep 14, 2013 4:17 am

Hello all.

I've discovered a behaviour with event sheets that I find peculiar and I'm wondering if anyone else has discovered it, or whether it's normal.

The game I'm making has various levels that the player can revisit. Each level has its own sheet and each of those sheets access 3 common sheets that govern things that happen on every level the player visits, such as how the player moves and reacts, how the enemies move and react, etc.

As Persist makes it impossible to restart the game from scratch I'm using arrays to save the location and health of enemies upon exiting the level so if the player revisits it they'll find everything as they left it. At the end of the layout information is stored in the arrays, at the start of the layout information is being read from the arrays. The reading and writing of the arrays in on one of the common event sheets.

Now, after that long-winded introduction, here's the peculiar behaviour.

When you leave a level the game is writing to the arrays from the common sheet. I've tested it to make sure of this. When you go back to the level, however, the information isn't getting read back. The only way I seem to be able to make it read the information is by putting all of the array reading rules on the actual event sheet for the layout, not on one of the common sheets.

Is this a known problem? Is it working as intended and I'm unaware of this? I know as far as problems go it's a tiny one, after all, I can copy and paste the reading of the arrays to each layout in 10 seconds, but the behaviour itself makes no sense and I'm wondering if anyone can explain why it is so.

Thanks!!
B
10
S
3
G
1
Posts: 30
Reputation: 1,279

Post » Mon Sep 16, 2013 5:39 am

Nobody else had had this issue?
B
10
S
3
G
1
Posts: 30
Reputation: 1,279

Post » Mon Sep 16, 2013 5:45 am

Are you able to recreate this in a new Capx?

I've had arrays that get updates on included pages, but I don't know how similar the situations are.
B
230
S
62
G
33
Posts: 902
Reputation: 40,323

Post » Mon Sep 16, 2013 3:49 pm

I too have encountered an issue with the array functions.

I load weapon quantities in one event sheet (layout A) then, on layout B using a different event sheet, I test for the quantity of weapons in the array to determine the opacity of some HUD icons. Of course the arrays are global. The opacity of the each HUD icon is determined by a value in the array. When tested using the 'Value At(x)' condition the icons are not displayed correctly, even though the array contains the expected value when viewed on the debugger. My work-around has been to load the required array quantity into another variable and then test that instead... I've literally just discovered this in the last 10 minutes and found this thread on the forum.

I also create loads of objects according to another global array - the x and y positions are loaded in one event sheet and then the array is subsequently used in another event sheet. All of the system Create Object functions seem to work correctly. So, to me it appears that the 'Value At(x)' test is broken even though the array data is there...

I'll try and produce an example capx later today if I can reproduce the error.
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,207
Reputation: 43,836

Post » Mon Sep 16, 2013 4:46 pm

Not sure if it's related, but I find lots of issues with arrays where I need to add a 0.1 second wait between actions, or need to do the action in a non-sub event.

So really not sure why, but maybe you could try playing around with waits and positioning and see if that helps.
B
28
S
8
G
5
Posts: 429
Reputation: 7,007

Post » Mon Sep 16, 2013 5:08 pm

Is it possible that the array is getting re-initialized in the common event sheet when the new layout is loaded?

I'm doing some things with global arrays but I haven't gotten to the point yet where I'm reading from the non-layout event sheet. When I get to that I'll keep an eye out for this!
B
11
S
2
Posts: 87
Reputation: 1,112

Post » Mon Sep 16, 2013 8:32 pm

I ran into this issue as well recently. I can't remember exactly what I was working on, but I did like Colludium did and just set the array.at to a variable and used the variable to compare.

I tried recreating it in a blank capx and I couldn't get it to happen so I assumed it was something else in my project. One thing was, I remember it being an older project that was started in a much earlier version of Construct 2.
B
101
S
32
G
11
Posts: 1,552
Reputation: 21,667


Return to Construct 2 General

Who is online

Users browsing this forum: higher2003, lukewasthefish, MadSpy and 10 guests