The Forums Are Now Closed!

The content will remain as a historical reference, thank you.

How to mod?

By on July 13, 2011 10:44:23 AM from Demigod Forums Demigod Forums

Plaguewraith

Join Date 04/2011
+9

Hi!

I'm interested to learn about modding, but how can I start?

Can anyone give me a clue?

 

I played around a little bit with LORD-ORION Moba but that was just changing parameter, but how can I create own things that maybe works or learn how to create own things in existing mods maybe?

 

Thanks for any replies!

Locked Post 15 Replies
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
July 13, 2011 10:46:59 AM from Demigod Forums Demigod Forums

NT

Reason for Karma (Optional)
Successfully updated karma reason!
July 13, 2011 3:39:42 PM from Demigod Forums Demigod Forums

You should look in crazytown instead, alot of examples given by miri's edu posts are put to work in that mod.

Still this is the thread to start in.

https://forums.demigodthegame.com/376116

Reason for Karma (Optional)
Successfully updated karma reason!
July 13, 2011 4:11:26 PM from Demigod Forums Demigod Forums

Thank you for the link!

Ok, I'll will look into Crazytown. First it is maybe good just to look what is done there and understand how it works.

Oh well, the first look into excentrics post was quite irritating. Will take some time.

Reason for Karma (Optional)
Successfully updated karma reason!
July 14, 2011 1:15:04 AM from Demigod Forums Demigod Forums

Do you have a decent grasp of programming concepts in some modern language, if not lua, at least some C variant or java?  If not, start by reading some guides on programming in lua, and peruse some of the game's existing code in dgdata.zip to learn how lua is typically structured and what is and isn't valid syntax.  You'll run into a lot of problems if you start trying to mod things without a good knowledge of the language, even if it initially seems simple.

Unfortunately there aren't many good Demigod mods to learn from - most of them are old, poorly-coded, and use destructive methods.  I haven't seen LO's latest work, but I know he's been making an effort to do things properly - the same with Exxentric's FavorMod.  Other than those, the UberFix is probably the only other example of a non-destructive mod - I wish I could say it was the best, but I've had to override a bunch of things anyway due to the way GPG's ability files are structured.

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2011 4:46:26 AM from Demigod Forums Demigod Forums

Unfortunately I have no skills in some modern language.

But I will try to get some understanding and I think it's the best way just to start toying around for fun and besides try to get some informations how to use lua.

I've seen some of the commands that can be used in Excentrics post and some in Crazytown, but where do I get the names of the items and skills I do not now if I want to change existing skills or items that tdo not exist already in a mod?

I ask, because this could be a first step to do something with the things I've seen so far.

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2011 11:47:13 PM from Demigod Forums Demigod Forums

All of the original game's lua code is in dgdata.zip.  Extract that to a new folder, and you can browse and search.

You definitely need a syntax-highlighting text editor, and a tool to search a folder full of files for specific text, otherwise you'll never be able to find anything to mod, as the game's code is spread out over hundreds and hundreds of files (~30mb of raw text).  Notepad++ is a free text editor that has lua syntax highlighting - I don't know if it can also search folders, but I assume it can.

Reason for Karma (Optional)
Successfully updated karma reason!
July 16, 2011 12:23:15 AM from Demigod Forums Demigod Forums

Quoting miriyaka,
Notepad++

You want this.  Get it and give it a shot.  VERY helpful.

Reason for Karma (Optional)
Successfully updated karma reason!
July 16, 2011 3:54:45 PM from Demigod Forums Demigod Forums

Thanks!

Hope to get a closer look into N++ it tomorrow. And I also hope I don't get disappointed to early because it will cost some time and effort to learn the basic command.

I also downloaded teh lastest version of LUA. Maybe it will help. Hope to get some understanding within a month becasue vacation ends then and less spare time is available. Ok, I'll see. If I have a question I will try to ask.

Reason for Karma (Optional)
Successfully updated karma reason!
July 16, 2011 10:41:23 PM from Demigod Forums Demigod Forums

A standalone lua interpreter won't really help you for modding Demigod.  It's useful for Supreme Commander 2, because that game's error log is broken and doesn't report syntax errors, but Demigod has a fully-functional log that will always list the absolute line number of any errors.

That said, if you want to play around with some basic lua code structures using the standalone interpreter before dealing with actual game code, that would give you much quicker feedback on any errors.

Reason for Karma (Optional)
Successfully updated karma reason!
July 17, 2011 8:28:25 PM from Demigod Forums Demigod Forums

If I start playing around (and I hope to do that soon), I'd like to keep the old mods.

Can I simply change the name and the ID of the mod to do so? What else must I be aware of?

Reason for Karma (Optional)
Successfully updated karma reason!
July 18, 2011 8:43:23 AM from Demigod Forums Demigod Forums

Keep the old mods?  I don't really know what you mean.

If you're just starting out with modding, I'd recommend creating your own mod (copy an existing mod, delete all of the files except mod_info.lua, and change the name, UID, author, etc info), and first learning how to hook files and merge blueprints by looking at other mods, rather than directly modifying other mods' files.  It'll help separate in your mind exactly what you've done, and it'll make any errors produced in the log more obvious because only your code will be running.

I'd also strongly recommend running only your mod while you're debugging it, unless you're taking advantage of e.g. UberFix extension features.  It's much, much easier to debug when you know only your code and the original code are being used, and it makes the line numbers reported by the log much easier to calculate (subtract the length of the original file from the line number reported to get the line number of your hooked file that the error occurred at).

Reason for Karma (Optional)
Successfully updated karma reason!
July 18, 2011 8:50:29 AM from Demigod Forums Demigod Forums

Thanks Miriyaka!

I meant to create "my own mod" with using an existing mod. But I sure want to keep the existing mod in the mod manager and have no conflicts. But you answered my question well.

Reason for Karma (Optional)
Successfully updated karma reason!
July 19, 2011 12:42:18 PM from Demigod Forums Demigod Forums

Started playing around with Crazytown:

I added the following into HOak_Abilities.lua:

--Removing buff immunity from Shield III and Shield IV
Buffs.HOAKShield03.Affects = {
                Invincible = { Bool = true },
                DebuffImmune = { Bool = false },
                }
Buffs.HOAKShield04.Affects = {
                Invincible = { Bool = true },
                DebuffImmune = { Bool = false },
                }
--Removing debuff ability on shield I and Shield II
Buffs.HOAKShield01.OnBuffAffect = function(self, unit, instigator)
                Buff.RemoveBuffsByDebuff(unit, false)
Buffs.HOAKShield02.OnBuffAffect = function(self, unit, instigator)
                Buff.RemoveBuffsByDebuff(unit, false)

 

I assumed that from the command line:

Buffs.HOAKRally.Duration = 10

First sucess, the game started! ^^ But then... I could still invest skill points but all skill description exept morale where gone and the bar to select the skills for ussage (number 1-4) was blank (no skill icon in it). So, I could guess the "skill identification" (don't know if that's sound right) was screwed?

Regarding the way the Rally duration was changed, I thought the MOD command lines work like an overwrite but it didn't seem that easy.

Reason for Karma (Optional)
Successfully updated karma reason!
July 19, 2011 1:43:35 PM from Demigod Forums Demigod Forums

Always run the game in windowed mode with the log and log window enabled, so you can see the exact error being produced.  See this post here for details: https://forums.demigodthegame.com/399524/page/1/#2812350

Most of the code you posted is not valid lua syntax, which means that your hook isn't being parsed by the interpreter at all, and neither is the original file (resulting in the failure of the entire ability system).  Like I suggested, read up on basic programming and lua-specific syntax (or at least get really good at copying and understanding existing code) before trying to tackle something like this, or you're going to be in for quite a bit of frustration.  I'm more than happy to help with Demigod-specific issues, but I don't have the time or energy to individually teach Programming Concepts 101 to everyone that tries to start modding - I'm sure you can understand?

Reason for Karma (Optional)
Successfully updated karma reason!
July 19, 2011 3:25:40 PM from Demigod Forums Demigod Forums

Hi Miriyaka!

Thanks for the link.

Sure I can understand that and I don't expect it. I was just trying that stuff because I was curious and was amused by the effect it had. So I posted it here, of course, to get it commended. But feel free to just ignore it if you're not in the mood. Use your free time for the things you loke to do.

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #108433  walnut3   Server Load Time: 00:00:00.0000140   Page Render Time: