How do I add a custom promotion?

cooldude1128

Prince
Joined
Jun 6, 2012
Messages
322
I'm trying to make a custom mechanical civilization as my first mod, and I came up with an idea for a trait called Mechanical Evolution, that would reduce the XP needed for a promotion as well as provide additional damage every time you attack an enemy in a row, such as:

My soldier(100) attacks Enemy(100), resulting in me(90) and them(90). The next turn, I attack them again, but this time it ends up like me(80) them(75). The next turn, 10 damage is added, and the turn after that, 20, etc etc. I haven't the slightest clue on how to make this work, though I do have all the required stuff to add the coding if I could learn how.

So in conclusion, if one of you could point me to the right hooks or give me a bit of code, or at least tell me what to do, then I'd be grateful.
 
I'm thinking of a way to make this without involving a somewhat complex code, but I can't think of any.

The game will have to capture each time one of your units of a given type attacks (easy); then it'll need to check the ID of both the attacker and the defender (easy); store both in tables (kind of easy) together with another value - number of consecutive attacks - (a bit less easy); check each time one unit present in the table performs an attack, checking if the defender is the same, then inflicting damage based on the third value.
This is done through Lua, also, not XML.

(Also, reported the thread to be moved since this is the wrong place to post questions)
 
I'm thinking of a way to make this without involving a somewhat complex code, but I can't think of any.

The game will have to capture each time one of your units of a given type attacks (easy); then it'll need to check the ID of both the attacker and the defender (easy); store both in tables (kind of easy) together with another value - number of consecutive attacks - (a bit less easy); check each time one unit present in the table performs an attack, checking if the defender is the same, then inflicting damage based on the third value.
This is done through Lua, also, not XML.

(Also, reported the thread to be moved since this is the wrong place to post questions)

Oh, sorry. I thought this was the right forum.

Also, I don't know anything about Lua, mostly just a little XML.
 
Moderator Action: As bane_ mentioned, this is the wrong place to post questions, as it's for completed modding tutorials and reference guides only. All questions and requests for help should go in the main Creation and Customisation forum; I've moved this thread there.
Please read the forum rules: http://forums.civfanatics.com/showthread.php?t=422889
 
So, can anybody tell me what I need to write in order to add this, or help me learn what I need to in order to code this, or should I just try to come up with something different?
 
Do you know how to add the promotion? Like with the XML art of it?

I could copy an original promotion's code and edit it so that it would work, all I need is the lua code or somebody who can teach me how to program it for myself.
 
You can use the manuals as a 'tutorial', but I don't think that is a good first step. I'm modding with Lua since February and I'm only starting to read the manuals right now and I really think that I wouldn't understand half of it if I tried back then.
Take a look at other mods, start with the simple ones, get familiar with the naming conventions (hooks, methods, functions, etc) and ask questions when you can't find the answer by yourself.
This website has almost every Methods and Events available for Civ5, with many of the arguments explained or exemplified.
 
You can use the manuals as a 'tutorial', but I don't think that is a good first step. I'm modding with Lua since February and I'm only starting to read the manuals right now and I really think that I wouldn't understand half of it if I tried back then.
Take a look at other mods, start with the simple ones, get familiar with the naming conventions (hooks, methods, functions, etc) and ask questions when you can't find the answer by yourself.
This website has almost every Methods and Events available for Civ5, with many of the arguments explained or exemplified.

Thank you. I'll look into that.
 
Top Bottom