Page 1 of 1

Stuck with GetTileLOS

Posted: Thu Apr 04, 2013 3:18 pm
by rf900
Hi

I was trying to use this function CountUnitsArea and was not working, so I dig deeper to GetTileLOS, and it is always returning 0

I know for sure that units from side 0 can see that tile, and the ones from side 1 the other one.

GetTileLOS(29, 40, 0);
GetTileLOS(22, 34, 1);

Note: I have changed sides so player controls Germans units, but still is side 0, could that be it?

Re: Stuck with GetTileLOS

Posted: Thu Apr 04, 2013 3:45 pm
by pipfromslitherine
The game would probably fall to bits if that function wasn't working, so I can only assume user error :). When are you using it? During deploy?

Cheers

Pip

Re: Stuck with GetTileLOS

Posted: Thu Apr 04, 2013 4:44 pm
by AndrewGardner
LOS is not calculated until after StartTurnPost, so GetTileLOS will always return 0 during the StartTurn functions.

Re: Stuck with GetTileLOS

Posted: Thu Apr 04, 2013 5:13 pm
by rf900
Ok, placing it on the tick function makes it work, any other place I can put it so that it checks only once per turn instead of on tick? Tried StartTurn and StartTurn post and in both it is 0 always.

Re: Stuck with GetTileLOS

Posted: Thu Apr 04, 2013 5:24 pm
by pipfromslitherine
If you want to only check once per turn, then add a check in tick of the form

if( GetTurn() == turn && GetTurnTick() == 1)

then it will only check once near the start of the turn.

Cheers

Pip