BaseAttribute

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

BaseAttribute

Post by enric »

Can the base attribute for a specific unit be changed dynamically?

For example, I've several 37mm on the map but I want some of them be immobile (can not be carried).
I see that setting:

SetAttrib(id, "CanBeCarried", 0)

doesn't work because the LOAD file use the BaseAttribute, and there is not a SetBaseAttribute function.

I know I can modify the LOAD file, or duplicate the unit in the Squads file changing the base value, but a dynamically way will be preferred.
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: BaseAttribute

Post by pipfromslitherine »

Hmmm - no, there isn't really any way to do this. It's designed that way - to allow you to alter the base attrib would defeat its purpose.

Cheers

Pip
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: BaseAttribute

Post by enric »

The thing it's not clear for me is, why LOAD uses:

canBeCarried = GetBaseAttrib(me, "CanBeCarried") ;

and not

canBeCarried = GetAttrib(me, "CanBeCarried") ;

In fact, I checked all actions scripts and usually the attribute current value is used, the base attribute is usually used to compare:
if ( GetAttrib(me, "AP") >= GetBaseAttrib (me, "AP")

As it's as simple as that, I simple modify this line and everything goes ok, but I'll like to know if I'm missing something to avoid issues later.
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: BaseAttribute

Post by pipfromslitherine »

Hmmm - that's a fair point. We can pretty easily fix that for the next update. I can't think of any reason why that would use the base attrib, unless it is somehow set elsewhere in a temporary way, which it doesn't seem to be from a quick search. I will check with Iain and then replace all the Base occurances with normal calls.

Cheers

Pip
Post Reply

Return to “Battle Academy : Modders Corner ”