Gnilbert Gnilbert

A few specific Modding Questions for Stardock

A few specific Modding Questions for Stardock

 UPDATE: With core system mechanics currently in the "overhaul" phase, I completely understand any reservation from SD to spend a lot of time preparing detailed responses to my questions. I've updated this post to include shorter, more directed questions under the original questions. I'd honestly be happy if someone even just answered one of them. If you're reading this and know the answer to even a single item/subitem, would you mind typing a quick reply with the question/answer? Thanks!

Hey guys - I know you're busy on the patch, but I was hoping that you could find the time to provide the answers to a few questions. For the most part, I try to figure this stuff out myself by scouring through the core XML files, but when it comes to parameter names that aren't currently used, we're just stabbing in the dark. I'd even appreciate a partial response if some of the items are "under development."

Ideally, I'd love to see a full schema for the XML elements - but I realize that you probably don't want to provide that while you're still in full scale patch mode. My questions are just the "highlight reel" of what I'm most limited by right now in my own modding efforts.

1. <Calculate />
* I have a tutorial on what we know about this HERE.
    - What are the valid values for "ValueOwner"?
    - What properties are available for each "ValueOwner" - could you essentially provide a list of the public properties for different ValueOwner classes (or tell us where we can look to figure it out)
    - Are there other "Calculate" type elements like If, Max, Min, IsEqual, Pow, or the like?
    - Is there any type of conditional branching support?
    - How can I use the player's current (Gildar/Metal/Wargs/other resource) with Calculate?
ANSWER (by Frogboy): In v1.1 spells are going to support using global resources and mana will become a global resource. He further clarified that this would include player-defined global resources as well.

    - How can I use a custom global resource with Calculate?
    - (Heavenfall) Is it possible to allow us to create more than one prop per spell in tactical battles from CreateWorldProp?

2. <GameModifier />
   - What are the correct combinations for ModType x Attribute x (StrVal, Value, Duration, TerrainType, etc)?
   - Is there a way to apply effects to units that start/end their turn in or move into a map location?

3. Is there a way to "attatch" a visual effect to a Unit and not to a tile when casting a spell?
  - Can you make this effect only last until the spell duration is over?
  - Can you make it until an indefinite spell is cancelled?

4. <SpellDef />
* I have a tutorial with comments on creating a spell HERE.
   - What are the properties that can be set?
   - Is there a way to apply a (not linked to their hands) spell effect to the spell caster when the spell hits the target?
   - Can we make a spell cost the caster hit points or other stats besides Essence?
   - Can we make a spell cost Gildar or other global resources?

5. Is it possible to give the user the option of multiple improvement types on a single resource tile? (Like build either Building X or Building Y on selected Old Growth Forest tile?)
ANSWERED (by Frogboy): Yes. Take a look at CoreWorldResources.xml and you will see that they define a type in there. Then look for say Imperial Farm in the EmpireUnlimitedImprovements.xml.  In it, it looks for <SupportedResourceType>. You can have multiple improvements that make use of that resource.

6. (Heavenfall) Is it possible to let the game search through sub-folders in the mod folders when searching for xml files? Or is there any other way to put our mods in folders (beyond the basic ones) to prevent our files all ending up in the same place?
    For example, sinusgamma's new city tileset and raceconfig for a nordic kingdom has over 100 files in it. On its own, this is not a huge problem. But if I want to add 10 more races, and then delete one race, it gets very difficult.


Thanks in advance,
Gnilbert

23,393 views 46 replies
Reply #26 Top

Quoting Stmorpheus, reply 25

Quoting Frogboy,
reply 22
Regarding spells:
In v1.1 spells are going to support using global resources and mana will become a global resource.

wait you mean that its possible to need spell components?  like to cast say arcane armor it may need say 3 iron?  because that would be badass and unique.  a great way to curb very high level spells!
End of Stmorpheus's quote


You and me both! I'm absolutely changing my "Unholy Mana" to something like "Profane Devotion" when that happens, and then I can let the player use it for everything from improvements to units to "miracle" spells. It's going to be awesome. Oh - and the holy stuff too. :blush:

Gnilbert

Reply #27 Top

yes, that would be such a game changer, but an amazing one! in most of my games i always have alot of left over resources it seems, this would be a way to use those.

example: 

spell: create steel golem

spell components:  50 iron ore, 1 earth shard, 1 fire shard

if this is the way it works the possibilities are endless!


Reply #28 Top

Edit: removed again!

Reply #29 Top

Quoting Stmorpheus, reply 25

Quoting Frogboy, reply 22Regarding spells:

In v1.1 spells are going to support using global resources and mana will become a global resource.

wait you mean that its possible to need spell components?  for example, to cast arcane armor it may need say 3 iron?  because that would be badass and unique.  a great way to curb very high level spells!
End of Stmorpheus's quote

The idea is that a spell would make use of a global resource. That resource would typically be Mana (which would be a global resource).

So we'll have something like this:

 

Code: xml
  1. &lt;GameModifier&gt;
  2. &lt;ModType&gt;SpellResourceCost&lt;/ModType&gt;
  3. &lt;Attribute&gt;Mana&lt;/Attribute&gt;
  4. &lt;Value&gt;-25&lt;/Value&gt;
  5. &lt;/GameModifier&gt;

Or

Code: xml
  1. &lt;GameModifier&gt;
  2. &lt;ModType&gt;SpellResourceCost&lt;/ModType&gt;
  3. &lt;Attribute&gt;NightShade&lt;/Attribute&gt;
  4. &lt;Value&gt;-1&lt;/Value&gt;
  5. &lt;/GameModifier&gt;

 

Just remember, you don't have to modify existing files.  You create your mods in their own files:

I.e. Here's how I define a resource:

Code: xml
  1. <span> </span>&lt;ResourceType InternalName="FrogLegs"&gt;<span> </span>&lt;DisplayName&gt;Frog Legs&lt;/DisplayName&gt;<span> </span>&lt;Type&gt;FrogLegs&lt;/Type&gt;<span> </span>&lt;Description&gt;blah blah.&lt;/Description&gt;<span> </span>&lt;LongDescription&gt;Longer blah blah.&lt;/LongDescription&gt;<span> </span>&lt;PreferredTerrain&gt;Land&lt;/PreferredTerrain&gt;<span> </span>&lt;NeedsToBeUnlocked&gt;0&lt;/NeedsToBeUnlocked&gt;<span> </span>&lt;HarvestType&gt;Lillypads&lt;/HarvestType&gt;<span> </span>&lt;IconColor&gt;0,0,0&lt;/IconColor&gt;<span> </span>&lt;Icon&gt;Gfx//Icons//Icon_Metal.png&lt;/Icon&gt;<span> </span>&lt;ClothIcon&gt;gfx\\TacticalIcons\\MetalOre_1.png&lt;/ClothIcon&gt;<span> </span>&lt;TileDesign&gt;R_Iron_Ore_01&lt;/TileDesign&gt;<span> </span>&lt;ModelColor&gt;0,0,0&lt;/ModelColor&gt;<span> </span>&lt;Production&gt;1.0&lt;/Production&gt;<span> </span>&lt;Worth&gt;5&lt;/Worth&gt;<span> </span>&lt;Global&gt;0&lt;/Global&gt;<span> </span>&lt;Rarity&gt;300&lt;/Rarity&gt;<span> </span>&lt;Stored&gt;0&lt;/Stored&gt;<span> </span>&lt;RummagedPerTurn&gt;0.75&lt;/RummagedPerTurn&gt;<span> </span>&lt;Medallions InternalName="IronOre_Res_Medallions"&gt;<span> </span>&lt;All&gt;Res_Ores_Plains.png&lt;/All&gt;<span> </span>&lt;/Medallions&gt;<span> </span>&lt;OnSelectSFX&gt;Click_IronOre_01&lt;/OnSelectSFX&gt;<span> </span>&lt;/ResourceType&gt;

This could all be put in a file called FrogboysMod.xml and thrown into your english directory (or soon our generic "mods" directory).

But all the resources and spells and such are data driven.  What we have to do for v1.1 is make it so that spells make use of a global resources. Right now, they're hard coded to shard resources.

Reply #30 Top

Quoting Frogboy, reply 19
5. Is it possible to give the user the option of multiple improvement types on a single resource tile? (Like build either Building X or Building Y on selected Old Growth Forest tile?)

Yes.

Take a look at CoreWorldResources.xml and you will see that they define a type in there.

Then look for say Imperial Farm in the EmpireUnlimitedImprovements.xml.  In it, it looks for <SupportedResourceType>. You can have multiple improvements that make use of that resource.

End of Frogboy's quote

Hrm. I'm not sure this one is working as intended. Maybe it has something to do with the change from requiring the resource improvements to be built from the city vs. building them on by clicking on the resource tiles? I have an improvement with the following content:


    <Prereq>
      <Type>Allegiance</Type>
      <Attribute>Empire</Attribute>
      <Value>0</Value>
    </Prereq>
    <SupportedTerrainType>Land</SupportedTerrainType>
    <SupportedTerrainType>City</SupportedTerrainType>
    <RequiresCity>True</RequiresCity>
    <RequiresResource>True</RequiresResource>
    <SupportedResourceType>FertileLand</SupportedResourceType>
    <IgnoreDuplicateImpLimit>true</IgnoreDuplicateImpLimit>

  Unfortunately, the improvement isn't buildable from either the City itself or when clicking on the Fertile Land tile (though the original, farm improvement is).

Gnilbert

Reply #31 Top

YOu need to eliminate the Prereq you have up there.

Reply #32 Top

Regarding spells:

In v1.1 spells are going to support using global resources and mana will become a global resource.
End of quote

The caster's own resources, I assume.

I've been tinkering with a spell or ability for a spy-like or raider unit to "steal" resources.

So far I have only been able to buff/debuff the production in a target city. That's not surprising given that there are several vanilla spells that do exactly that.
What doesn't seem to be supported is something like:

Target city/faction/caravan:  -10 metal (or some random resource)
and at the same time...
Casters city/faction/caravan:  +10 metal (or some random resource)

It doesn't have to be an instant spell. An enchantment with a 1 turn duration is close enough for government work.

 

Yeh, I know. Why don't you try something normal? =P

Reply #33 Top

Quoting Frogboy, reply 31
YOu need to eliminate the Prereq you have up there.
End of Frogboy's quote

    Thank you again for helping with this! Removing the prereq makes it show up in the Book as an option to build on the resource, but the (single) little hammer icon (when you have the resource tile selected) only lets me build the Farm (my improvement is like a Field of Darkness). It also doesn't show up as an option from the city menu.

EDIT: Translated = I still can't actually build the improvement. :(

Gnilbert

Reply #34 Top

Quoting Robert, reply 32

Regarding spells:

In v1.1 spells are going to support using global resources and mana will become a global resource.

The caster's own resources, I assume.

I've been tinkering with a spell or ability for a spy-like or raider unit to "steal" resources.

So far I have only been able to buff/debuff the production in a target city. That's not surprising given that there are several vanilla spells that do exactly that.
What doesn't seem to be supported is something like:

Target city/faction/caravan:  -10 metal (or some random resource)
and at the same time...
Casters city/faction/caravan:  +10 metal (or some random resource)

It doesn't have to be an instant spell. An enchantment with a 1 turn duration is close enough for government work.

 

Yeh, I know. Why don't you try something normal? =P
End of Robert's quote

Well realistically, we want to make sure we can make the system as flexible as possible so that spells aren't limited to what Stardock came up with.

Reply #35 Top

Quoting Robert, reply 32

Yeh, I know. Why don't you try something normal? =P
End of Robert's quote


Meh. Normal isn't cool. We already know we can do the normal stuff. Where's the fun in that? :thumbsup:

    This is coming from someone who has, of course, beat his head against the desk several times while trying to create various "Wall of X" effects before realizing that particle effects don't play on wall tiles. I did get a cool Wall of Earth and Wall of Bone spell - but no Fire, Water or Air.

    And don't even get me started on how much time I wasted trying to get creative with ongoing visuals for enchantment spells. Heh. Or that zany workaround I'm using to include my Unholy Mana for bonus spell damage!

We quest, do we not?
Gnilbert

Reply #36 Top

So I tried making two improvements for one tile, and they both did show up "in the book", but there was only one "hammer" icon to build. Since you can't build from the book, I guess we need a mod to add more hammers.

Reply #37 Top

I have a question:

 

Is it possible to change the images and text descriptions for the tech categories (such as Imperium, Domination, etc)? I see a list of them in the techtree xmls, but it doesn't seem to work. Maybe I'm missing where the code is, but I havent been able to find it.

 EDIT: Nevermind. Of course I find it two minutes after posting this. (It's in CoreTechs.xml, yeah, a real far cry - dont know how i missed it ).

 

Reply #38 Top

 

Well realistically, we want to make sure we can make the system as flexible as possible so that spells aren't limited to what Stardock came up with.
End of quote

Aye, that's how I understood the intention. (and I'd offer to have your babies if it was biologically feasible)

I mostly posted this to point out that the scope of both spell cost/resources and affected target - or multiple targets - should be put on the "flexible" list.

 

Like a spell/ability that has 2 effects at once with differing scope like:

     Targeted city:  -10 metal
     +
     Caster's global resource: +10 metal

 

An example for a non-standard scope on the spell cost would be

     Caster's own HP:  -10
     +
     Caster Faction global Mana:  -2

          Some kind of necromancer-style HP transfer where it would be useful if the HP would be part of the cost of the spell so the caster
          (like an AI channeler) doesn't accidentially kill itself since a spell effect certainly isn't bothered by such details.
          So even if AI channelers might use that modded "heal" spell, the matter of the cost wouldn't let them "act stupid" by
          killing themselves.
          It doesn't automatically require a script for everything "cool" if such things can be worded properly... so the AI can understand it.

 

 

Edit:

The only other "issue" I can see is that spells are too straightforward. Too scientific.
One cost, one effect.

For "simple" and small scale spells like healing that is fine and dandy but with big juju, there should be a chance for side effects. Good and bad ones.
Or there could be an entire "Chaos Book", which would always do... more or less what you were intending. =P

My major wish for  Spellcasting 2.0  would be that spells can have multiple effects.

    <SpellTargetType>FriendlyUnit</SpellTargetType>


     <SpellDefEffect>
       <EffectName>Protection_from_Fire</EffectName>
       <LocalPosition>0,0,0</LocalPosition>
       <EffectScale>1.5</EffectScale>
       <EffectDelay>0.0</EffectDelay>
       <SnapToTerrain>1</SnapToTerrain>
     </SpellDefEffect>

     <!-- the interesting stuff starts here -->

     <GameModifier InternalName="Chaos_Heal_Good_Effect">
       <EffectMultipleChoice>1</EffectMultipleChoice>
       <EffectTriggerChance>0,8</EffectTriggerChance>
       <EffectTarget>Target</EffectTarget>
       <ModType>Unit</ModType>
       <Attribute>AdjustUnitStat</Attribute>
       <StrVal>UnitStat_HealthRegen</StrVal>
       <Value>5</Value>
       <Duration>3</Duration>
     </GameModifier>

     <GameModifier InternalName="Chaos_Heal_Bad_Effect">
       <EffectMultipleChoice>1</EffectMultipleChoice>
       <EffectTriggerChance>0,2</EffectTriggerChance>
       <EffectTarget>Target</EffectTarget>
       <ModType>Unit</ModType>
       <Attribute>AdjustUnitStat</Attribute>
       <StrVal>UnitStat_HealthRegen</StrVal>
       <Value>-1</Value>
       <Duration>3</Duration>
     </GameModifier>

     <GameModifier InternalName="Chaos_Heal_Side_Effect">
       <EffectMultipleChoice>0</EffectMultipleChoice>
       <EffectTriggerChance>0,005</EffectTriggerChance>
       <EffectTarget>Caster</EffectTarget>
       <ModType>Unit</ModType>
       <Attribute>AdjustUnitStat</Attribute>
       <StrVal>UnitStat_HealthRegen</StrVal>
       <Value>-3</Value>
       <Duration>3</Duration>
     </GameModifier>

 

This is an example of a "Chaos Heal" spell, having 3 different effects.
Chaos_Heal_Good_Effect   and   Chaos_Heal_Bad_Effect   have the   "multiple choice"   bit set so one of them is always selected based on the assigned chance.
There's an 80% chance for a good regen spell but a 20% one for... additional bleeding instead of regen.

If I wanted a multiple choice spell that can completely fizzle, I'd make one of the choices a 10% chance effect that does absolutely nothing.

Chaos_Heal_Side_Effect   does not have   "multiple choice"   set so it can always fire, only depending on the assigned chance.
It also has a different target than the "normal" regen spell itself.
There's a 0,5 % chance that the spell works normally but additionally backfires on the caster as well, giving the caster negative regen for a bit.

 

If the first 2 effects did not have  "multiple choice"   set then all 3 effects could potentially fire at once.

With a framework like that we could have interesting magic.
There could be a higher level Greater Heal spell that isn't that much more powerful (therefore easier to balance) but does not have the chance to fizzle like the low level version.
"Better" spells would not automatically have to be better in quantity but could be better in quality or have additional effects.
The Greater Heal could add a 2 turn regen or armor buff, for instance, or even invulnerability (massive armor) for one turn.

Magic could be wild and crazy and not like something from a physics textbook.  One action, one reaction. Boooooring.

Reply #39 Top

Quoting Frogboy, reply 34

Well realistically, we want to make sure we can make the system as flexible as possible so that spells aren't limited to what Stardock came up with.
End of Frogboy's quote

 

Awesome sauce and then some there FB.

Reply #40 Top

Thanks for taking the time to answer questions for us info hungry modders!

I have a question directed at the 3D art people, and I hope it's easy to answer since in the future I'll definitely ask stuff on animation:-s. Anyways my question is, does Elemental support having 2 different texture files for UV Mapping? Let me try to explain better since I'm rather new to this x.x.

The next picture shows what my problem currently is:

As you can see the model in the left has a hole in it and that is already in game. If I use the Havok Preview tool to load that same file the rusty part is present as it should be. The only difference I made this time is that instead of using 1 single image, I manually mapped that rusty area and used another image file to texture it.

So back to my question, do I have to put all the textures in the same ".PNG" or can I use more than 1 ".PNG" for the same model? Or am I just missing some option?

Sorry for the long post, hope this makes sense and that someone reads this up :D.

Reply #41 Top

Civfreak, in 3ds Max I can use different textures for different objects, and it will carry over to the game. So the havok format definitely supports it. In fact, I've even used 3 for one item with 3 objects in it.

I know it's not strictly helpful since you're in blender, but at least now you know the format supports it, and the game does.

Reply #42 Top

Quoting Zero_the_Hero, reply 16

Quoting hairrorist, reply 15That's another cardinal sin in a game billed as mod-friendly.

There are so many sins about the promises made upon the release of this game that I think this one is just a footnote.

We wouldn't be so desperate to mod the game if it weren't so bad overall.
End of Zero_the_Hero's quote

 

Not a great way to get help folks, please take it to another thread.
Lee

 

Reply #43 Top

at first i was very hesitant with a global mana pool, but after reading more about it and seeing the possibilities, well i am 100 percent for it!  so much potential here.  since brad intends this to be just mana for stock elemental, maybe i will try my hand at modding a sort of spell component mod or something.

 

Reply #44 Top

Hmmm I wonder what I'm doing wrong because the model in the preview works but then in game it doesn't urghhh.

Heavenfall have you tried using 2 images for the same object though? It might be stupid using 2 images for the same object but maybe on the more complicated types of models you might need to say Unwrap the body, then unwrap the legs or something and use a different texture for that.

Bah thats a shitty example but I hope that makes sense, and as usual thanks for the inmense help seƱor! If anything ill just cramp up my textures to a single file or something which is another thing I took notice of today. If I do lots of separate textures thats a lot of memory that needs to get read so prob better doing that.

Reply #45 Top

Yeah definitely, in the long run. I've started doing the same myself. That and using the same textures over and over.

I actually haven't used two textures for the same object, I don't even know how. If I have one object that I need to use two textures on, I just split the object into two.

Edit: Actually, I remember I once used an UV map, then changed texture, then made a new UV map. Normally making several UV maps for one object is not a problem, but when I had changed the texture, it no longer worked. So that could be it, 2 textures on 1 object could be bad.

Reply #46 Top

Why is this so difficult to get fixed?

Code: xml
  1. &lt;MajorFrustration&gt;
  2.     &lt;Request&gt;
  3.         &lt;Issue&gt;XML in forums is formatted with wrong style&lt;/Issue&gt;
  4.         &lt;Why&gt;CSS precedence is not controlled so wrong code is active in code-view&lt;/Why&gt;
  5.         &lt;Impact&gt;Modders can't easily read the XML&lt;/Impact&gt;
  6.         &lt;Solution&gt;Simply add the word div to line 102 of the theme style.css&lt;/Solution&gt;
  7.         &lt;TimeEstimate&gt;2 minutes&lt;/TimeEstimate&gt;
  8.         &lt;Reference&gt;https://forums.elementalgame.com/395713&lt;/Reference&gt;
  9.     &lt;/Request&gt;
  10. &lt;/MajorFrustration&gt;