Page 1 of 1

SetAttrib

Posted: Mon Oct 22, 2012 10:28 am
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.

Re: SetAttrib

Posted: Mon Oct 22, 2012 3:16 pm
by pipfromslitherine
Where are you calling this? Could the start turn function for the unit be resetting its shots?

Cheers

Pip

Re: SetAttrib

Posted: Mon Oct 22, 2012 3:28 pm
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);

Re: SetAttrib

Posted: Mon Oct 22, 2012 6:02 pm
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