The new modding master thread

Allright. A place to discuss and talk about all things concerning modding in general and to share resources about modding. I'll collect the resources here in the beginning for anyone interested.

 

Information about modding

The following are threads from the old modding forums (which are found here):
https://forums.demigodgame.com/forum/622/
If you want to follow any links in those old threads, they usually lead to the domain demigodthegame.com, which you need to replace by demigodgame.com.

A guide on creating items, by Exxcentric. The comments by user miriyaka are also very useful.
https://forums.demigodgame.com/376116/page/1/

About having logging enabled:
https://forums.demigodgame.com/399524/page/1/#2812347

On modding UI:
https://forums.demigodgame.com/369844/tutorial-how-to-create-a-new-window

On .dds-files:
https://forums.demigodgame.com/369682/tutorial-dds-image-files
As M_KIII pointed out, you can use paint.net to edit .dds-files (https://www.getpaint.net/).

On hooking so it's compatible with other mods:
https://forums.demigodgame.com/368556/tutorial-how-to-hook

The links above are I think all in the following old list of modding resources. It also contains links to older mods. Further below I will list the mods that can still be downloaded (along with anything new we might make).
https://forums.demigodgame.com/370292/mod-list-community-mods-updated-03282010

Useful for testing mods:

Quoting Soeplepel, reply 10

You can create a shortcut to demigod.exe, when you look at the properties of the shortcut there is a target input field which will contain the path to the .exe file. After that path you can put things like /skipintro /size 1920 1080 /showlog

 

Mods

Pacov's mod package (includes: Balance Mod, Enhanced UI, Enhanced AI, FavorMod, Uberfix):
https://forums.demigodgame.com/482661/pacovs-mod-package-has-old-files-again

Enfos Mod (v1.3) by Exxcentric:
https://forums.demigodgame.com/384535/enfos-mod-test-v-13-new

ExtendedBalanceMod by Schwiegerknecht:
https://github.com/Schwiegerknecht/ExtendedBalanceMod/releases
https://forums.stardock.com/505377/mod-extended-balancemod

Hercules mod by M_KIII (in development):
https://forums.stardock.com/502172/page/1/#3791662

New Favor Items by Neilo:
https://forums.demigodgame.com/369974/modfavor-items---newneilos-new-favor-items-theleran-armor---sacred-chalice-

The Avatar (favor item) by Neilo:
https://forums.demigodgame.com/369832/modartifact-the-avatar

QoT Focus Mod by Ptarth:
https://forums.demigodgame.com/372817/mod-qot-mod-focus-mod

Cloak of Invisibility (artifact) by Schwiegerknecht:
https://forums.stardock.com/502122/mod-cloak-of-invisibility-enabled-in-artifact-shop

Infinite mana by Schwiegerknecht:
https://forums.stardock.com/502121/mod-infinite-mana-mod

Cooldown reduction by Schwiegerknecht:
https://forums.stardock.com/502120/mod-cooldown-reduction-mod

More minions by Seipienti/Schwiegerknecht:
https://forums.stardock.com/502123/mod-more-minions

 

Let me know if you should find other interesting stuff, then I'll put it here.

58,474 views 9 replies | Pinned
Reply #1 Top

After finally finding motivation to look through the game files again, I also found some of the basic class files which contain interesting stuff. They're collected in the sim-folder. There's also stuff not listed here, like Navigator and UnitCommand and Prop and Blip. I just have no clue what they do, and for modding purposes they're (probably) not that important. Moho seems to be some outside library module which I don't know, since I have little clue about Lua ;)

#------------------

While some library seem to be used in DG, not all methods are available. String methods used in the gamefiles are:
find, format, gfind, gsub, len, lower, rep, sub, upper

#------------------

FiringRandomness: An apparently unused mechanic is that autoattacks have a chance to miss. FiringRandomness would have prevented those misses. But as far as I can see, it does nothing at the moment.

#------------------

Class relations. The respective parent classes are in parenthesis (Get it? Get it?):

Inventory()
Weapon(moho.weapon_methods)
Attacker(moho.attacker_methods)
Entity(moho.entity_methods)

Projectile(moho.prjectile_methods, Entity)
ArrowShield(Entity)
Unit(Entity)
ForgeUnit(Unit)

PowerUp(ForgeUnit)
AirUnit(ForgeUnit) - which has no properties, apparently
CharacterUnit(ForgeUnit)

HeroUnit(CharacterUnit)
MinionUnit(CharacterUnit)
StructureUnit(CharacterUnit)

FlagUnit(StructureUnit)
Shop(StructureUnit)

FactoryUnit(Shop)
SpireUnit(Shop) - Citadel it seems

RangedWeapon(Weapon)
DefaultMeleeWeapon(Weapon)
BeamWeapon(Weapon)

#------------------

Some functions you can use to return certain stats (see game files for examples with GetHealth, but not much else). All these Get-functions follow the same pattern, though:
GetEnergy = function(self)
    return self.Energy or 0
end
That means although there is no GetEnergyRegen-function (for example), you can still grab that value by just accessing "unit.EnergyRegen".

Found in ForgeUnit.lua:

GetHealthPercent
SetMaxEnergy
SetEnergy
SetEnergyRegen
GetEnergy
GetMaxEnergy
GetEnergyPercent

Found in HeroUnit.lua:

GetDamageRating (Weapon/auto attack strength)
GetGold ("#Get the agent's army gold")
GetLevel

#------------------

Below are callbacks found in ForgeUnit.lua. Many buff tables use OnBuffAffect, which isn't in the list below, but also OnAbilityAdded and Regulus' Maim for example uses OnPostDamage (which let's Maim apply to Snipes and Heaven's Wrath, too). So I assume these are functional, even though I haven't tested them and ForgeUnit just defines them as "= Callback()", not sure how that works.

OnKilled
OnKilledUnit
OnCaptured
OnCapturedNewUnit
OnStartCapture
OnTransferred
OnPostDamage
OnPreDamage
OnCriticalHit
OnWeaponFire
OnTakeDamage
OnMotionHorzEventChange
OnBuffActivate
OnBuffDeactivate
OnStartBuild
OnAbilityBeginCast
OnStunned
OnFrozen
OnFinishCasting
OnAbilityAdded
OnAbilityRemoved

#------------------

Below are unit categories, which are used to select certain sets of units like for example in unit:GetAIBrain():GetCurrentUnits(categories.MINOCAPTAIN), ArmyBrains[unit:GetArmy()]:GetListOfUnits(categories.hoakspirit, false) or the more general EntityCategoryContains(categories.NOBUFFS). Haven't tested whether case matters here.

AIR
ALLUNITS
HERO
MINION
MOBILE
NOBUFFS
STRUCTURE
UNTARGETABLE
ARCHER
ARTILLERY
GIANT
PRIEST
SOLDIER

MINOCAPTAIN
HIGHPRIEST
SIEGEARCHER

hoakspirit
hqueenent
hvampirevampire01
HOculusBLightning01(/...02/...03/...04) (Found in respective ...Script.lua)
HSednaYeti (Found in HSednaYeti_Script.lua)

#------------------

On stuns being applied (see ForgeUnit.lua, BuffDefinitions.lua, BuffAffects.lua):

I tried finding out whether it is possible for Symbol of Purity being cast while stunned, and I'm not sure how it's possible.

1) When stunned, ForgeUnit.OnStunned gets called, applying the buff 'StunAbilityDisable'
2) The buff 'StunAbilityDisable' uses the function DisableAbilityUse = {Bool = true}
3) DisableAbilityUse uses the function BuffCalculate to calculate the bool values of unit.Sync.AbilitiesDisabled and unit.AbilitiesDisabled
Once unit.Sync.AbilitiesDisabled and unit.AbilitiesDisabled are set to true, it seems no ability cast can be initiated.

The function CanUseAbility (see ValidateAbility.lua) is normally used to check if you can cast (Cooldown, enough Mana, Disabled, etc.). But even if it always returns true, you cannot cast while stunned. And I tried modifying DisableAbilityUse so that instead of doing 3), it loops through a DG's current abilities and sets each individual Ability Data to Disabled, unless they have a certain value set to true (like for example CannotBeDisabled). But that also didn't work and now I'm out of ideas. I'm happy about tips.

#------------------

The entire list of global functions available in Demigod (using the function from here, thanks to TheJack for pointing it out):

ActivateMusicCue
AddAnimationEvent
AddBuildRestriction
AddTowerGraph
AddTowerNode
AddUnitFlag
ArmyCanDetect
ArmyGetHandicap
ArmyInitializePrebuiltUnits
ArmyIsCivilian
ArmyIsOutOfGame
AttachBeamEntityToEntity
AttachBeamEntityToEntityFromTable
AttachBeamToEntity
AudioSetLanguage
Basename
BeginLoggingStats
BuildUnit
CODE_PurchaseItem
CODE_SellItem
ChainTower
ChangeUnitArmy
CheatsEnabled
ClearTowerDatabase
CreateAimController
CreateAnimationState
CreateAttachedBeam
CreateAttachedEmitter
CreateAttachedEmitterTable
CreateBeamEmitter
CreateBeamEmitterOnEntity
CreateBeamEntityToEntity
CreateBeamToEntityBone
CreateCamera
CreateEmitterAtBone
CreateEmitterAtEntity
CreateEmitterOnEntity
CreateEmitterPositionVector
CreateEmitterPositionVectorTable
CreateLightParticle
CreateLightParticleIntel
CreateProfileTimer
CreateProp
CreatePropHPR
CreateReconDB
CreateSlider
CreateThreatQuery
CreateTrail
CreateUnit
CreateUnit2
CreateUnitHPR
CurrentThread
DebugGetSelectionCanDesync
DesyncLog
Dirname
DiskFindFiles
DiskFindFolders
DiskGetFileInfo
DiskToLocal
DistancePoint2Segment2
DistancePoint3Segment3
DrawCircle
DrawCircleUp
DrawLine
DrawLinePop
ElapsedMilliseconds
EndGame
EndLoggingStats
EntityCategoryContains
EntityCategoryEmpty
EntityCategoryFilterDown
EntityCategoryGetUnitList
EnumColorNames
EulerToQuaternion
FileCollapsePath
FilterEntitiesCloserThan
FilterEntitiesFurtherThan
FilterEntitiesMovingAway
FilterEntitiesNotMovingAway
FilterUnitsByArmy
FindSpotAroundCircleToOccupy
FindSpotAroundRingToOccupy
FindSpotToOccupy
FlattenMapRect
ForkThread
ForwardVector
GenerateRandomOrientation
GetAlliance
GetArmyBrain
GetArmyColor
GetArmyUnitCap
GetArmyUnitCostTotal
GetBlueprint
GetBranch
GetCurrentCommandSource
GetEntitiesInBox
GetEntitiesInCylinder
GetEntitiesInOBB
GetEntitiesInRect
GetEntitiesInSphere
GetEntitiesInSweptSphere
GetEntityById
GetFocusArmy
GetGameTick
GetGameTimeSeconds
GetGrannyAnimationResource
GetGrannyMeshResource
GetMapSize
GetMovieDuration
GetProfileTimeSeconds
GetPropsInRect
GetShields
GetSurfaceHeight
GetTerrainHeight
GetTerrainType
GetTerrainTypeOffset
GetTextureResource
GetUnitBlueprintByName
GetUnitById
GetUnitsInArea
GetUnitsInRect
GetVersion
GrannyCache
HasLocalizedVO
InitializeArmyAI
IsAlly
IsBadSpot
IsBlip
IsCollisionBeam
IsCommandDone
IsDestroyed
IsEnemy
IsEntity
IsGameOver
IsNeutral
IsProjectile
IsProp
IsRetail
IsUnit
IssueAggressiveMove
IssueAttack
IssueClearCommands
IssueClearFactoryCommands
IssueDestroySelf
IssueFactoryRallyPoint
IssueGuard
IssueKillSelf
IssueMove
IssueMoveOffFactory
IssuePatrol
IssuePause
IssueScript
IssueStop
IssueUpgrade
KillThread
LOG
LUnitMove
LUnitMoveNear
ListArmies
LuaDumpBinary
MATH_IRound
MATH_Lerp
MinLerp
MinSlerp
NotifyUpgrade
OkayToMessWithArmy
OrientFromDir
ParseEntityCategory
PointInSphere
PointVector
PurchaseSkill
PurchaseUpgrade
QRotate
Quaternion
Random
Rect
RemoveBuildRestriction
RemoveTowerGraph
RemoveTowerNode
ResumeThread
SPEW
STR_GetTokens
STR_Utf8Len
STR_Utf8SubString
STR_itox
STR_xtoi
SecondsPerTick
SelectedUnit
SetAlliance
SetAllianceOneWay
SetAlliedArmyColor
SetAlliedVictory
SetAmbientReverb
SetArmyColor
SetArmyFactionIndex
SetArmyOutOfGame
SetArmyPlans
SetArmyShowScore
SetArmyStatsSyncArmy
SetArmyUnitCap
SetAudioParameter
SetIgnoreArmyUnitCap
SetOccupyGround
SetTeamArmyName
SetTerrainType
SetTerrainTypeRect
SimConExecute
SortEntitiesByDistanceXZ
SortEntitiesByHealth
Sound
Sphere
SplitProp
StatSetFloat
StatSetInt
SubmitXMLArmyStats
SuspendCurrentThread
TestOccupy
TestRelease
TickStatAdd
TickStatAddFloat
TickStatAddInt
TickStatSetFloat
TickStatSetInt
Trace
TryCopyPose
UpdateTowerNode
VAdd
VCross
VDiff
VDist2
VDist2Sq
VDist3
VDist3Sq
VDist3XZ
VDist3XZSq
VDot
VEquals
VLength
VLengthSq
VLengthXZ
VLengthXZSq
VMult
VNormal
VPerpDot
VRotateX
VRotateY
VRotateZ
VSetMagnitude
Vector
Vector2
WARN
WaitFor
WaitTicks
Warp
_ALERT
_TRACEBACK
__pow
_c_CreateEntity
_c_CreateShield
assert
collectgarbage
dofile
error
exists
gcinfo
getfenv
getmetatable
ipairs
loadfile
loadlib
loadstring
newproxy
next
pairs
pcall
print
rawequal
rawget
rawset
require
setfenv
setmetatable
tonumber
tostring
type
unpack

Reply #2 Top

So if we actually want to discuss specific mods and perhaps even work together on them, how should we do this? I guess talking about the content, goals and balancing of mods can be done here on the forums, in the specific threads. But to actually exchange code may be something we should use github or similar for. (Then I could take this as an opportunity to finally learn how to use that...) I don't know. Thoughts?

Reply #3 Top

Yeah i was thinking about github myself. Not quite sure how well this works with binary files like textures and stuff but for the most part it should be ok.

Reply #5 Top

Quoting Soeplepel, reply 4


Reply #4 November 3, 2020 4:17:46 PM from Stardock ForumsStardock Forums

For example: https://github.com/SoepIepeI/ResetSkills Which now contains a non working mod

Well, excellent :D
I don't think you've added any comments, so at a first glance I'm not sure if you've changed anything, I'll see if I manage to compare the next days.

But if the coming weeks are like my last, I'm not sure if I'll have much time to spend on mods. I should be able to upload what I've been working on, though.

 

Btw, if anyone finds out how the syncData table works/where it is defined, please let me know.

Reply #6 Top

This is a great thread! I am going to pin it so everyone can see :)

Reply #7 Top

Quoting Schwiegerknecht, reply 5

Btw, if anyone finds out how the syncData table works/where it is defined, please let me know.


Haha i second this. Even the dev comments talk about the magic syncdata table

Reply #8 Top

Quoting SchismNavigator, reply 6

This is a great thread! I am going to pin it so everyone can see :)

That's nice. Thank you :)

And I have made a GitHub account... so I guess that's progress. Maybe next week I'll manage to upload something.