Add own promotion?

Serp

King
Joined
Apr 1, 2015
Messages
661
Hi, some questions regarding adding a promotion:

1) what is the difference between: <InsertOrAbort> </InsertOrAbort> and just <Row></Row> ?

2) Is there a way to make a promotion choosable for all units? Or do I have to list every single UnitCombatType?

3) About PromotionPrereq:
Is it possible that every unit level 4 is able to choose a promotion? When I want the promotion choosable for all units at level 4, it would be a complicated, to make it via "PromotionPrereqOr1" ...

4) Where can I see all Portraitindex and the picture of it? This would help to choose a symbol.
 
I don't know why, but my promotion is not choosable.
I already copied the lines from the shock_1 promotion with my promotion name, to make sure nothing is wrong..

So at the moment this is my script (with lines from shock promtion, but with my name):
Code:
        <UnitPromotions> 
                <InsertOrAbort>
			<Type>PROMOTION_NUKE_IMMUNE</Type>
			<Description>TXT_KEY_PROMOTION_NUKE_IMMUNE</Description>
			<Help>TXT_KEY_PROMOTION_NUKE_IMMUNE_HELP</Help>
			<Sound>AS2D_IF_LEVELUP</Sound>
			<OrderPriority>1</OrderPriority>
			<OpenAttack>15</OpenAttack>
			<OpenDefense>15</OpenDefense>
			<PortraitIndex>44</PortraitIndex>
			<IconAtlas>PROMOTION_ATLAS</IconAtlas>
			<PediaType>PEDIA_MELEE</PediaType>
			<PediaEntry>TXT_KEY_PROMOTION_NUKE_IMMUNE</PediaEntry>
		</InsertOrAbort>
        
	</UnitPromotions> 

        </UnitPromotions_UnitCombatMods> 
                <InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_RECON</UnitCombatType>
		</InsertOrAbort>
		<InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
		</InsertOrAbort>
		<InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_GUN</UnitCombatType>
		</InsertOrAbort>
		<InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_ARCHER</UnitCombatType>
		</InsertOrAbort>
                <InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_MOUNTED</UnitCombatType>
		</InsertOrAbort>
		<InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_ARMOR</UnitCombatType>
		</InsertOrAbort>
		<InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_SIEGE</UnitCombatType>
		</InsertOrAbort>
		<InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_NAVALRANGED</UnitCombatType>
		</InsertOrAbort>
		<InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_NAVALMELEE</UnitCombatType>
		</InsertOrAbort>
		<InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_SUBMARINE</UnitCombatType>
		</InsertOrAbort>
		<InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_CARRIER</UnitCombatType>
		</InsertOrAbort>
		<InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_FIGHTER</UnitCombatType>
		</InsertOrAbort>
		<InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_BOMBER</UnitCombatType>
		</InsertOrAbort>
		<InsertOrAbort>
			<PromotionType>PROMOTION_NUKE_IMMUNE</PromotionType>
			<UnitCombatType>UNITCOMBAT_HELICOPTER</UnitCombatType>
		</InsertOrAbort>
	</UnitPromotions_UnitCombatMods>

So I think for every unit, there should be, for every level up, the possibility to choose this. I try it starting in modern age and leveling up a marksman (not sure if this is the english name, I mean the infantery unit from industiral age). But only Shock_1 and Drill_1 is choosable..
 
There is a fatal syntax error in your table-name usages.

<InsertOrAbort> works pretty much as does <Row> with the difference that if two or more mods are all adding the same Promotion to the <UnitPromotions> table (as an example), the second, third, etc., mod do not suffer from file-discard-failure. Basically, <InsertOrAbort> tells the game to insert a new row into the game-table if there is not already a matching row with the same <Type> designation. So it (<InsertOrAbort>) will only work correctly on Primary Tables (ie, game tables that have columns called "ID" and "Type").

Also, refer here to the requirements of the table UnitPromotions_UnitCombatMods:
Code:
	<Table name="UnitPromotions_UnitCombatMods">
		<Column name="PromotionType" type="text" reference="UnitPromotions(Type)"/>
		<Column name="UnitCombatType" type="text" reference="UnitCombatInfos(Type)"/>
		<Column name="Modifier" type="integer"/>
		<Column name="PediaType" type="text"/>
	</Table>
The table is for modifying combat strength of the unit to whom the Promotion Named (PromotionType)is given against units of the specified UnitCombatType, in the percentage amount of strength stated as Modifier.

To specify which UnitCombatType is entitled to a promotion, use table UnitPromotions_UnitCombats.

PS: It is not clear to me whether <InsertOrAbort> also works like a <Replace> command in the sense of replacing the previous information given within the table for a row with a matching <Type> designation.
 
Check the game's stock Unit Promotions XML file for help with valid columns (schema) and the proper syntax for the various promotion-related tables.

As well, "It doesn't work" is about as helpful as "What's wrong with my mod?"

We need logs and errors or the packaged mod, unless you want us to spend time guessing all day.
 
Check the game's stock Unit Promotions XML file for help with valid columns (schema) and the proper syntax for the various promotion-related tables.

As well, "It doesn't work" is about as helpful as "What's wrong with my mod?"

We need logs and errors or the packaged mod, unless you want us to spend time guessing all day.

Thanks for asking back :)
At the moment I have just copied the code you can see in first post into an exisiting mod xml file (which does work). There are no errors in lua log.

I will create an independet mod for this with modbuddy now and see if it works.
If not I will attach them here. Then it is easier for you to find possible errors.
 
Of course there won't be Lua errors -- you're having problems with an XML file. You need to look at the XML and Database log files. The reason it's better to simply attach the mod is because it can help us stop guessing and pinpoint the more trivial and silly errors like forgetting the set the XML file to update the database.
 
Of course there won't be Lua errors -- you're having problems with an XML file. You need to look at the XML and Database log files. The reason it's better to simply attach the mod is because it can help us stop guessing and pinpoint the more trivial and silly errors like forgetting the set the XML file to update the database.

thanks for your hints :)
I mostly write all of my changes in Notepad++, not in Modbuddy. (because it is easier, if you do not plan to make a new mod, just change a exisiting one)

But now I saw in Modbuddy is a window that points out syntax errors. That is very helpful, since there was really a syntax error in my code, which is not in the code from my first post =/ ( forgot the " / " symbol in a closing tag)

It does work now. So thanks! :) :)

What would be the best way, when I want every combat unit to be able to choose this at ~ level 4? (or minimum level 4)
Code:
          <UnitPromotions>
		<InsertOrAbort>
			<Type>PROMOTION_NUKE_IMMUNE</Type>
			<Description>TXT_KEY_PROMOTION_NUKE_IMMUNE_HELP</Description>
			<Help>TXT_KEY_PROMOTION_NUKE_IMMUNE</Help>
			<Sound>AS2D_IF_LEVELUP</Sound>
			<PortraitIndex>3</PortraitIndex>
			<IconAtlas>EXPANSION_PROMOTION_ATLAS</IconAtlas>
			<PediaType>PEDIA_ATTRIBUTES</PediaType>
			<PediaEntry>TXT_KEY_PROMOTION_NUKE_IMMUNE</PediaEntry>
			<NukeImmune>true</NukeImmune>
			<TechPrereq>TECH_SATELLITES</TechPrereq>
			<PromotionPrereqOr1>PROMOTION_SCOUTING_2</PromotionPrereqOr1>
			<PromotionPrereqOr2>PROMOTION_SURVIVALISM_2</PromotionPrereqOr2>
			<PromotionPrereqOr3>PROMOTION_SHOCK_3</PromotionPrereqOr3>
			<PromotionPrereqOr4>PROMOTION_DRILL_3</PromotionPrereqOr4>
			<PromotionPrereqOr5>PROMOTION_ACCURACY_3</PromotionPrereqOr5>
			<PromotionPrereqOr6>PROMOTION_BARRAGE_3</PromotionPrereqOr6> 
			<OrderPriority>7</OrderPriority>
		</InsertOrAbort>
	</UnitPromotions>
Is there a better way than "PromotionPrereqOr" ? The PromotionPrereqOr is limit to 9 I guess... so I don't know if it is possible to include all types of units..?

And how about:
4) Where can I see all Portraitindex and the picture of it? This would help to choose a symbol.
 
The promotion system for prereqs is not based on a unit's level, it is based entirely on whether a unit has the prerequisite promotion or one of the listed prerequisite promotions.

There's a limit to how many PromotionPrereqOrX the game will aceept for a single promotion, but I cannot remember whether this limit is adjustable from a GlobalDefine.

I haven't looked through all the DLC units yet, but the base game for BNW/G&K expansion level never used column NukeImmune within table <UnitPromotions>, so it is entirely possible Firaxis never hooked the column up to do anything, other than definiing it in the schema of the XML. A search of the three relevant Promotion XML files in BNW folder "Units" turned up only the definition of the column, not any use of it anywhere.

Assuming NukeImmune works there is no reason why there cannot be multiple promotions all with similar effects but one each for Land Units, Sea Units, Air Units as assigned by UnitCombatType within the table <UnitPromotions_UnitCombats>. Sure, it's a lot of clutter, and isn't as pretty as one Ring to Rule Them All promotion to handle all cases, but sometimes in order to get the job done you have to do what you have to do to get around the inherent Firaxis coding limitations (or you have to hope whoward has not abandoned CIV5 modding and is willing to do you a DLL solid, or has already written that functionality into his VMC mod).

It's a bit brute force, but I just look through the civilopedia to determine which Icon I like, and then compare against the definition of the promotion in the XML. Be aware, though, that the lua-file that controls the Unit Promotion Selection pop-up does not seem coded to accept promotions from some of the Icon Atlases Firaxis provided for promotions.
 
The promotion system for prereqs is not based on a unit's level, it is based entirely on whether a unit has the prerequisite promotion or one of the listed prerequisite promotions.

There's a limit to how many PromotionPrereqOrX the game will aceept for a single promotion, but I cannot remember whether this limit is adjustable from a GlobalDefine.

I haven't looked through all the DLC units yet, but the base game for BNW/G&K expansion level never used column NukeImmune within table <UnitPromotions>, so it is entirely possible Firaxis never hooked the column up to do anything, other than definiing it in the schema of the XML. A search of the three relevant Promotion XML files in BNW folder "Units" turned up only the definition of the column, not any use of it anywhere.

Assuming NukeImmune works there is no reason why there cannot be multiple promotions all with similar effects but one each for Land Units, Sea Units, Air Units as assigned by UnitCombatType within the table <UnitPromotions_UnitCombats>. Sure, it's a lot of clutter, and isn't as pretty as one Ring to Rule Them All promotion to handle all cases, but sometimes in order to get the job done you have to do what you have to do to get around the inherent Firaxis coding limitations (or you have to hope whoward has not abandoned CIV5 modding and is willing to do you a DLL solid, or has already written that functionality into his VMC mod).

It's a bit brute force, but I just look through the civilopedia to determine which Icon I like, and then compare against the definition of the promotion in the XML. Be aware, though, that the lua-file that controls the Unit Promotion Selection pop-up does not seem coded to accept promotions from some of the Icon Atlases Firaxis provided for promotions.

A BIG thanks for you answer! :)

I already testet Nuke Immunity and it does work ;) Units with that gets no damage from nukes. I wondered why there is no mod like this yet, since I hate nukes for killing any unit instant. With that promotion it's much better :) (but of course the promotions should be not that easy reachable min. level 4 or simular)

Your idea for a workaround is interesting and simple :) If my workaround does not work, I will do yours.
My workaround: Do a complete overhaul of promotion system. I want the promotions avaible at specific levels. I hate that I can not choose "Blitz" when my unit has Shock_2 and Drill_2.
So I will try the following:
Create a non chosable "Unlocker"- Promotion 1, 2 and 3 and design them to all promotions (so e.g Unlocker3 is required to get Blitz). In addition to that a lua file, which adds a function to the promotion event (I hope there is a event for promotions?). The function checks the level/xp of the unit, and if it is at aspecific level, the function gives the unit one of the unlocker promotions :)

That way I implement a promotion - level system :)

edit:
I found this mod: http://steamcommunity.com/sharedfiles/filedetails/?id=84863495
maybe it is already what I planned... I will test it.
 
Can anyone please download my mod and check, why the .lua file is not executed? :)
(even the print("Promotions - Level Promotions Active") command is not excecuted)

I already testet everything by putting the functions of the .lua in another lua from another mod. So everything works well :)
But I don't know why the .lua from my mod is not executed.. I think I did something wrong in modinfo ?

Edit:
deleted upload of mod. I will upload a working version soon :)
 
Your Lua file is not set as an entry point for your mod (it's not defined as an InGameUIAddin from ModBuddy) so the game never knows to run it.
 
Your Lua file is not set as an entry point for your mod (it's not defined as an InGameUIAddin from ModBuddy) so the game never knows to run it.

Ah, that's what the EntryPoint thing is good for :) (unfortunaltey it is not explained in Kaels Modder Guide)

Okay, I will do some little improvements to the mod and then I will upload it :)
 
Top Bottom