Modding Maps

Well, problem’s fixed, I guess…

I tried saving it in all different settings in Paint Net (8 bit, 24 bit and 32 bit from memory) and it had the same crash. Then, I downloaded Irfanview, re-saved and now it works.

So I guess I’ll just re-save everything with irfanview. It’s not a great solution, but it gets me moving. Thanks for looking into this Melon!

OK, another problems. I tried to create a new pearl, and made the following changes to the default files. All code below is essentially for debugging, there’s no real content. Basically, the idea was that I needed a bit more time before they get caught to explain some things, so they get lost before being captured with goods from the caravan. (skip past to see the issue):

maps/index.xml:  

in <pearl_data> (after pearl id 1, as this was intended to go between 1 and 2)
    <pearl id="57" level="Walking in Circles" level_id="1_2b_lost" description="$MCG" _x="150" _y="145" _type="battle"/>  

in <reward_data> (after pearl id 1, as this was intended to go between 1 and 2)
    <reward pearl_id="57" diff="easy" win_type="normal" type="progress" value=""/>
    <reward pearl_id="57" diff="easy" win_type="perfect" type="gold" value="100"/>
    <reward pearl_id="57" diff="med" win_type="normal" type="xp" value="75"/>
    <reward pearl_id="57" diff="med" win_type="perfect" type="gold" value="200"/>
    <reward pearl_id="57" diff="hard" win_type="normal" type="xp" value="150"/>
    <reward pearl_id="57" diff="hard" win_type="perfect" type="gold" value="500"/>  

    <plus_reward pearl_id="57" diff="easy" win_type="normal" type="progress" value=""/>
    <plus_reward pearl_id="57" diff="easy" win_type="perfect" type="xp" value="1100"/>
    <plus_reward pearl_id="57" diff="med" win_type="normal" type="xp" value="2000"/>
    <plus_reward pearl_id="57" diff="med" win_type="perfect" type="gold" value="10000"/>
    <plus_reward pearl_id="57" diff="hard" win_type="normal" type="xp" value="3000"/>
    <plus_reward pearl_id="57" diff="hard" win_type="perfect" type="xp" value="5000"/>  

data_game_progression.xml: (instead of being captured after pearl 1, they wander aimlessly, THEN get captured in lost_outro, so this just slides in between getting 50 scrap and being caught as looters)  

			<element name="1_2_outro_2" next="lost_intro">
				<requirements>								
					<requirement type="have_scrap" value="1" />
				</requirements>
				<actions>
					<action type="show_cutscene" value="useless_scrap"/>
					<action type="suppress_music_change"/>
				</actions>
			</element>  

			<element name="lost_intro" next="lost_outro">
				<requirements>
					<requirement type="start_pearl" value="1_2b_lost"/>
				</requirements>
				<actions>
					<action type="show_cutscene" value="lost_intro"/>
					<action type="suppress_music_change"/>
				</actions>
			</element>
			
			<element name="lost_outro" next="1_3_intro">
				<requirements>
					<requirement type="complete_pearl" value="1_2b_lost"/>
				</requirements>
				<actions>
					<action type="show_cutscene" value="lost_outro"/>					
					<action type="suppress_music_change"/>
				</actions>
			</element>  

data_fake_save.xml:  

in <progress> (between pearls 1_2 and 1_3)  

		<pearl id="1_2b_lost" diff="easy" status="perfect" />  

           (between cutscenes useless_scrap and coliseum_intro)
		<cutscene id="useless_scrap" watched="true"/>
		<cutscene id="lost_intro" watched="true"/>  

scripts.xml: (between talk_berserker and caught_by_ozimal, just placeholders)  

	<scene name="useless_scrap" title="Useless Scrap" background="caravan_empty" foreground_left="rock_left" music="loop_town" act="1" scene="2">
		
		<enter image="mcg_look_back_talk" side="left" instant="true" light="back_center,0.75,multiply"/>	
		<enter image="ber_bored" side="right" instant="true" light="back_edge,0.75,multiply"/>			
		<line character="$MCG" text="Useless Scrap" side="left"/>
	</scene>  

	<scene name="lost_intro" title="Lost 1" background="pit" foreground_left="rock_left" music="loop_town" act="1" scene="2">
		
		<enter image="mcg_look_back_talk" side="left" instant="true" light="back_center,0.75,multiply"/>	
		<enter image="ber_bored" side="right" instant="true" light="back_edge,0.75,multiply"/>			
		<line character="$MCG" text="Lost 1" side="left"/>
	</scene>				  

	<scene name="lost_outro" title="Lost 2" background="pit" foreground_left="rock_left" music="loop_town" act="1" scene="2">
		
		<enter image="mcg_look_back_talk" side="left" instant="true" light="back_center,0.75,multiply"/>	
		<enter image="ber_bored" side="right" instant="true" light="back_edge,0.75,multiply"/>			
		<line character="$MCG" text="Lost 2" side="left"/>
	</scene>
		<cutscene id="lost_outro" watched="true"/>

Hope that made sense. At first, after 1_2_outro played, but before receiving scrap, it crashed saying it failed to save. I added the text into fake_save, now it says the same thing in a different way:

AN ERROR HAS HAPPENED!  

Error #1125
context: Main.writesave(1)
message: error #1125  

stack trace:
null

I assume this is an issue in generating the pearl straight after the first outro from the previous map. Is there another place I need to add code? Have I stuffed up anywhere? I basically took existing code and adapted it to my needs for everything so far, and it’s all worked (except for what I believe is a known bug that cutscenes don’t use edited images in the mods folder) until I tried to add a new pearl. If I have to, I’ll just use existing pearls, but I was hoping to add bits and pieces where I felt it would be useful, and so I’m not just following the same exact storyline.

Also, obviously, I created the two map files, based off 1_2_the_shadow_world, the map works fine, I’ve tried substituting it in for 1_2.

Hey there! Can you post your mod somewhere so I can test it out? Just zip up the folder and link to it.

I sent it to you in a PM Larsius, it isn’t of a quality I’d like too many people to see right now :stuck_out_tongue:

EDIT: Thanks for offering to look at it :slight_smile:

Cool, thanks, I’ll see what’s up and confirm whether we’ve got a genuine bug on our hand or just some confusion over (undocumented) syntax.

Taking a cursory look at the error message, it’s an array-out-of-bounds error, which means that one of the many, many arrays associated with your overworld map has one less pearl than it should :slight_smile: I’ll step through the debugger and figure out which one we missed.

On second thought, we might have a bug here!

From the looks of it, the game is serving up an old array from the regular game that should have been cleared out when the mod was loaded. I figured there’d be a ton of little edge cases like these I have to sort out to get mod support totally robust. Thanks for helping me find this one!

Now your mod is able to get past the error message, and the new pearl shows up on the map. However, when I move to the battle and try to start it, it throws an error. This one also looks like my fault - it’s not set to look for mod data in some of the battle loading logic. Okay, fixing that…

Now I can start your mod’s new battle. After I beat it, the rest of the game looks like it works, too.

I just noticed that all the targeting icons are missing. I tested a fresh mod export of my own, and they’re missing there, too. One more thing to fix :slight_smile: Okay, that’s done - it was a minor timing issue due to how embedded graphics and loose mod files load differently.

Something I noticed:
You have an “error sheep” for one of the enemies on the extreme challenge in the new battle. Whenever the game can’t find an enemy entry in data_enemy or data_enemy_plus matching one listed in your wave data, it puts a pink “error sheep” in the preview to alert you. I think it’s the “strong attacker” which isn’t found.

I’m compiling a new version of the game right now and I’ll have it on the test server ASAP. I’ll let you know when it’s up.

Summary of things fixed:
-When loading a mod, old list of overworld pearls is now nulled out, previously this caused errors
-Fixed error where game was not looking for mod data in some battle loading logic, preventing new battle data from appearing
-Fixed error where target icons don’t appear in mod data.

Changes will be in version 1.0.55. Windows version hitting test server as soon as I can compile and upload it.

Awesome! Thanks Larsius!

I hadn’t tested the additional pearl, just used some data from another map, which probably doesn’t have an extreme mode but still has the extreme mode data if that makes any sense.

The new build is up on the test server and your mod seems to work now. If you don’t have tester access credentials, PM me and I’ll give you an invite so you can try out the new build.