Code: Select all
[h : allPCs = getPC()]
[FOREACH(pc, allPCs, "<br>"), code : {
[h : CheckBurnMods(pc)]
[h : switchToken(pc)]
[h : setState("FiringOrdersIn", 0)]
[h : setState("MovementDone", 0)]
[h : setProperty("SpeedChangeThisTurn", 0, pc)]
[h : setProperty("FiredThisTurn", 0, pc)]
[h : setProperty("FiringPenaltyForTurn", 0, pc)]
[h : airfoilBonus = 0]
[h, if(CurrentSpeed >= 60 && (Spoiler ==1 || Airdam == 1)) : airfoilBonus = 1]
[h : setProperty("CurrentHC", Sum(CurrentHC, airfoilBonus, max(1, BaseHC)), pc)]
[h : maxHC = Sum(airfoilBonus, getProperty("BaseHC"))]
[h, if(getProperty("CurrentHC", pc) > maxHC) : setProperty("CurrentHC", maxHC, pc)]
[h, if(EngineTransHit == 1), code : {
[h : BaseMaxSpeed = max(0, Sum(BaseMaxSpeed,-10))]
[h : MaxSpeed = max(0, Sum(MaxSpeed,-10))]
[h : MaxAcceleration = max(0, Sum(MaxAcceleration, -5))]
[broadcast("<b>" + getName(pc) + "</b> has a damaged transmission, so top speed is reduced down to " + CurrentSpeed + " and max acceleration drops by 5!")]
}]
[h, if(CurrentSpeed > MaxSpeed), code : {
[h : CurrentSpeed = max(MaxSpeed, Sum(CurrentSpeed,-20))]
[broadcast("<b>" + getName(pc) + "</b> is travelling over its max speed, so speed is reduced down to " + CurrentSpeed)]
}]
[h, If(EngineDP <= 0 || DriverDP <= 0) : reduceSpeed = 1; reduceSpeed = 0]
[h, if(reduceSpeed == 1 && CurrentSpeed > 0), code : {
[h : CurrentSpeed = max(0, Sum(CurrentSpeed,-20))]
[broadcast("<b>" + getName(pc) + "</b> has a destroyed engine or dead driver, so speed is reduced down to " + CurrentSpeed)]
}]
[h, if(SustainedOn == CurrentTarget && CurrentTarget != ""), code : {
[h : SustainedBonus = min(2, Sum(SustainedBonus,1))]
};
{
[h : SustainedBonus = 0]
}]
[h : CurrentTarget = ""]
[h : modInit = Sum(CurrentSpeed, (1d99/100))]
[h : setInitiative(modInit)]
}]
[h : broadcast("<b>All cars regain HC equal to their base HC!</b>")]
[h : sortInitiative()]
[h : setCurrentInitiative(0)]
[h : setInitiativeRound(1)]
[h : foundMovement = 0]
[h, while(foundMovement == 0), code : {
[h : nextInitiative()]
[h : initId = getInitiativeToken()]
[h, if(getName(initId) == "Movement") : foundMovement = 1]
}]
[h : setProperty("SpeedChangeThisTurn", 0, pc)]
[h : setProperty("FiredThisTurn", 0, pc)]
[h : setProperty("FiringPenaltyForTurn", 0, pc)]
These are not getting zero'd out for the player tokens; they are keeping their current values, whatever those are, instead.
This macro runs when all the players have signalled that they are "done" and I know its in fact running, since the broadcast messages are all coming through. Also, I can see the values being set in the logging file.
If I MANUALLY run the macro (ie, click the button), then the properties are all set correctly. Any ideas why?
Have also tried changing the "setProperty" to "resetProperty" (since 0 is what it defaults to), same thing, doesn't reset them to 0.