SetAttrib

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

SetAttrib

Post by enric »

I've the following:

shots = GetAttrib(id, "shots");
Log ("shots", shots); // this show 2

SetAttrib(id, "shots", 0);
shots = GetAttrib(id, "shots");
Log ("shots 2", shots); // this shows 0

The last log shows 0, but the unit(s) still have the two bullets and are able to fire.
I don't want to reduce the AP atribute to 0, because units will be able to move.
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: SetAttrib

Post by pipfromslitherine »

Where are you calling this? Could the start turn function for the unit be resetting its shots?

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: SetAttrib

Post by enric »

In the StartTurn

This works
SetAttrib(id, "APCharges", GetAttrib(id, "APCharges")-1 );

and also this

SetAttrib(id, "BOMBARD_SHOTS", Rand(0, 1));

but not

SetAttrib(id, "SHOTS", 0);
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: SetAttrib

Post by pipfromslitherine »

You need to use the POST function for these kind of things, because the unit StartTurn function is being called after and resetting the shots.

http://www.slitherinebravo.net/GameWiki ... rtturnpost

Cheers

Pip
Post Reply

Return to “Battle Academy : Modders Corner ”