bane_
Howardianism High-Priest
- Joined
- Nov 27, 2013
- Messages
- 1,559
[SOLVED; SEE POST #2]
I'm trying to give units adjacent to my Great General an extra movement, but it is not working; via print I know the function is being called and that they can find the adjacent units, but pUnit:ChangeMoves(1) isn't changing the unit's movements for the turn.
I found some threads where a guy wanted to give +1 move for the AI, and there was nothing special in the code, just ChangeMoves() as well, but it worked for him.
I thought about making a dummy Promotion with an extra move and use that instead, removing the promotion after the turn ends, but it is a last resort.
The relevant snippet:
-- Hooked to PlayerDoTurn
The log:
EDIT:
Wait... It works, but the moves are still displayed as the unit's maximum in the unit panel.
Can this be fixed?
I'm trying to give units adjacent to my Great General an extra movement, but it is not working; via print I know the function is being called and that they can find the adjacent units, but pUnit:ChangeMoves(1) isn't changing the unit's movements for the turn.
I found some threads where a guy wanted to give +1 move for the AI, and there was nothing special in the code, just ChangeMoves() as well, but it worked for him.
I thought about making a dummy Promotion with an extra move and use that instead, removing the promotion after the turn ends, but it is a last resort.
The relevant snippet:
Code:
--pUnit is defined here:
[...]
for pUnit in pPlayer:Units() do
[...]
if pAdjUnit:IsHasPromotion(GameInfoTypes["PROMOTION_HIRUMA_AGILITY"]) and not pUnit:IsHasPromotion(GameInfoTypes["PROMOTION_HIRUMA_AGILITY"]) then
print("Found adjacent Hiruma Agility.")
pUnit:ChangeMoves(1)
end
The log:
Code:
[14202.658] ShreikanBonus: Looking for adjacent Hiruma Agility.
[14202.658] ShreikanBonus: Found adjacent Hiruma Agility.
EDIT:
Wait... It works, but the moves are still displayed as the unit's maximum in the unit panel.
Can this be fixed?