IsUnitValid(id)

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

IsUnitValid(id)

Post by enric »

returns 0 if a unit is dead/hidden/inactive (loaded, etc). 1 otherwise

What exactly means "hidden" in this case?, and the "etc" can be more explicit.
pipfromslitherine
Site Admin
Site Admin
Posts: 9863
Joined: Wed Mar 23, 2005 10:35 pm

Re: IsUnitValid(id)

Post by pipfromslitherine »

I think that basically is talking about if the unit has been removed from the map.

Cheers

Pip
follow me on Twitter here
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: IsUnitValid(id)

Post by enric »

It's because I've an odd bug and thought it could come from this functions.
I loop on all units of a side
if (IsUnitValid(id)==0) // is loaded maybe?
{
transport = GetLoadedOn(id);
if (transport != -1)
{
distance = GetDistanceBetween(me, transport);
}

Probably I'm confused and the issue is in another place.
Post Reply

Return to “Battle Academy 2: Modders Corner”