It's Finally Happened: I'm modding Civ 5

This forum is for anything that doesn't specifically have to do with Better Than Wolves
Post Reply
User avatar
TheAnarchitect
Posts: 1010
Joined: Fri Jan 13, 2012 6:21 pm
Location: St. Louis

It's Finally Happened: I'm modding Civ 5

Post by TheAnarchitect »

I just wanted to share that this is happening here, because I've had several conversations here about modding in general where I stated that I'd likely try it at some point, but hadn't found a need to yet.

Well, It's happened.

I started messing around with Mods for Civ 5 this weekend, and I found one that made an Avatar the Last Airbender scenario. It was a fairly simple mod made by a high school kid, but I liked the map, I liked the concept, and I enjoyed playing it. Unfortunately, some aspects were broken, and I had to go into the XML files to fix it. To do that, I had to download the guide to modding, and learn how to parse the XML file, and once I did that I got to thinking... Why stop there?

So yeah, I've caught the bug.
The infinitely extendable Pottery system
Real Life is an Anarchy Server.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: It's Finally Happened: I'm modding Civ 5

Post by FlowerChild »

Hehe...nice man. I think you'll have a lot of fun with it :)
User avatar
AmishGoat
Posts: 103
Joined: Thu Sep 08, 2011 4:24 pm

Re: It's Finally Happened: I'm modding Civ 5

Post by AmishGoat »

You going public with this mod? I briefly attempted modding civ5 myself, its pretty easy to get started.
Trying to destroy the you with a you is futile.
User avatar
TheAnarchitect
Posts: 1010
Joined: Fri Jan 13, 2012 6:21 pm
Location: St. Louis

Re: It's Finally Happened: I'm modding Civ 5

Post by TheAnarchitect »

Oh hell no. I've got enough trouble in my life without having an audience. This will be for me, and maybe some close friends, only.
The infinitely extendable Pottery system
Real Life is an Anarchy Server.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: It's Finally Happened: I'm modding Civ 5

Post by FlowerChild »

TheAnarchitect wrote:I've got enough trouble in my life without having an audience.
Amen brother :)

It's become a habit for me now so I'm fairly used to it, but man, nothing has the potential to suck the joy out of modding like community interaction.
Rianaru
Posts: 760
Joined: Wed Jul 11, 2012 1:01 pm

Re: It's Finally Happened: I'm modding Civ 5

Post by Rianaru »

I understand if you don't want to, but would you be willing to share what you've changed with the mod? I'm just interesting in how an Avatar mod would be implemented, not asking for a download or anything :)
FlowerChild wrote: -----

A short while later:

FlowerChild: What is this pussy shit?
User avatar
TheAnarchitect
Posts: 1010
Joined: Fri Jan 13, 2012 6:21 pm
Location: St. Louis

Re: It's Finally Happened: I'm modding Civ 5

Post by TheAnarchitect »

Give me a few weeks. I'm not gonna share anything unless I think it's Rock Solid, and I'm not hurrying with it. Right now I've got 3 out of 4 nations working as intended, but I have to do some major coding on the 4th to work around a hard-coded issue in the game. Then I have to play it myself, several times on each nation, to refine it.

And I just bought Banished, so....

I'll post a "Yay I'm done" here when it happens.
The infinitely extendable Pottery system
Real Life is an Anarchy Server.
User avatar
Gilberreke
Posts: 4486
Joined: Thu Jul 14, 2011 3:12 pm
Location: Belgium

Re: It's Finally Happened: I'm modding Civ 5

Post by Gilberreke »

Oh, man, I'd love a proper Avatar game. With all the cool bending techniques too (sand, metal, swamp, blood, etc).

One of my favorite franchises of all time.
Come join us at Vioki's Discord! discord.gg/fhMK5kx
User avatar
TheAnarchitect
Posts: 1010
Joined: Fri Jan 13, 2012 6:21 pm
Location: St. Louis

Re: It's Finally Happened: I'm modding Civ 5

Post by TheAnarchitect »

OH my fucking GOD I am so frustrated.

I cannot post to the Civfanatics Mod forums to ask questions. I'm registered, but "I don't have permission to post." There is ZERO indication of what I have to do to gain permission. There is a small line in the registration saying that new members are restricted from certain things, notably PMs, until they've been around 5 days and have 5 posts. But I cannot get 5 posts if I cannot post at all. I have nothing I need to talk about on the general forums, and I really don't want to shitpost just to artificially inflate a post count. ARGG.

I don't suppose anyone here would be willing to help a total Newb with with a little LUA logic?
The infinitely extendable Pottery system
Real Life is an Anarchy Server.
User avatar
thekyz
Posts: 266
Joined: Wed Jul 20, 2011 5:52 am
Location: Rennes, France

Re: It's Finally Happened: I'm modding Civ 5

Post by thekyz »

Shoot, I see if i can answer (and if i can't maybe somebody else will :p ).
Mason11987
Posts: 1159
Joined: Wed Jul 06, 2011 11:03 am

Re: It's Finally Happened: I'm modding Civ 5

Post by Mason11987 »

TheAnarchitect wrote:OH my fucking GOD I am so frustrated.

I cannot post to the Civfanatics Mod forums to ask questions. I'm registered, but "I don't have permission to post." There is ZERO indication of what I have to do to gain permission. There is a small line in the registration saying that new members are restricted from certain things, notably PMs, until they've been around 5 days and have 5 posts. But I cannot get 5 posts if I cannot post at all. I have nothing I need to talk about on the general forums, and I really don't want to shitpost just to artificially inflate a post count. ARGG.

I don't suppose anyone here would be willing to help a total Newb with with a little LUA logic?
I have an apparently functional civfanatics account (made in 2005, lol), so I'd be willing to post/PM on your behalf if you can't get past that lock.
User avatar
TheAnarchitect
Posts: 1010
Joined: Fri Jan 13, 2012 6:21 pm
Location: St. Louis

Re: It's Finally Happened: I'm modding Civ 5

Post by TheAnarchitect »

Thank you all kindly.

Basically, what I'm trying to accomplish is creating a promotion that allows the unit to build roads and forts. Like the Roman legion UU, except I want it to carry over when the unit is upgraded. This is going to be part of the Earthbender UU.

The problem is, the XML tables have a "Unitbuild" entry that let me specify what units can build what improvements. It does not have a "Promotionbuild" entry that lets promotions do the same thing. So I can't do this with XML alone. I'm going to have to use LUA.

By the Modiki, it looks like there is a function that can be called in LUA:

CanBuild(Plot plot, BuildActionType build, bool testVisible = false, bool testGold = true)

That does what I'm looking for. So I think I need a snippet of LUA code that does something like

IF (promotion = Earthbender) THEN (CanBuild (Road) = TRUE), (CanBuild (Fort) = TRUE)

But I simply don't have any coding experience, and don't know how to translate that into LUA code.
Rather than have someone just toss together a LUA script for me, I'd like to get a lesson on how to write such a script myself.
The infinitely extendable Pottery system
Real Life is an Anarchy Server.
Mason11987
Posts: 1159
Joined: Wed Jul 06, 2011 11:03 am

Re: It's Finally Happened: I'm modding Civ 5

Post by Mason11987 »

Is it just that you want two separate functions be called if a condition is met?

If so, from what I understand you can go with:

Code: Select all

if condition then
      functioncall()
      functioncall()
end

but it looks like CanBuild is not something that's set, it's something that's returned when you supply a type of build and a plot to check, so it's possible this isn't the way to go for you.
User avatar
TheAnarchitect
Posts: 1010
Joined: Fri Jan 13, 2012 6:21 pm
Location: St. Louis

Re: It's Finally Happened: I'm modding Civ 5

Post by TheAnarchitect »

Yeah, that's pretty much what I want. So you think CanBuild is a query, not a command?
The infinitely extendable Pottery system
Real Life is an Anarchy Server.
Mason11987
Posts: 1159
Joined: Wed Jul 06, 2011 11:03 am

Re: It's Finally Happened: I'm modding Civ 5

Post by Mason11987 »

TheAnarchitect wrote:Yeah, that's pretty much what I want. So you think CanBuild is a query, not a command?
I haven't modded ELI5 and there isn't really much documentation. But it takes a plot, and returns a boolean. To me that function reads as:

Considering this unit, can it build on this plot this specific type of building.

I can't see how this can be used to give a unit a right to build something when it requires a plot parameter.

you might need to dig into the SDK for this. I suspect there is some way to grant the same road building ability to the unit when it's promoted.

Again though, this is all speculation of course. Is there a vanilla unit that does something like what you want to do? I remember there are some that keep abilities after they are upgraded, look to them to see how it's done.
User avatar
TheAnarchitect
Posts: 1010
Joined: Fri Jan 13, 2012 6:21 pm
Location: St. Louis

Re: It's Finally Happened: I'm modding Civ 5

Post by TheAnarchitect »

By default there isn't. There is a way to grant the ability to build a road to a specific unit type, but there isn't a way by default to make a promotion that does the same thing to any unit. If it was as simple as that I wouldn't need any assistance.

But since the tag exists to do it for a unit, obviously there is some logic somewhere in the game that looks for that tag, and if it's present adds the ability to the unit. If I could copy that logic, and have it look for a promotion tag instead, then It'd do what I want. I don't know if I can mimic that logic in LUA or not.

Anyway, I think I'm coming up on my "Bang for the buck" limit. If I can't figure out a solution by this weekend, I'll abandon the idea and find some other ability to give earthbenders.
The infinitely extendable Pottery system
Real Life is an Anarchy Server.
Post Reply