[REQ/HELP] Starting with a Companion...

How do you enable a sovereign to start the game with a companion?

I have a sovereign I created who I decided to make a weaker character, however, I'm planning on him starting off with an additional companion to off-set his weakness. I know how to add an additional dog or bandit or guard to him but I'd like him to start with a full champion or companion or hero character who can level up, get equipment, and hold their own. The question is: how does one do this?

 

I've messed with the code a bit for the character file and have tried "<NPCPartyMember>" but that failed to generate results, I believe it only effects champions. I'll mess with it a bit more and see what I can find.

 

If anyone has any idea how to add a hero to a sovereign at start, please let me know. I'd love to see adventuring parties and what not.

9,645 views 8 replies
Reply #1 Top

By far the easiest way would be to have a spell you cast. You can set the cooldown to -1 to make it one cast per game, and remember to restrict it to your sovereign only. This is the XML you use to summon a champion instead of a unit.

    <GameModifier>
                <ModType>Unit</ModType>
                <Attribute>UnitJoinArmy</Attribute>
                <StrVal>Champion_InternalName_Goes_Here</StrVal>
                <UnitClass>Champion</UnitClass>
    </GameModifier>

Reply #2 Top

Might I suggest you summon a henchman instead of a champion. I think now they can die but otherwise level up and use items. Its worth considering anyways.

Reply #3 Top

I have a sovereign I created who I decided to make a weaker character, however, I'm planning on him starting off with an additional companion to off-set his weakness. I know how to add an additional dog or bandit or guard to him but I'd like him to start with a full champion or companion or hero character who can level up, get equipment, and hold their own.
End of quote

Aside from the question, this is a really cool idea :)

Sincerely
~ Kongdej

Reply #4 Top

Two excellent suggestions, I shall try those. Thanks!

Reply #5 Top

Hmmm, I have come to the realization that I have no idea how to actually make a spell. I'm going to assume that I need to make a custom trait or ability that links that spell? Then give my character that trait or ability.

 

Here's what I have now:

 

Code: xml
  1. &lt;Spells&gt;
  2. &lt;DataChecksum NoParse="1"&gt;
  3. &lt;Ignore&gt;DisplayName&lt;/Ignore&gt;
  4. &lt;Translate&gt;DisplayName&lt;/Translate&gt;
  5. &lt;/DataChecksum&gt;
  6. &lt;SpellDef InternalName="Recruit1"&gt;
  7. &lt;DisplayName&gt;Recruit&lt;/DisplayName&gt;
  8. &lt;Description&gt;Recruits companions.&lt;/Description&gt;
  9. &lt;FormattedDescription&gt;Heals target unit by %d.&lt;/FormattedDescription&gt;
  10. &lt;Image&gt;S_Inspiration_Painting.png&lt;/Image&gt;
  11. &lt;IconFG&gt;S_DispelEnchantment_Icon.png&lt;/IconFG&gt;
  12. &lt;IconBG&gt;S_Inspiration_Icon_BG.png&lt;/IconBG&gt;
  13. &lt;IconColor&gt;174,255,59&lt;/IconColor&gt;
  14. &lt;AutoUnlock&gt;0&lt;/AutoUnlock&gt;
  15. &lt;SpellResourceCost&gt;
  16. &lt;Resource&gt;Mana&lt;/Resource&gt;
  17. &lt;Amount&gt;10&lt;/Amount&gt;
  18. &lt;/SpellResourceCost&gt;
  19. &lt;GameModifier&gt;
  20. &lt;ModType&gt;Unit&lt;/ModType&gt;
  21. &lt;Attribute&gt;UnitJoinArmy&lt;/Attribute&gt;
  22. &lt;StrVal&gt;Cleric_563170463-868&lt;/StrVal&gt;
  23. &lt;UnitClass&gt;Champion&lt;/UnitClass&gt;
  24. &lt;/GameModifier&gt;
  25. &lt;AIData AIPersonality="AI_General"&gt;
  26. &lt;AIPriority&gt;15&lt;/AIPriority&gt;
  27. &lt;ValueCalcWrapper&gt;
  28. &lt;ValueType&gt;IsTargetWorthy&lt;/ValueType&gt;
  29. &lt;Calculate InternalName="Calc" ValueOwner="TargetUnit"&gt;
  30. &lt;Expression&gt;&lt;![CDATA[[Unit_GetHPCurrent]]]&gt;&lt;/Expression&gt;
  31. &lt;/Calculate&gt;
  32. &lt;Calculate InternalName="Value"&gt;
  33. &lt;Expression&gt;&lt;![CDATA[[Calc] &lt; 30]]&gt;&lt;/Expression&gt;
  34. &lt;/Calculate&gt;
  35. &lt;/ValueCalcWrapper&gt;
  36. &lt;/AIData&gt;
  37. &lt;HitSoundFX&gt;Spell_Heal_01&lt;/HitSoundFX&gt;
  38. &lt;HitSoundFX&gt;Spell_Heal_02&lt;/HitSoundFX&gt;
  39. &lt;/SpellDef&gt;
  40. &lt;/spells&gt;

I think I need some proper code to reference, this is based off a healing spell because I couldn't find anything similar.

Reply #6 Top


the summon familiar spell would  serve as a better starting point. or a summon elementals spell, but i would look closely at the familiar.

Reply #7 Top

Yeah, you can set up a trait to unlock the spell. See bandit lord for example.

Reply #8 Top

Actually, I believe I have already tried using the bandit lord ability as a base for this and had no success. It's either a problem with my code or it does require a castable spell.

I'll look into the summon elementals spell.