[HELP] How to implement skill based bonuses

A challange for a super-coder... or a dev :P

https://forums.elementalgame.com/389736

Alright, I'm trying to implement skills into the values of bonuses from things like "Merchant Master" or "Farmer" in my "Abilities and Histories Modification" (check it out!) but cannot figure out how to properly implement the code.

Here is what the code looks like right now for a merchant's passive income (intended to test the code):

            <GameModifier>
                <ModType>Unit</ModType>
                <Attribute>ProduceResource</Attribute>
                <StrVal>Gold</StrVal>
                <Calculate InternalName = "Value" ValueOwner="Unit"> <!-- I've tried "castingunit" as well, no effect -->
                    <Expression><![CDATA[[UnitStat_Intelligence]+[UnitStat_Charisma]]]></Expression>
                </Calculate>
            </GameModifier>

Basically it should add the intelligence and charisma and return me that much gold per turn. So, if my merchant's intelligence and charisma are both 10 then he should make 20 gold per turn. However, its not returning anything.

My theory is that there is a problem with either the "Value", "ValueOwner", or within the expression itself (maybe it's with CDATA, for example). Maybe I need to put a "<Value> = value" line of code or something but that seems redundant (gonna try it anyways).

This could REALLY open up some possibilities into making the attributes (especially intelligence and charisma) more important for certain professions. Merchants could make more money as they get smarter, Generals could gain higher morale rewards as they get more charismatic, Researchers could output more research as they get more intelligent, and Bards could gain higher prestige as they get more charismatic.

Eventually the code will look like this for the merchant, FYI:

.2 gold + (1/100) wisdom + (1/25) charisma + (1/30) intelligence

Also, for another challenge, how do I add passive experience per turn to champions?

I appreciate any help. Thanks ahead of time!

3,874 views 3 replies
Reply #1 Top

Ok, so i just did some testing and here is what ive found out. By creating a new xml file "Gold.xml" and copy/pasting the "NPC_GoldProduction1" ability from "SoverignTalents.xml", it seems that unless you erase the ability from the core files it just adds on. IE first thing i did was just change it from 1$ to 10$, actual gain was 11/turn(1 from core, and 10 from mod). After that i tried messing around with the calculation system and even tried no ValueOwner, since spells were able to use that as a valid state. So far no luck in having it be stat based. Still looking tho

Reply #2 Top

James, I am going to start looking at this as well.   I'll let you know what I find.

Reply #3 Top

Quoting Gnrl, reply 1
Ok, so i just did some testing and here is what ive found out. By creating a new xml file "Gold.xml" and copy/pasting the "NPC_GoldProduction1" ability from "SoverignTalents.xml", it seems that unless you erase the ability from the core files it just adds on. IE first thing i did was just change it from 1$ to 10$, actual gain was 11/turn(1 from core, and 10 from mod). After that i tried messing around with the calculation system and even tried no ValueOwner, since spells were able to use that as a valid state. So far no luck in having it be stat based. Still looking tho
End of Gnrl's quote

Hmmm, I'm not having this problem but other people have reported having this happen to their mods too. What, specifically, are you guys doing to copy new file and code it?

I'd have ALL SORTS of trouble if this was the case because my "Abilities and Histories Mod" duplicates... every traits and ability in the game. However, they are only displaying once and working fine.

Also, I may have just figured out how to implement passive XP, testing now.