Post 22 Mar 2018, 07:45 by Esthlos
Thanks for help:)
Now I want to do:You need 300 gold
And in msg write how much missing to 300 gold.
it will be better if you explain it to me.
procedure OnTick;
var
iPlayer: Byte;
iGoldMissing, i: Integer;
aHouses: array of Integer;
begin
iPlayer := 0; //What player is this for; it's always 1 less than the in-game number (example: "0" here is player 1)
//Get the Gold count
aHouses := States.PlayerGetAllHouses(iPlayer);
iGoldMissing := 300; //300 is the target quantity
for i := 0 to Length(aHouses)-1 do if States.HouseType(aHouses) = 11 then //Storehouses only
iGoldMissing := iGoldMissing-States.HouseResourceAmount(aHouses, 7);
//Make sure that it doesn't go negative when the player has more than the target quantity
if iGoldMissing < 0 then iGoldMissing := 0;
//Let's now add the text; use OverlayTextAppendFormatted if you're adding a new line instead of refreshing the whole text
Actions.OverlayTextSetFormatted(iPlayer, '%s : %s Gold missing', [States.PlayerName(iPlayer), IntToStr(iGoldMissing)]);
end;
Just when you think you know something, you have to look at it in another way, even though it may seem silly or wrong. You must try! - John Keating, "Dead Poets Society"