New modder struggling with textList, please fix my code.

Discuss and distribute tools and methods for modding. Moderator - Grognak
Post Reply
Arctanas
Posts: 23
Joined: Sun Mar 02, 2014 3:06 am

New modder struggling with textList, please fix my code.

Post by Arctanas »

Hey guys, I have recently started writing new events and having loads of fun doing it, despite running into many problems. I've got three questions about textLists if anyone could help me please. The code/text are just examples so I can learn how to do it, nothing serious. :)

First question:
Should this work? Is my code right?

Code: Select all

<eventList name="NEW">
	<event load="FREE_STUFF"/>
</eventList>

<event name="FREE_STUFF">
	<text load="FREE_STUFF_TEXTLIST"/>
	<autoReward level="MED">stuff</autoReward>
</event>
<textList name="FREE_STUFF_TEXTLIST">
	<text>You find a box floating in space and bring it on board.</text>
	<text>You find the remains of a ship, looks like it has been blown apart by weapons fire. Your team searches through the debris.</text>
	<text>You find an abandoned ship, your team boards and searches it for salvage.</text>
</textList>
Thing is, when I run into the event ingame it says
"FREE_STUFF_TEXTLIST"
Continue...

I don't understand. I copy and pasted the Drone text list from the original text and just changed the wording, but whenever I do it, it doesn't work for me.


My second question is:
Say you have 4 events (all other events are turned off, for example) and 3 of them are single events with no textList (unique="false" though), and 1 event has a textList with like 20 text variations will it still just register as 1 event and show 25% of the time, 1/4 of the time? Or will the 1 with the textList show like 90% of the time since there's all the variations? There's no real point in putting many variations in a textList unless you just want many variations on that one event, right?

My third question:
Can I use textList at the start of an event to keep things interesting? For example:

Code: Select all

<eventList name="NEW">
	<event load="WEAPON_GIVEAWAY"/>
</eventList>

<event name="WEAPON_GIVEAWAY">
	<text load="WEAPON_GIVEAWAY_TEXTLIST"/>
	<choice hidden="true">
		<text>"Sounds great, thanks!"</text>
		<event load="WEAPON_RECEIVE">
	</event>
	</choice>
	<choice>
		<text>"There's always a catch, so no thanks."</text>
		<event/>
	</choice>
</event>			
	
<event name="WEAPON_RECEIVE">
	<text>"Here you go! Enjoy and safe travels."</text>
	<weapon name="RANDOM"/>
</event>

<textList name="WEAPON_GIVEAWAY_TEXTLIST">
	<text>"Would you like a free weapon?"</text>
	<text>"We're giving away free weapons, want one?"</text>
	<text>"Today is your lucky day! Here's a free weapon for you!"</text>
	<text>"We're having a give away today and you're first in line for a free weapon!"</text>
</textList>
Would this work? Or not? Also I'm new so please tell me if there are any errors in my code.

Thanks in advance for any help you guys can give to me as a new modder. :D
User avatar
RAD-82
Posts: 795
Joined: Sat Nov 09, 2013 12:16 am

Re: New modder struggling with textList, please fix my code.

Post by RAD-82 »

First question:
I don't know if this is the problem, but it is the only suggestion I can make. Most of the textLists that I see in the normal game either have the same name as the event, or the same name plus _TEXT. Try removing _TEXTLIST or LIST from the end of the name.

Second question:
I don't see why a textList would have any effect on how often an event is called. My guess for your example would be 25%.

Third question:
Assuming you fix the issue with the first question, I don't see why you can't do that.

However, in your example, I see <event load="WEAPON_RECEIVE"></event> instead of <event load="WEAPON_RECEIVE"/>. I assume it makes no difference, but it just seems weird to me. Also, there is no point in loading a new event unless it is an eventList with multiple outcomes or you plan on reusing it with other events.
Image
Junkyard has FTL mods, mostly ships and a few other things.
Arctanas
Posts: 23
Joined: Sun Mar 02, 2014 3:06 am

Re: New modder struggling with textList, please fix my code.

Post by Arctanas »

Hey thanks for the fast reply and help.
I don't know if this is the problem, but it is the only suggestion I can make. Most of the textLists that I see in the normal game either have the same name as the event, or the same name plus _TEXT. Try removing _TEXTLIST or LIST from the end of the name.
I tried removing the _TEXTLIST / _LIST and didn't make a difference for me, it just shows the textLists name ingame, then the reward.

Here's a copy and pasted official code:

Code: Select all

<event name="FIND_DRONE">
	<text load="FIND_DRONE"/>
	<autoReward level="LOW">drone</autoReward>
</event>
<textList name="FIND_DRONE">
	<text>When you ask a nearby station for aid, a friendly programmer gives you the schematics for a drone!</text>
	<text>An abandoned space station circles a lonely planet. A quick check yields schematics for a drone. You bring it aboard the ship.</text>
	<text>Federation sympathizers contact you as you arrive. "We know your mission should be secret, so don't ask how we know about it. Take this schematic, it's all we can do to help."</text>
	<text>A small Engi research vessel is trying to fend off a Mantis ship. You move in to engage but after a quick scan of your ship the Mantis ship retreats. The Engi offer you a drone schematic as thanks for your timely arrival.</text>
	<text>You find an abandoned mining station on a nearby moon. A quick scan shows no life forms however you discover a usable drone schematic!</text>
</textList>
I tried to just edit just the text and added the load event.

Code: Select all

<eventList name="NEW">
 	<event load="FREE_STUFF/">
</eventList>
   
<event name="FREE_STUFF">
	<text load="FREE_STUFF"/>
	<autoReward level="LOW">drone</autoReward>
</event>
<textList name="FREE_STUFF">
	<text>1</text>
	<text>2</text>
	<text>3</text>
	<text>4</text>
	<text>5</text>
</textList>
When I got ingame and found the event, it just said "FREE_STUFF", not any number. Sigh.
I don't see why a textList would have any effect on how often an event is called. My guess for your example would be 25%.
Assuming you fix the issue with the first question, I don't see why you can't do that.
Awesome, thanks.
in your example, I see <event load="WEAPON_RECEIVE"></event> instead of <event load="WEAPON_RECEIVE"/>. I assume it makes no difference, but it just seems weird to me. Also, there is no point in loading a new event unless it is an eventList with multiple outcomes or you plan on reusing it with other events.
Haha yeah, I'm still really new to this all, I should have put <event load="WEAPON_RECEIVE"/> instead of <event load="WEAPON_RECEIVE"></event>, thanks for that. :)

Thanks again for your help, the textList is just kinda annoying me now haha.
User avatar
Sleeper Service
Posts: 2275
Joined: Sun Mar 24, 2013 8:49 pm

Re: New modder struggling with textList, please fix my code.

Post by Sleeper Service »

The textlist should actually work like this. Maybe give it completely different name again and copy-past it into the tag where it is called to make sure it is the same ID. The problem your described happens when the game can not find the test list that is called, usually meaning that it does not exits or that its ID is spelled wrong somewhere.

I generally can recommend to have a big text-dump file that contains all the vanilla xmls open on the side all times. You can draw a lot of examples from there; and copy pasting original lists and events and texts and then modifying them with your content is often safer and faster than writing stuff from scratch.
Image
Working on a sci-fi deckbuilder nowadays.
Other games I made.
English Narwhal
Posts: 402
Joined: Tue Dec 03, 2013 9:12 pm

Re: New modder struggling with textList, please fix my code.

Post by English Narwhal »

Code: Select all


<event name="FREE_STUFF">
   <text load="FREE_STUFF"/>
   <autoReward level="LOW">drone</autoReward>
</event>
<textList name="FREE_STUFF">
   <text>1</text>
   <text>2</text>
   <text>3</text>
   <text>4</text>
   <text>5</text>
</textList>
What could be wrong with this at a glance is that FREE_STUFF is already used.
In addition, I think that those phrases of text are too short for it to actually acknowledge the text.
If you're getting "FREE_STUFF" from loading the event, then the event itself is having trouble loading. If I could have more information on how you're loading the event, ect. I could be of more help.
Image
Arctanas
Posts: 23
Joined: Sun Mar 02, 2014 3:06 am

Re: New modder struggling with textList, please fix my code.

Post by Arctanas »

Thanks guys, for the advice but it seems like no matter what I do, I just can't seem to get textLists to work.. I guess I'll just have to live without them. Also, I'm having problems while copy / pasting, and writing sections of my new event, would you be able to point out my error for me please?

Code: Select all

<event name="DAMAGED_SHIP">
	<ship load="CIVILIAN_SHIP" hostile="false"/>
	<text>As you jump into the system you see a very unlucky ship, its engines appear to be damaged and its just sitting there immobilized. "Hi there! My engines are damaged and I haven't got the parts to fix it, have you got any to spare?"</text>
	<choice hidden="true">
		<text>You send over the spare parts he needs.</text>
		<event load="DAMAGED_SHIP_PARTS">
		<item type="scrap" min="-15" max="-5"/>	
	</event>
	</choice>
	<choice hidden="true">	 
		<text>You tell him you don't have the parts he needs, but he's welcome to come on board.</text>
		<event load="DAMAGED_SHIP_INVITE">	
	</event>
	</choice>
	<choice hidden="true">
		<text>[Pirate] You chose to destroy the ship, and loot what you can from its remains.</text>
		<event load="DAMAGED_SHIP_PIRATE">
	</event>
	</choice>
</event>

<eventList name="DAMAGED_SHIP_PARTS">
	<event>
		<text>"You're a life safer! I would have died out here, you have my thanks. I haven't got much to give, but here's what I spare."</text>
		<autoReward level="MED">stuff</autoReward>
	</event>
	<event>
		<text>"Boy am I glad you came along, thanks for the parts. Take this in return for your help."</text>
		<autoReward level="HIGH">scrap_only</autoReward>
	</event>
	<event>
		<text>Out of nowhere the ships engines and weapon systems come online and power up. In seconds the ship is within range and opens fire on you. Must have been a trap, waiting for you to lower your guard.</text>
		<ship load="CIVILIAN_SHIP" hostile="true"/> 
	</event>
</eventList>	
<eventList name="DAMAGED_SHIP_INVITE">
	<event>
		<text>"That's unfortunate! Oh well, I'll bring whatever I can on board, and thank you."</text>
		<autoReward level="LOW">scrap_only</autoReward>
		<crewMember amount="1"/>
	</event>
	<event>
		<text>"I guess I have no choice, please drop me off at the nearest planet or station."</text>
		<autoReward level="LOW">scrap_only</autoReward>
	</event>
</eventList>
<eventList name="DAMAGED_SHIP_PIRATE">
	<event>
		<autoReward level="MED">stuff</autoReward>
		<augment name="RANDOM"/>
	</event>
	<event>
		<text>The ship remains didn't contain anything of real value.</text>
		<autoReward level="LOW">fuel</autoReward>
	</event>
</eventList>
I don't know, I try and edit/write code for hours but I swear I spend most of my time error checking them, I'm starting to get frustrated with myself haha, I wish it would just work. I guess modding is never easy, but that's why it's so damn satisfying when you make something that works. :)

Thanks guys for being patient with me, I appreciate all of your help! :D
theDoomBox

Re: New modder struggling with textList, please fix my code.

Post by theDoomBox »

I think there's a application that can Automatically check errors for you. Might not work for event making though, I'm sure.
User avatar
TaxiService
Posts: 204
Joined: Mon Dec 23, 2013 6:04 pm

Re: New modder struggling with textList, please fix my code.

Post by TaxiService »

I rewrote the thing from scratch.

Code: Select all

<ship name="ARC_CIVILIAN_SHIP" auto_blueprint="SHIPS_CIVILIAN">
	<destroyed load="ARC_DAMAGED_SHIP_DESTROYED"/>
	<deadCrew load="ARC_DAMAGED_SHIP_DEADCREW"/>
</ship>

<event name="ARC_DAMAGED_SHIP">
	<text>As you jump into the system you see a very unlucky ship. They hail you: "Hi there! My engines are damaged and I haven't got the parts to fix it, have you got any to spare?"</text>
	<ship load="ARC_CIVILIAN_SHIP" hostile="false"/>
	<choice>
		<text>Send over the spare parts they need.</text>
		<event>
			<text>You send them some scrap.</text>
			<item_modify>
				<item type="scrap" min="-15" max="-30"/>
			</item_modify>
			<choice hidden="true">
				<text>Continue...</text>
				<event load="ARC_DAMAGED_SHIP_PARTS"/>
			</choice>
		</event>
	</choice>
	<choice hidden="true">
		<text>Tell them you don't have enough resources to spare, but offer them to come aboard.</text>
		<event load="ARC_DAMAGED_SHIP_INVITE"/>
	</choice>
	<choice>
		<text>[Pirate] Attack the ship.</text>
		<event>
			<text>You choose to plunder the unfortunate soul before anyone else does.</text>
			<ship hostile="true"/>
		</event>
	</choice>
</event>

<eventList name="ARC_DAMAGED_SHIP_PARTS">
	<event>
		<text>"You're a life safer! I would have died out here, you have my thanks. I haven't got much to give, but here's what I spare."</text>
		<item_modify>
			<item type="drones" min="0" max="1"/>
			<item type="missiles" min="0" max="2"/>
			<item type="fuel" min="1" max="3"/>
		</item_modify>
	</event>
	<event>
		<text>"Boy, am i glad you came along! Thanks for the parts. Take this in return for your help."</text>
		<item_modify>
			<item type="drones" min="1" max="3"/>
			<item type="missiles" min="1" max="4"/>
			<item type="fuel" min="1" max="5"/>
		</item_modify>
	</event>
	<event>
		<text>Out of nowhere the ships engines and weapon systems come online and power up. In seconds the ship is within range and opens fire on you. Must have been a trap, waiting for you to lower your guard.</text>
		<ship hostile="true"/>
	</event>
</eventList>

<eventList name="ARC_DAMAGED_SHIP_INVITE">
	<event>
		<text>"That's unfortunate! Oh well, I'll bring whatever I can on board, and thank you."</text>
		<autoReward level="LOW">scrap_only</autoReward>
		<crewMember amount="1"/>
	</event>
	<event>
		<text>"I guess I have no choice, please drop me off at the nearest planet or station."</text>
		<autoReward level="LOW">scrap_only</autoReward>
	</event>
</eventList>

<eventList name="ARC_DAMAGED_SHIP_DESTROYED">
	<event>
		<text>You are able to pull out a lot of useful items from the wreckage.</text>
		<autoReward level="MED">stuff</autoReward>
		<augment name="RANDOM"/>
	</event>
	<event>
		<text>Unfortunately, the wreckage didn't contain anything of real value.</text>
		<autoReward level="LOW">fuel_only</autoReward>
	</event>
</eventList>

<eventList name="ARC_DAMAGED_SHIP_DEADCREW">
	<event>
		<text>No more life signs detected. You salvage everything you can from the ship remains.</text>
		<autoReward level="HIGH">stuff</autoReward>
		<augment name="RANDOM"/>
	</event>
	<event>	
		<text>The ship remains didn't contain anything of real value. At least you're able to empty their fuel reserve in peace.</text>
		<autoReward level="MED">fuel_only</autoReward>
	</event>
</eventList>
This should work. I'm going to edit this post later explaining what i did and why. Gotta run now.



EDIT: So, what did I do?

I added the prefix "ARC_" to each one of your event names, so to avoid unwanted conflicts with possibly existing events. This isn't necessary, but i consider it good measure.

As Sleeper pointed out, nothing should go after the <event load=...> tag, since nothing would be executed after it. In my code i added a step for the event that removes the scrap from your wallet and then calls the ARC_DAMAGED_SHIP_PARTS event.

DAMAGED_SHIP_PARTS was pretty good. The only thing that wouldn't work was the <ship load=...> statement. Since a ship has already been loaded, just a <ship hostile="true"/> would suffice.
(Also i took the liberty of trying to give the user some resources that don't include scrap, since we just gave some to them. It was weird)

When you load an event you should do so on a single line.

Code: Select all

like this:
<event load="EVENT_NAME"/>

I am not sure if this works, but it's better to use the first method anyway:
<event load="EVENT_NAME>
</event>
The DAMAGED_SHIP_INVITE eventList was pretty much perfect.

The third option just wouldn't work. There is nothing to turn the ship hostile, but even if there was, the <autoReward> and <augment> tags wouldn't show. This is because when the ship is destroyed or its crew is killed, the game calls some events defined in events_ships.xml. Lookie here:

Code: Select all

<ship name="CIVILIAN_SHIP" auto_blueprint="SHIPS_CIVILIAN">
	<destroyed load="DESTROYED_DEFAULT"/>
	<deadCrew load="DEAD_CREW_DEFAULT"/>
</ship>
This is because you loaded a CIVILIAN_SHIP earlier in the main event. To load some custom events after the ship is destroyed, i defined a new ship group at the beginning of the file.

Code: Select all

<ship name="ARC_CIVILIAN_SHIP" auto_blueprint="SHIPS_CIVILIAN">
	<destroyed load="ARC_DAMAGED_SHIP_DESTROYED"/>
	<deadCrew load="ARC_DAMAGED_SHIP_DEADCREW"/>
</ship>
This one calls for some custom events when it's destroyed or its crew is killed. So i then defined two eventLists for each case and that's it!
Last edited by TaxiService on Wed Mar 05, 2014 5:09 pm, edited 2 times in total.
ImageImageImageImageImage
User avatar
Sleeper Service
Posts: 2275
Joined: Sun Mar 24, 2013 8:49 pm

Re: New modder struggling with textList, please fix my code.

Post by Sleeper Service »

I put in some comments:

Code: Select all

<event name="DAMAGED_SHIP">
	<ship load="CIVILIAN_SHIP" hostile="false"/>
	<text>As you jump into the system you see a very unlucky ship, its engines appear to be damaged and its just sitting there immobilized. "Hi there! My engines are damaged and I haven't got the parts to fix it, have you got any to spare?"</text>
	<choice hidden="true">
		<text>You send over the spare parts he needs.</text>
		<event load="DAMAGED_SHIP_PARTS">

		<!-- Nothing can happene after <event load=...>, cause the event jumps over to the next list here, so this part is pointless or probably causes broblems:
 
		<item type="scrap" min="-15" max="-5"/> 
  
This tag is only used if you want to end an event with a choice, check how its used in the actual game code and only ever use it like that; its really just necessary if you want an event to end immediately after clicking a choice
		</event> -->
	</choice>
	<choice hidden="true">   
		<text>You tell him you don't have the parts he needs, but he's welcome to come on board.</text>
		<event load="DAMAGED_SHIP_INVITE">  
		<!-- Again, this is unnecessary and might just cause problems
		</event> -->
	</choice>
	<choice hidden="true">
		<text>[Pirate] You chose to destroy the ship, and loot what you can from its remains.</text>
		<event load="DAMAGED_SHIP_PIRATE">
		<!-- Again, same here
		</event> -->
	</choice>
</event>

<eventList name="DAMAGED_SHIP_PARTS"> 		<!-- This whole list should work I think -->
	<event>
		<text>"You're a life safer! I would have died out here, you have my thanks. I haven't got much to give, but here's what I spare."</text>
		<autoReward level="MED">stuff</autoReward>
	</event>
	<event>
		<text>"Boy am I glad you came along, thanks for the parts. Take this in return for your help."</text>
		<autoReward level="HIGH">scrap_only</autoReward>
	</event>
	<event>
		<text>Out of nowhere the ships engines and weapon systems come online and power up. In seconds the ship is within range and opens fire on you. Must have been a trap, waiting for you to lower your guard.</text>
		<!-- <ship load="CIVILIAN_SHIP" hostile="true"/>
		You cant load a nother ship if you have already loaded one at the begining of the event. Should instead simply say: -->
		<ship hostile="true"/>
	</event>
</eventList>   
<eventList name="DAMAGED_SHIP_INVITE">
	<event>
		<text>"That's unfortunate! Oh well, I'll bring whatever I can on board, and thank you."</text>
		<autoReward level="LOW">scrap_only</autoReward>
		<crewMember amount="1"/>
	</event>
	<event>
		<text>"I guess I have no choice, please drop me off at the nearest planet or station."</text>
		<autoReward level="LOW">scrap_only</autoReward>
	</event>
</eventList>
<eventList name="DAMAGED_SHIP_PIRATE">
	<event>
		<!-- This might work, but it feels generally safer to my to have a text for you event. I think events in -->
		<autoReward level="MED">stuff</autoReward>
		<augment name="RANDOM"/>
	</event>
	<event>
		<text>The ship remains didn't contain anything of real value.</text>
		<autoReward level="LOW">fuel</autoReward>
	</event>
</eventList>
Image
Working on a sci-fi deckbuilder nowadays.
Other games I made.
Arctanas
Posts: 23
Joined: Sun Mar 02, 2014 3:06 am

Re: New modder struggling with textList, please fix my code.

Post by Arctanas »

Thanks guys! I really appreciate all the effort you put in to help me, thank you so much. :)
Post Reply