Uighur_Caesar
Comandante en Jefe
Ok so I'm trying to make a UA and I'm having some trouble. The first half of the UA is this "Gain Gold upon constructing naval units and workboats." I kind of have an idea of how to do it but could use some help. Here's what I currently have:
Right now I'm using 100 because I haven't come up with an exact equation for the amount of gold gained. I'm planning to make it a fraction of the unit's production cost so that it scales naturally. I don't think that will be hard to do, I just need to know what I'm doing wrong on the first part. Right now when I test it the player doesn't get any gold. I looked at the lua logs and it said that there's an error on the line that says:
It says it expects a "then" near the "=" even though I have a "then" on that line. There's probably more errors than just that so if anyone could help me out I would really appreciate it.
Code:
local UlsterID = GameInfoTypes["CIVILIZATION_ULSTER"]
function GoldFromNavy(playerID, cityID, unitID)
local player = Players[playerID];
if (player:IsAlive() and player:GetCivilizationType() == UlsterID) then
local unit = player:GetUnitByID(unitID)
local domain = unit:GetUnitCombatType()
if domain = GameInfoTypes["UNITCOMBAT_NAVAL"] then
player:ChangeGold(100)
end
end
end
end
GameEvents.CityTrained.Add(GoldFromNavy)
Right now I'm using 100 because I haven't come up with an exact equation for the amount of gold gained. I'm planning to make it a fraction of the unit's production cost so that it scales naturally. I don't think that will be hard to do, I just need to know what I'm doing wrong on the first part. Right now when I test it the player doesn't get any gold. I looked at the lua logs and it said that there's an error on the line that says:
Code:
if domain = GameInfoTypes["UNITCOMBAT_NAVAL"] then
It says it expects a "then" near the "=" even though I have a "then" on that line. There's probably more errors than just that so if anyone could help me out I would really appreciate it.