Page 1 of 1

How fix Invalid parameter(s) passed to States.HouseDestroyed

PostPosted: 19 Mar 2017, 13:20
by Emotion 98.3
Hi,

How i can fix this code?
  Code:
procedure OnTick; //FOG REVEAL CIRCLE begin If States.HouseDestroyed(States.HouseAt(120, 162)) then //Team 3 Barrack location is x120, y162 begin Actions.FogRevealCircle(0, 122, 167, 30); //PlayerId, LocationX, LocationY, Radius Actions.FogRevealCircle(1, 122, 167, 30); //PlayerId, LocationX, LocationY, Radius end; end;
download/file.php?mode=view&id=3361

Re: How fix Invalid parameter(s) passed to States.HouseDestr

PostPosted: 19 Mar 2017, 16:12
by Esthlos
  Code:
procedure OnTick; //FOG REVEAL CIRCLE begin If States.HouseAt(120, 162) < 0 then //Team 3 Barrack location is x120, y162 begin Actions.FogRevealCircle(0, 122, 167, 30); //PlayerId, LocationX, LocationY, Radius Actions.FogRevealCircle(1, 122, 167, 30); //PlayerId, LocationX, LocationY, Radius end; end;
States.HouseAt returns -1 if there's no house there - and if it's destroyed, then it's not there.

(Though I'd have used OnHouseDestroyed instead in this case... OnTick means it will be done 10 times per second after the barracks is destroyed, which is quite cpu intensive)
  Code:
procedure OnHouseDestroyed(aHouse: Integer; aDestroyerIndex: Integer); //FOG REVEAL CIRCLE begin If (States.HousePositionX(aHouse) = 120) AND (States.HousePositionY(aHouse) = 162) then //Team 3 Barrack location is x120, y162 begin Actions.FogRevealCircle(0, 122, 167, 30); //PlayerId, LocationX, LocationY, Radius Actions.FogRevealCircle(1, 122, 167, 30); //PlayerId, LocationX, LocationY, Radius end; end;

Re: How fix Invalid parameter(s) passed to States.HouseDestr

PostPosted: 19 Mar 2017, 17:54
by Emotion 98.3
  Code:
procedure OnTick; //FOG REVEAL CIRCLE begin If States.HouseAt(120, 162) < 0 then //Team 3 Barrack location is x120, y162 begin Actions.FogRevealCircle(0, 122, 167, 30); //PlayerId, LocationX, LocationY, Radius Actions.FogRevealCircle(1, 122, 167, 30); //PlayerId, LocationX, LocationY, Radius end; end;
States.HouseAt returns -1 if there's no house there - and if it's destroyed, then it's not there.

(Though I'd have used OnHouseDestroyed instead in this case... OnTick means it will be done 10 times per second after the barracks is destroyed, which is quite cpu intensive)
  Code:
procedure OnHouseDestroyed(aHouse: Integer; aDestroyerIndex: Integer); //FOG REVEAL CIRCLE begin If (States.HousePositionX(aHouse) = 120) AND (States.HousePositionY(aHouse) = 162) then //Team 3 Barrack location is x120, y162 begin Actions.FogRevealCircle(0, 122, 167, 30); //PlayerId, LocationX, LocationY, Radius Actions.FogRevealCircle(1, 122, 167, 30); //PlayerId, LocationX, LocationY, Radius end; end;

Thank you very much! It worked now :)