AzraelZephyrian
Chieftain
- Joined
- Apr 11, 2019
- Messages
- 73
Sooo. I've been trying to set up a lua script to give a unit as many attacks as there are adjacent units (for a "war wagon", basically a mobile fort). My code compiles fine. I've tried for loops setting "isoutofattacks" to false for a given number of attacks, setting "blitzcount" to a custom value, and setting "isblitz" to true.
Nothing works. Do I have to figure out .dll modification if I want to do this? Is there any workaround anyone can think of?
Here's the current code (wherein I attempted to set the blitzcountt)
Nothing works. Do I have to figure out .dll modification if I want to do this? Is there any workaround anyone can think of?
Here's the current code (wherein I attempted to set the blitzcountt)
Spoiler :
Code:
function CallPolyPttack(iUnit)
local bCanPoly = iUnit:GetIsCombatUnit()
local bIsHigh = iUnit:GetIsSelected()
if bCanPoly == true
and bIsHigh == true then
local iExtraAttacks = iUnit:GetNumEnemyUnitsAdjacent()
if (not iExtraAttacks() == 0) then
local iBlitzStock = iUnit:GetBlitzCount()
local iBlitzTot = iBlitzStock() + iExtraAttacks()
iUnit:SetBlitzCount(iBlitzTot())
iUnit:SetMoves(iBlitzTot())
end
end
end
GameEvents.PreGamestart.Add(CallPolyAttack)
Events.SerialEventHexHighlight.Add(CallPolyAttack)
--Also tried this--
function CallPolyPttack(iUnit)
local bCanPoly = iUnit:GetIsCombatUnit()
local bIsHigh = iUnit:GetIsSelected()
if bCanPoly == true
and bIsHigh == true then
local iExtraAttacks = iUnit:GetNumEnemyUnitsAdjacent()
local iTiles = iUnit:GetMoves()
local iTotalAttacks = iExtraAttacks() + iTiles()
if (not iExtraAttacks() == 0) then
for i=iTotalAttacks(),0,-1
do
iUnit:SetMadeAttack(false)
while iUnit:GetMadeAttack() == true
do
local iTimesink = 1 + 1
end
end
end
end
end
GameEvents.PreGamestart.Add(CallPolyAttack)
Events.SerialEventHexHighlight.Add(CallPolyAttack)
Last edited: