I think this is the part of the script that adds slashing when you reach level 5.
void Level5() {
Game->PlaySound(levelSound);
Screen->Message(L5String); //This should show on-screen one time, when gaining the level, and not remain forever.
increaseHP();
increaseMP();
increaseStat(); //This should happen one time, when gaining this level, and be permanent.
Game->Generic[GEN_CANSLASH] = 1; //This should occur when gaining this level, and be permanent.
}
I was just thinking if there could be a way where it automatically generates an item in your inventory when you reach a certain level using the item ID. Is that a possibility?
You'd basically have to do something like that for every time you wanted something of this sort to happen.
Keep in mind that unless a message is set up to play in such a script, you'd just get the item without even noticing it.
It'd look very similar to what you posted above.
Something like this, maybe...
void Level10() {
Game->PlaySound(levelSound);
increaseHP();
increaseMP();
increaseStat(); //This should happen one time, when gaining this level, and be permanent.
item TradeSeqItem;
//Create the item and place it at Link's location.
TradeSeqItem = Screen->CreateItem(L_10_ITEM);//The item to give at level 10.
TradeSeqItem->X = Link->X;
TradeSeqItem->Y = Link->Y;
TradeSeqItem->Pickup |= IP_HOLDUP;
Screen->Message(L10String); //This should show on-screen one time, when gaining the level, and not remain forever.
}
You should also know that this wouldn't occur just one time.
As long as you the conditions which caused the script to run were true, they'd occur over and over again.
The best way to prevent this is to add a line like this to the script that calls the level 10 function...
if(!Link->Item[L_10_ITEM])
Placing this directly before the level 10 function will mean that will run once and only once; as long as you have the item it gives you. Don't worry too much about items that upgrade (like swords). If you have the flag in the item editor set where you "keep lower level items" then it will stay true.