I also managed to modify the code where you get a different sword every level (You don't see any problems with it do you?):
That looks fine, although it means wasting items; which is mandatory in 2.50.x...
One thing that I would mention, is that you should not get into the habit of doing this:
I_HUNDRED_PIECE_SWORD += 1
...unless you need to increment more than 1.
In general, you want ++variable, unless that would damage your code logic. (See: Pre-Increment and Post-increment).
Pre-increment is faster in ZScript by 33%, so, you want to be in the habit of using it.
In 2.54, you would need only do this to accomplish the change in tile/sprites.
itemdata sword = Game->LoadItemData(I_HUNDRED_PIECE_SWORD);
sword->Power = Max((Floor(Game->Counter[CR_SWORDPART] / 10) + 1), HUNDRED_PIECE_SWORD_BASE_POWER);
sword->Sprites = new_stab_sprite;
sword->Sprites = new_slash_sprite;
sword->Tile = new_tile;
....and you would use a single item for the entire thing. Much tidier, but, that's still in alpha.
Whose script are you using, mine or Zorias? Regardless, that sounds a bit odd, as the sword itself shouldn't have any scripts attached.
Dimentio broke the universe. Yay!
You might want this:
if ( flag > 0 ) //don't run this this if the flag is set wrong -Z
for (int i = 0; i < 176; ++i) //use ++n in for loops for a 33% speed boost when incrementing the variable.
if (Screen->ComboF[i] == flag)
Screen->ComboF[i] = CF_SWORD1;
//can't break here, because this is doing it without checking collision, which is fine.
if (Screen->ComboI[i] == flag)
Screen->ComboI[i] = CF_SWORD1;
//I have no idea why a flag of 0 would set ComboD here. :/ -Z
Please send a copy of the quest where the combos were being set to blank data, to me, so that I can check for ZC bugs. That certainly sounds like a problem that I will need to fix. You can send it by PM, or on Discord/Skype. (My username is the same for all three.)
Instead of the if statement to check if the flag is a legal value, I would make a default flag value:
const int HUNDRED_PIECE_SWORD_FLAG = 102; //Script 5
Then, in the ffc script, add a small sanity check:
ffc script sword_power_triggers
void run(int power, int flag)
if ( flag < 1 ) flag = HUNDRED_PIECE_SWORD_FLAG;
That is a much cleaner way to do this, and it makes it easier to set up the ffcs over time.
It also eliminates the need for an if ( flag > 0 ) check, and you do not want that check if you do a sanity check on the flag value first, which means that the script will run faster, and be more reliable:
Redundant statements will slow it down. The single check need only run one time, versus a statement that is running every frame.