Posts: 3822
Joined: 16 Sep 2007, 22:00
KaM Skill Level: Skilled
ICQ: 269127056
Website: http://lewin.hodgman.id.au
Yahoo Messenger: lewinlewinhodgman
Location: Australia
Re: Problem with give house to different player.
There is no problem with the original version of the script, it doesn't matter that it keeps happening every tick. "for i:=0 to -1 do" will just skip the loop, it will not loop backwards from 0 to -1 (you need to use "for i:=0 downto -1 do" to do that).
Your script will work fine in the next version of KaM Remake. For now you could make it work by destroying the houses/units on different ticks:
- Code:
if (States.StatArmyCount(1) = 0) then begin if (States.StatHouseCount(1) = 0) then begin ludzie:= States.PlayerGetAllUnits(1); for i:=0 to (length(ludzie)-1) do begin Actions.UnitKill(ludzie[i],true); end; end; budynki:= States.PlayerGetAllHouses(1); for i:=0 to (length(budynki)-1) do begin t:= States.HouseType(budynki[i]); x:= States.HousePositionX(budynki[i]); y:= States.HousePositionY(budynki[i]); Actions.HouseDestroy(budynki[i],true); Actions.GiveHouse(0, t, x, y); end; end;
Using non-English names in scripts is a personal choice. It will make it harder for others to help you, but it's your script so it's your choice.