Scripts duplicate wares from code. HELP
Scripts should give me wares If I have right buildings like this
If I have one Sawmill I have 5 longbows but if I have 2 sawmills script gives me 20 longsbows instead of 10 why ?? Of course with other buildings problem is the same like this.
If I have one Sawmill I have 5 longbows but if I have 2 sawmills script gives me 20 longsbows instead of 10 why ?? Of course with other buildings problem is the same like this.
- Code:
function GiveWaresTo:integer; var A: array of integer; j, k: integer; begin for j:= 0 to 3 do begin if States.PlayerEnabled(j) and ( States.PlayerDefeated(j) = false ) then begin A:= States.PlayerGetAllHouses(j); for k:= 0 to Length(A)-1 do begin //Length(A)-1 if HouseTypeToWare(States.HouseType(A[k])) = 0 then begin Actions.GiveWeapons(j, 24, 5*States.StatHouseTypeCount(j,0)); end; // - It's here. I dont understand this. if HouseTypeToWare(States.HouseType(A[k])) = 2 then begin Actions.GiveWeapons(j, 17, 4*States.StatHouseTypeCount(j,2)); end; if HouseTypeToWare(States.HouseType(A[k])) = 5 then begin Actions.GiveWares(j, 7, 4*States.StatHouseTypeCount(j,5)); end; if HouseTypeToWare(States.HouseType(A[k])) = 7 then begin Actions.GiveWares(j, 10, 10*States.StatHouseTypeCount(j,7)); end; if HouseTypeToWare(States.HouseType(A[k])) = 10 then begin Actions.GiveWeapons(j, 19, 8*States.StatHouseTypeCount(j,10)); end; if HouseTypeToWare(States.HouseType(A[k])) = 12 then begin Actions.GiveWeapons(j, 26, 5*States.StatHouseTypeCount(j,12)); end; if HouseTypeToWare(States.HouseType(A[k])) = 15 then begin Actions.GiveWares(j, 7, 8*States.StatHouseTypeCount(j,15)); end; end;end;end; end;