Well, if the magic jar item refils gradually you could just spawn a magic jar on top of Link when he drinks a potion. I can't remember though.
Well, if the magic jar item refils gradually you could just spawn a magic jar on top of Link when he drinks a potion. I can't remember though.
Wait, why does it need to be that complicated? Couldn't you just make it like:
Wouldn't that work and be less complicated than your script?import "std.zh"
//This script, when attached to an item, works as a magic potion.
//It refills Link's magic, but disappears after one use.
//A simple script, but useful.
//Set D0 to be the ID of the item.
item script MagicPotion{
void run (int id){
Link->MP+=128;
Link->Item[id] = false;
}
}
Yes, but good programming habits say to make your code as general as possible, so it can be re-used.
Speaking of which, can't this be done w/o scripting (using the item editor)?
Yes, but my script works for both types of potion, and you can choose how much it'll refill.
Your script will also fill Link's MP over the max, which is never very good.
You don't really need the line to remove the item either, as there's an option in the item editor which does that.
Yeah, that's what the 'if(Link->MP > Link->MaxMP) Link->MP = Link->MaxMP;' line is for.
There are currently 1 users browsing this thread. (0 members and 1 guests)