Changing XML on the fly

Freeform discussion about anything related to modding Transcendence.
Post Reply
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

Mon Feb 29, 2016 10:50 pm

Is there a way to change XML code on the fly?

For example, if I wanted to use tlisp to decide which missiles a launcher could fire depending on whether the missile's entity declaration exists, could I do that?

In other words, I want to be able to add <Missile> elements that are generated using tlisp.

This would also be useful for making custom enhancers - for example, a weapon enhancer that has a damage bonus only when some other condition is true, such as having no shield installed.

Here's the code for the NAMI missile launcher if we need a place to start. Thanks if anyone can help!

Code: Select all

	<ItemType UNID="&itNAMIMissileLauncher;"
			name=				"NAMI missile launcher"
			attributes=			"commonwealth, majorItem, NAMI"
			level=				"3"
			frequency=			"common"

			value=				"1500"
			mass=				"1000"
			description=		"This launcher is compatible with a full range of popular missiles including the KM100 Longbows and the XM900 Lucifers."

		<Image imageID="&rsItemsNAMI2;" imageX="0" imageY="0" imageWidth="96" imageHeight="96"/>

				fireRate=			"30"
				powerUse=			"5"
				launcher=			"true"

				<Missile ammoID="&itFragmentationMissile;"/>
				<Missile ammoID="&itKM100Missile;"/>
				<Missile ammoID="&itKM120Missile;"/>
				<Missile ammoID="&itKM500Missile;"/>
				<Missile ammoID="&itKM550Missile;"/>
				<Missile ammoID="&itXM300Missile;"/>
				<Missile ammoID="&itXM900Missile;"/>

User avatar
Militia Captain
Militia Captain
Posts: 985
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

Mon Feb 29, 2016 11:45 pm

 There are some XML-related functions in the function list (with the prefix of “xml” even), but they aren’t particularly well documented beyond that list and aren’t used anywhere in vanilla, CC, or EP. I remember briefly experimenting with them when they were first introduced, but never really made a whole lot of progress on them. You may have to just experiment and see what works and what doesn’t.

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)

Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

Tue Mar 01, 2016 2:02 pm

Thanks! I'll see if I can figure it out.

On modifying powerUse and other stats that are normally static:

I found a <GetArmorRegen> event in Corporate Command (itnanoRepairer) that isn't documented anywhere I've looked. It seems to set armor regen and powerUse on the fly. Is there a record of this somewhere so I can see what other similar events or functions may have been added?

Code: Select all

					;	Novaya armor specifies regeneration and power use
					(itmHasAttribute aArmorType 'novayaArmor)
							regen: (itmGetStaticData aArmorType 'novayaRegen)
							powerUse: (itmGetStaticData aArmorType 'novayaPowerUse)
					;	Otherwise, for armor level 10 or lower, we regenerate 
					;	based on the armor level.
					(leq (itmGetLevel aArmorType) 10)
							regen:		(@ '(0   2 3 4 6  8    10 12 14 16  18) (itmGetLevel aArmorType))
							powerUse:	(@ '(0   3 5 8 10 20   40 60 90 120 150) (itmGetLevel aArmorType))
					;	Otherwise we cannot regenerate
						regen: 0
						powerUse: 0

Post Reply