This can likely all be done in two files: Blueprints.lua and globalInit.lua.
Hooking ModBlueprints in Blueprints.lua will let you make batch changes to all unit, projectile, and emitter blueprints to make them proportionally smaller.
Hooking globalInit.lua will let you iterate _G.Characters (the global table containing all character blueprints) after they've all been loaded, again making the same proportional changes to all of them.
First you have to know how to create a mod - find your mod directory, e.g. \Demigod\bindata\mods, and create an empty folder in there with the name of your mod, e.g. 'Mini'. Then you have to create a mod_info.lua file in that folder - by far the easiest way to do this is to copy one from someone else's mod, and change the name, version, and UID. Just change a few numbers in the UID if you don't know how to generate a new one.
Then create an empty directory inside your mod folder called 'hook', in lowercase. This is where you'll put changed files that get 'hooked' or joined with existing files in dgdata.zip. Once you have some files in here (which I'll get to in a second), you'll have to enable the mod in the Mod Manager in the game's main menu.
Here's what you'd put into a blank \hook\lua\system\Blueprints.lua (careful, that whole path and filename are case-sensitive!) to let you non-destructively change all unit/projectile/etc blueprints, in this example, to halve the footprint size, speed, and weapon range of all units:
Code: c++
- local MB = ModBlueprints
- function ModBlueprints(all_bps)
- MB(all_bps)
- local scaleMod = 0.5
- for bpid, bp in all_bps.Unit do
- if bp.Footprint then
- bp.Footprint.SizeX = bp.Footprint.SizeX * scaleMod
- bp.Footprint.SizeZ = bp.Footprint.SizeZ * scaleMod
- end
- if bp.Physics then
- bp.Physics.MaxSpeed = bp.Physics.MaxSpeed * scaleMod
- end
- if bp.Weapon then
- for k, weapbp in bp.Weapon do
- if weapbp.MaxRadius and weapbp.MaxRadius > 0 then
- weapbp.MaxRadius = weapbp.MaxRadius * scaleMod
- end
- end
- end
- end
- end
This can be used to re-scale any variable in all unit blueprints - just make sure you check for the presence of the table you're modifying things in, like I did for Physics and Footprint, as not every single unit may have these. You can also modify projectile sizes and emitter curves like this, by iterating through all_bps.Projectile and all_bps.Emitter, all_bps.TrailEmitter, and all_bps.Beam respectively. Look at an emitter blueprint to see what values you'd have to change to make them smaller.
To do the same thing with draw scale in character blueprints, add a blank \hook\lua\globalInit.lua, and iterate character blueprints like so:
Code: c++
- local scaleMod = 0.5
- for id, bp in Characters do
- if bp.DrawScales then
- for k, scale in bp.DrawScales do
- scale = scale * scaleMod
- end
- end
- end
Make sure you click Quote on this post and copy the code out of the edit window, otherwise it will have a bunch of numbers in front of it and won't work correctly. Also make sure you're running a log - add this to your demigod commandline:
/log "c:\demigod_log.txt"
You can change the path if you'd like the log file to go somewhere else. If you have problems with any of this (or with any modding at all), refer to the warnings that pop up in the log. If you don't know how to fix them, then post the log to www.pastebin.com and link it here, and we can help you out.