[Mod Help] Adding events to the game start

Discuss and distribute tools and methods for modding. Moderator - Grognak
HaakonXCI
Posts: 4
Joined: Fri Dec 28, 2012 7:44 am

[Mod Help] Adding events to the game start

Post by HaakonXCI »

Hi, I'd like to add an event that gives some fuel and also some scrap at the beginning of a game. How would I go about this? Which file do I need to edit after unpacking?

Thanks.
User avatar
Kieve
Posts: 944
Joined: Tue Sep 18, 2012 2:21 pm

Re: [Mod Help] Adding events to the game start

Post by Kieve »

This code is from the "Beginning Scrap Advantage" mod that Grognak included with GMM by default:

Code: Select all

<event name="START_BEACON">
	<text>Welcome to a new sector! Get to the exit beacon and jump to the next sector before the pursuing Rebels catch you!</text>
	<choice hidden="true">
		<text>Continue...</text>
		<event/>
	</choice>
	<choice req="engines" lvl="1" hidden="true">
		<text>(Mod) Strip a near-by asteroid for scrap.</text>
		<event>
			<text>You take a shuttle and grab as much metal as you can.</text>
			<autoReward level="HIGH">scrap_only</autoReward>
		</event>
	</choice>
</event>
The event you want to modify is "START_BEACON" in the events.xml file.
Before you modify anything there, READ THIS. Event-code is incredibly sensitive and will result in runtime errors in crashes if you have anything wrong, so it's critical that you understand the syntax, close all your tags, dot all your i's and cross all your t's, etc etc...
'Course there are people on this forum really awesome at debugging event code, so if you do run into trouble you can always just post the changes here. :)
HaakonXCI
Posts: 4
Joined: Fri Dec 28, 2012 7:44 am

Re: [Mod Help] Adding events to the game start

Post by HaakonXCI »

Thank you for your response. I modified the mod and just put this:

Code: Select all

<!-- Scrap Advantage mod modified for fuel -->

<event name="START_GAME">
	<text>The data you carry is vital to the remaining Federation fleet. You'll need supplies for the journey, so make sure to explore each sector before moving on to the next. But get to the exit before the pursuing Rebel fleet can catch up!</text>
</event>

<event name="START_BEACON">
	<text>Welcome to a new sector! Get to the exit beacon and jump to the next sector before the pursuing Rebels catch you!</text>
	<choice hidden="true">
		<text>Continue...</text>
		<event/>
	</choice>
	<choice req="engines" lvl="1" hidden="true">
		<text>(Mod) Experimental fuel.</text>
		<event>
			<item_modify>
				<item type="fuel" min="45" max="50"/>
			</item_modify>
		</event>
	</choice>
</event>
Now the problem arises after I pick my ship and click on Start. The game just crashes as you said it probably would.
thashepherd
Posts: 194
Joined: Fri Nov 16, 2012 11:45 pm

Re: [Mod Help] Adding events to the game start

Post by thashepherd »

You probably need a <text>foo</text> or at least a <text /> above your <item_modify>.

If that doesn't work, well, you're adding a LOT of fuel (and there might be some kind of upper limit we don't know about). I doubt it, though.
You are the weak, and I am the tyranny of evil men - but I'm trying, I'm trying real hard to be the shepherd.

"Wow, that Kieve guy is one angsty nerd eh."
Sonata - "Best use of Common Lisp in an indie space roguelike!"
HaakonXCI
Posts: 4
Joined: Fri Dec 28, 2012 7:44 am

Re: [Mod Help] Adding events to the game start

Post by HaakonXCI »

Okay, I changed the amount of fuel and added text but the same issue occurs. here is the change:

Code: Select all

<event name="START_BEACON">
	<text>Welcome to a new sector! Get to the exit beacon and jump to the next sector before the pursuing Rebels catch you!</text>
	<choice hidden="true">
		<text>Continue...</text>
		<event/>
	</choice>
	<choice req="engines" lvl="1" hidden="true">
		<text>(Mod) Experimental fuel.</text>
		<event>
			<text>Adding fuel...</text>
			<item_modify>
				<item type="fuel" min="2" max="2"/>
			</item_modify>
		</event>
	</choice>
</event>
thashepherd
Posts: 194
Joined: Fri Nov 16, 2012 11:45 pm

Re: [Mod Help] Adding events to the game start

Post by thashepherd »

The next step may be to look at sector_data.xml. Start beacons are odd; you can't, for example, change what happens in the first sector - it's always START_GAME no matter what you do, and you can't add subordinate events or choices. The game is even *more* anal about sector start events than normal, so you should test your event as a normal custom event first.

If I were you, I would edit the sectorDescription for the first sector (STANDARD_SPACE), commenting out all of the normal events and adding a call to your custom one. Don't even call it START_BEACON; call it test_event or something. Make sure it works outside the context of a sector start.

When you're testing in this way, don't worry if random events pop up even though you commented everything out. The game will pick a random event (from the NEUTRAL list in newEvents IIRC, but could be wrong) if you haven't provided enough choices for every beacon in the sector.

Get your event working so that you can jump to a beacon and see it, then change the name and try it as START_BEACON. Just keep in mind that it will never work in the first sector.
You are the weak, and I am the tyranny of evil men - but I'm trying, I'm trying real hard to be the shepherd.

"Wow, that Kieve guy is one angsty nerd eh."
Sonata - "Best use of Common Lisp in an indie space roguelike!"
User avatar
Kieve
Posts: 944
Joined: Tue Sep 18, 2012 2:21 pm

Re: [Mod Help] Adding events to the game start

Post by Kieve »

I copied the code into my game's event.xml and it worked perfectly (and btw, you can add 99 fuel if you want without trouble, the game's upper limit is probably around 999 or more before it'll start breaking things.)

Whatever your issue is, it's coming from something else you've probably modified by mistake. Could you post your events.xml as an attachment and we'll have a look at it?
thashepherd
Posts: 194
Joined: Fri Nov 16, 2012 11:45 pm

Re: [Mod Help] Adding events to the game start

Post by thashepherd »

Kieve wrote:I copied the code into my game's event.xml and it worked perfectly (and btw, you can add 99 fuel if you want without trouble, the game's upper limit is probably around 999 or more before it'll start breaking things.)

Whatever your issue is, it's coming from something else you've probably modified by mistake. Could you post your events.xml as an attachment and we'll have a look at it?
Sure, you can do THAT - but you know what they say.

Build a man a fire, and he's warm for the evening. Light a man ON fire, and he's warm for the rest of his life...
You are the weak, and I am the tyranny of evil men - but I'm trying, I'm trying real hard to be the shepherd.

"Wow, that Kieve guy is one angsty nerd eh."
Sonata - "Best use of Common Lisp in an indie space roguelike!"
User avatar
Kieve
Posts: 944
Joined: Tue Sep 18, 2012 2:21 pm

Re: [Mod Help] Adding events to the game start

Post by Kieve »

I don't think lighting him on fire will help much at this point. Image
Anyway, just saying that the issue isn't with the start_beacon code, but something else that's gotten tweaked in the process.

HaakonXCI, just to make sure we're on the same page, you're:
-Extracting the files (or have them extracted) via FTLDat or GMM
->You have the directory FTL\resources\data.dat-unpacked\data\(xml/txt files here)
-Making changes to extracted events.xml file
-Repacking with FTLDat
-OR applying changes with GMM via your own test-mod (in which case your file should be events.xml.append)

If any of that's not correct, let us at least know the process and it'll be easier to pick out where you're getting it wrong.
HaakonXCI
Posts: 4
Joined: Fri Dec 28, 2012 7:44 am

Re: [Mod Help] Adding events to the game start

Post by HaakonXCI »

I thank you all for your fast responses and detailed information. I fixed it by using the GUI pack/unpack tool and unpacking then editing then repacking after copying back the original data.dat.

So apparently I did have a broken events.xml file after all since the only thing in it was just the modded data, haha. I'm just happy that I can finally not have to worry about fuel in the game and I learned a bit today.

One last thing. I noticed that there was an xml.append file after unzipping the sample mod. Was this made with a separate tool or again by just renaming and having GMM do the work?

Thanks.
Post Reply