How do I replace all Text objects with SpriteFonts

Get help using Construct 2

Post » Fri Oct 06, 2017 11:30 am

Hey,

Is there any easy way to replace all Text Objects with SpriteFont objects? And maintain all my events?
I'm assuming not, but wanted to check with all the smart cookies of this forum before I painstakingly go through and replace over 1000 events (not even exagerated sadly).

thanks in advance!
Image
Keeghan McGarry | Managing Director
Facebook-Website
B
14
S
3
Posts: 77
Reputation: 1,081

Post » Fri Oct 06, 2017 12:25 pm

So I found a way, it's a bit of a pain in the ass and kind of risky. So if you need to do the same thing, BACKUP FIRST!

!!PROCEED WITH CAUTION!!
Basically, you need to edit the XML's for the layout and the event sheet.
First, in your project create the new objects (in my case SpriteFont's) and name them something obvious. I used the same name with "2" on the end.
Save your project, must be as a project and not a single file.
Close Construct2.

Open the layout XML in your preferred editor and replace the names, lets say Title with Title2.
If you are going to a new object type with different parameters (like Text to SpriteFont) you will need to also put the new parameters into the XML. I suggest making a fully setup copy of your new Object in the editor first and copy pasting.

Then, do the same in the Event Sheet XML, just replace all the names.

This will work to replace any Object Type with another one, provided they have IDENTICAL sets of ACE's

This worked for me and saved hours of replacing events in the engine and retyping everything... Still not an easy task. Better suggestion, design it right first time round!
Image
Keeghan McGarry | Managing Director
Facebook-Website
B
14
S
3
Posts: 77
Reputation: 1,081

Post » Fri Oct 06, 2017 1:06 pm

@KeeghanM thanks for the tip!
Do you know what the "sid" tag is for in the event sheets XMLs?
Code: Select all
<action id="0" name="Set text" sid="140336039528208" type="GameOverText">


I was also thinking about making some bulk changes by editing XML files, but I was worried about this sid tag.. What if it's somehow related to the object which I'm replacing?
Check out my awesome game Doptrix
B
17
S
9
G
50
Posts: 829
Reputation: 27,967

Post » Fri Oct 06, 2017 2:58 pm

@dop2000 I think (stress on the think) that its an id associated with the action, not the object.
I haven't had any issues when I only replace the type value.
Image
Keeghan McGarry | Managing Director
Facebook-Website
B
14
S
3
Posts: 77
Reputation: 1,081

Post » Fri Oct 06, 2017 3:24 pm

@KeeghanM
That's what I was thinking too, but still a bit worried :)
I just made a little test - replaced Text object with SpriteFont object in an event (manually in C2), and then compared xml files - sid tag remained the same.
So yeah, it should be safe to change objects in xml.
Check out my awesome game Doptrix
B
17
S
9
G
50
Posts: 829
Reputation: 27,967


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests