[r252] Cannot spawn and set 2 Text objects at the same event

Report Construct 2 bugs here.

Post » Wed Feb 21, 2018 4:17 pm

Problem Description
By doing 2 Text object creations and assignments on the same "For Each" event, the event was causing some Text objects to not showing the correct texts.

Attach a Capx
https://drive.google.com/file/d/1fmISUp ... sp=sharing

Description of Capx
My puzzle RPG prototype

Steps to Reproduce Bug
Preview the project. Try to test after toggling the disability of the second sub-event inside the For Each "Unit" event.

Observed Result
Only two texts that were modified while some were unchanged.

Expected Result
All texts supposed to have their texts the same texts as their assigned variables.

Affected Browsers
  • Chrome: (YES)

Operating System and Service Pack
Windows 10 Fall Creators Update

Construct 2 Version ID
Construct 2 r252
SONAR Gamer's Club Discord |
Twitter | Facebook | Instagram

If you play Puyo Puyo games, you can meet me at the Puyo Puyo English Community Discord: https://discord.gg/0k41S8ARwvY2iTIQ
B
111
S
27
G
11
Posts: 703
Reputation: 13,225

Post » Thu Feb 22, 2018 11:49 am

This is not a bug.
You need to wait 1 tick before picking newly created objects.
Also, you need to put "StatText ID=Unit.UID" inside the "For each Unit" loop.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,377
Reputation: 84,381

Post » Fri Feb 23, 2018 4:59 am

:? Like this?
Image

Now only one text that were modified.
SONAR Gamer's Club Discord |
Twitter | Facebook | Instagram

If you play Puyo Puyo games, you can meet me at the Puyo Puyo English Community Discord: https://discord.gg/0k41S8ARwvY2iTIQ
B
111
S
27
G
11
Posts: 703
Reputation: 13,225

Post » Fri Feb 23, 2018 5:39 am

No, like this:
Image

It would actually make more sense to move this code to a separate event or function, and call it when some Unit parameters are changed.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,377
Reputation: 84,381

Post » Fri Feb 23, 2018 6:03 am

You can set the text at its creation. As well as do variable comparisons, just not the variables of the object you just spawned... and set.
I would just put two text objects in a container however.
Also, might want to consider of the difference between spawn and create. Angles will get you eventually.
Image ImageImage
B
179
S
50
G
207
Posts: 8,719
Reputation: 128,306


Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests