bane_
Howardianism High-Priest
- Joined
- Nov 27, 2013
- Messages
- 1,559
So, the following days are crucial to my first release, and so I'll be asking a few questions. Sorry about that in advance, here it goes the first:
1Q -Hair of the Dog.
Solved! Thanks bc1 and JFD.
This code is supposed to make my units immune to the -15% Combat strength from not having the required Strategic Resource. My question is: What trigger do I set it to?
I assume that if I make it PlayerDoTurn it'll increase the unit's strength each turn, ad infinitum, which isn't the idea here.
So I went to see the Events and saw something about CombatSim, but I'm not sure how to work with it, nor if it is the right trigger.
Thoughts?
====================
2Q -Are you afraid of the Dark?
Solved! Thanks Machiavelli24 and bc1.
This is supposed to increase the worker's Work Rate by 2,5 times while a Great General UU is stacked, but also increases the total Unhappiness by 1.
The problem is that it gets into a loop, eternally increasing the Unhappiness and I don't believe it's wearing off after the worker and the GG go separate ways.
Tips?
====================
3Q - Get Away from Me!
Ok, this one is probably a bit messy but I believe it can be done.
I don't know how to use 'pairs' but I've seen some uses in mods and believe this is an UA that probably needs that. Here is what I have so far:
(it theoretically has one extra 'end' because the last 'if' has the comment '--' before it)
1Q -
Solved! Thanks bc1 and JFD.

Code:
function VenomResourceScarce(player, pMyUnit)
if (pMyUnit ~= nil) and player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_ORDERVENOM"] then
local player = Players[playerID];
local pMyUnit = Unit:GetOwner();
local iStrength = GameInfo.Units[pUnit:GetUnitType()].Combat
local iModifier = pMyUnit:GetStrategicResourceCombatPenalty()
if pMyUnit == GameInfoTypes["CIVILIZATION_ORDERVENOM"] then
if (iModifier == 2) then
pUnit:SetBaseCombatStrength(iStrength + math.floor(0.30 * (GameInfo.Units[pUnit:GetUnitType()].Combat) *100))
elseif (iModifier == 1) then
pUnit:SetBaseCombatStrength(iStrength + math.floor(0.15 * (GameInfo.Units[pUnit:GetUnitType()].Combat) *100))
end
end
end
end
This code is supposed to make my units immune to the -15% Combat strength from not having the required Strategic Resource. My question is: What trigger do I set it to?
I assume that if I make it PlayerDoTurn it'll increase the unit's strength each turn, ad infinitum, which isn't the idea here.
So I went to see the Events and saw something about CombatSim, but I'm not sure how to work with it, nor if it is the right trigger.
Thoughts?
====================
2Q -
Solved! Thanks Machiavelli24 and bc1.

Code:
print('Venom Fear on Worker is on')
function VenomFearWorker(playerID, pMyUnit, pPlayer)
if (pMyUnit ~= nil) and player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_ORDERVENOM"] then
local pPlayer = Players[playerID];
local iMyPlayer = pMyUnit:GetOwner();
local iTotalUnhappiness = pPlayer:GetUnhappiness();
local iTotalHappiness = pPlayer:Gethappiness()
if (pMyUnit:GetUnitAIType() == GameInfoTypes["UNIT_WORKER"]) then
if (pMyUnit:IsStackedGreatGeneral()) then
pMyUnit:workRate(250)
Player.SetHappiness((iTotalHappiness - iTotalUnhappiness) - 1)
end
end
end
end
GameEvents.PlayerDoTurn.Add(VenomFearWorker)
This is supposed to increase the worker's Work Rate by 2,5 times while a Great General UU is stacked, but also increases the total Unhappiness by 1.
The problem is that it gets into a loop, eternally increasing the Unhappiness and I don't believe it's wearing off after the worker and the GG go separate ways.
Tips?
====================
3Q - Get Away from Me!
Ok, this one is probably a bit messy but I believe it can be done.
I don't know how to use 'pairs' but I've seen some uses in mods and believe this is an UA that probably needs that. Here is what I have so far:
Code:
function SinisterCitadelPush(playerID, CityID, iHex)
local player = Players[playerID]
local pcap = player:GetCapitalCity()
if (player:IsEverAlive()) and player:isNotMinor then
if (pcap:IsHasBuilding(GameInfoTypes["BUILDING_SPIDERPALACE"])) then -- must have the Spider palace (so any Spider civ is ok)
local plot = pcap:Plot()
local iHex = ToHexFromGrid( Vector2(plot:GetX(), plot:GetY()) ) -- check all adjacent plots
for Units in iHex do
for Units, in pairs do -- ??
-- check if unit is from a player at war
-- if it is, check the ring before that one (absolutely no idea)
-- move every unit capable of moving
if Unit:HasMoved
return
else
damage
end
end
end
end
end
end
end