1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Embarked unit questions

Discussion in 'Civ5 - SDK / LUA' started by Pazyryk, Jul 22, 2014.

  1. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    I can figure these out with some research, but I was hoping someone happened to know off the top of their head to save me the trouble:
    1. Where is the ART_DEF_ specified for the default embarked unit graphic?
    2. IIRC, there is a DLC that changes this. What/where is the xml tag for that? (And is this change purely graphic, or does it have any non-graphic effect?)
    3. Are the "effective unit stats" for an embarked unit hard-coded or set in a table somewhere? (By effective I mean movement, combat strength, etc. as applied when unit is embarked.)
    4. If answer to #3 is set in table, is it possible to make an embarked unit work as a regular combat ship, able to attack?
    5. If answer to #3 is hard-coded, does the dll set "effective stats" for embarked units in one place (easy to mod)? Or did they scatter it willy nilly in all 20 methods involving unit combat and movement?

    Obviously, the point of all these questions is so that I can mod embarkation to work differently, for some specific units. What I had in mind was something like a Vikings unit that would embark as a melee-capable ship. But I'd have to be able to control individual unit stats when embarked to do that.
     
  2. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,529
    Location:
    Near Portsmouth, UK
    1) Hard-coded (in CvPlayer)
    Code:
    // Special handling for the Polynesian trait's overriding of embarked unit graphics
    if(m_pTraits->IsEmbarkedAllWater())
    {
      SetEmbarkedGraphicOverride("ART_DEF_UNIT_U_POLYNESIAN_WAR_CANOE");
    }
    else if(m_pTraits->IsEmbarkedToLandFlatCost())
    {
      SetEmbarkedGraphicOverride("ART_DEF_UNIT_U_DANISH_LONGBOAT");
    }
    
    but can also be set from Lua via pPlayer:SetEmbarkedGraphicOverride()

    2) Polynesia, Denmark and the Treasure Ship in the Spain/Inca scenario - purely graphical

    3) Defines.EMBARKED_UNIT_MOVEMENT and Eras.EmbarkedUnitDefense

    4) probably not as it's only the movement rate and defense that are set, ie, it's not a regular unit
     
  3. Civitar

    Civitar Adventurer

    Joined:
    Mar 23, 2014
    Messages:
    1,507
    Gender:
    Male
    Location:
    Switzerland
    I hope this is to fix the fact that in Éa all embarked units are on modern ships... how would I make a new embarked graphic and then use it as the embarked graphic for a new unit? Would that require a DLL mod?
     
  4. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    whoward69 didn't quite answer #1, or at least what's in the code block is really about question #2. It has to change somehow in base Civ5 given that it does change in the game (with era?), but it may indeed be hard-coded (which is not a problem for me, just tells me where I need to mod). But Éa is permanently in Ancient Era so it isn't a simple hook up to era.

    So yes, I'm trying to fix that. But I'm also looking at implementing Sea Warrior. This GP needs to embark as a combat-capable ship. Can't do that directly apparenlty. But can do it indirectly with a unit swap (which we do all the time in the mod).
     
  5. Nutty

    Nutty Deity

    Joined:
    Mar 9, 2011
    Messages:
    3,181
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    anc: ART_DEF_UNIT_GALLEY (not to be confused with ART_DEF_UNIT_BARBARIAN_GALLEY)
    med: ART_DEF_UNIT_GALLEON
    mod: ART_DEF_UNIT_TRANSPORT

    [i.e., just change the model rather than the ART_DEF entry]
     
  6. Craig_Sutter

    Craig_Sutter Deity

    Joined:
    Aug 13, 2002
    Messages:
    2,752
    Gender:
    Male
    Location:
    Calgary, Canada
    Hate to bring an old thread back to life, but I am trying to keep my medieval scenario medievally flavored by eliminating modern embarked graphics that keep on creeping in...

    Would this sql do it?

    Code:
    
    UPDATE UnitMemberArtInfo
    SET Granny = Galley.fxsxml
    WHERE Type = ART_DEF_UNIT_MEMBER_GALLEON
    
    UPDATE UnitMemberArtInfo
    SET Granny = Galley.fxsxml
    WHERE Type = ART_DEF_UNIT_MEMBER_TRANSPORT
    
    
     
  7. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,529
    Location:
    Near Portsmouth, UK
    Looks like you're looking at the XML from the .fpk files as there is no table called UnitMemberArtInfo. You'll need to look at the extracted unit art info files (see here) - I'm guessing you mean ArtDefine_UnitMemberInfos and column Model
     
  8. Craig_Sutter

    Craig_Sutter Deity

    Joined:
    Aug 13, 2002
    Messages:
    2,752
    Gender:
    Male
    Location:
    Calgary, Canada
    Thank-you... I had previously downloaded your files, but not the orphans.

    The entries I used were not extracted from the fpk by me, but were found within the Units folder directly within the expansion 1 or 2 folders, I think.

    Having referenced your files, I think the following will accomplish what I want. I do not think I need to adjust the art from Galleon as I don't believe it is used except for Spanish (correct me if I'm wrong).

    Here is the new code I am using...

    Code:
    
    UPDATE ArtDefine_UnitInfoMemberInfos
    SET UnitMemberInfoType = ART_DEF_UNIT_MEMBER_GALLEY
    WHERE UnitInfoType = ART_DEF_UNIT_TRANSPORT
    
    UPDATE ArtDefine_StrategicView
    SET Asset = SV_Galley.dds
    WHERE StrategicViewType = ART_DEF_UNIT_TRANSPORT
    
    
    Thanks again for the help. Hope this one's right :).
     
  9. Nutty

    Nutty Deity

    Joined:
    Mar 9, 2011
    Messages:
    3,181
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    Sorry, you're wrong. There are 3 embarked models (as mentioned in #5 above), not counting the Danish and Polynesian, and the galleon is the middle era one. The Spanish galleon for the New World scenario is a different unit [treasure ship] with a different model.

    Note (as mentioned in #2 above) you can also use Lua to change embarked art defines.
     
  10. Craig_Sutter

    Craig_Sutter Deity

    Joined:
    Aug 13, 2002
    Messages:
    2,752
    Gender:
    Male
    Location:
    Calgary, Canada
  11. Craig_Sutter

    Craig_Sutter Deity

    Joined:
    Aug 13, 2002
    Messages:
    2,752
    Gender:
    Male
    Location:
    Calgary, Canada
    Does this lua set embarked graphics (longboat for 4 civilizations and the rest get galley)? And does it ignore era changes?

    Code:
    
    function PlayerEmbark(iPlayer)
    
    	local pPlayer = Players[iPlayer]
    
    	if (GameInfo.Civilizations.CIVILIZATION_DENMARK.ID == pPlayer:GetCivilizationType()) or
    	(GameInfo.Civilizations.CIVILIZATION_CARTHAGE.ID == pPlayer:GetCivilizationType()) or 
    	(GameInfo.Civilizations.CIVILIZATION_INDIA.ID == pPlayer:GetCivilizationType()) or 
    	(GameInfo.Civilizations.CIVILIZATION_SWEDEN.ID == pPlayer:GetCivilizationType()) then
    	
    	pPlayer:SetEmbarkedGraphicOverride("ART_DEF_UNIT_U_DANISH_LONGBOAT")	
    
    	else
    
    	pPlayer:SetEmbarkedGraphicOverride("ART_DEF_UNIT_GALLEY")
    
    	end	
    end
    
    
    Thank-you.
     

Share This Page