Stuck with GetTileLOS

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
rf900
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 339
Joined: Fri May 04, 2012 6:59 am

Stuck with GetTileLOS

Post 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?
pipfromslitherine
Site Admin
Site Admin
Posts: 9863
Joined: Wed Mar 23, 2005 10:35 pm

Re: Stuck with GetTileLOS

Post 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
AndrewGardner
Slitherine
Slitherine
Posts: 535
Joined: Tue Nov 13, 2012 6:24 pm

Re: Stuck with GetTileLOS

Post by AndrewGardner »

LOS is not calculated until after StartTurnPost, so GetTileLOS will always return 0 during the StartTurn functions.
rf900
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 339
Joined: Fri May 04, 2012 6:59 am

Re: Stuck with GetTileLOS

Post 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.
pipfromslitherine
Site Admin
Site Admin
Posts: 9863
Joined: Wed Mar 23, 2005 10:35 pm

Re: Stuck with GetTileLOS

Post 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
Post Reply

Return to “Battle Academy : Modders Corner ”