I'm posting this here because I'm pretty sure this can't be done without scripting.
I want to have seperate potions for HP and MP. I know I can edit the normal potions to refill HP only, but can I make a custom item to refill MP?
I'm posting this here because I'm pretty sure this can't be done without scripting.
I want to have seperate potions for HP and MP. I know I can edit the normal potions to refill HP only, but can I make a custom item to refill MP?
Sure you can. It would be a very simple script. I might try to right it. I'll see if I can.
Edit:
I haven't tested it, but it compiles fine.Code: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=Link->MaxMP; Link->Item[id] = false; } }
It works~
Though… I forgot to specify that I only want it to refill 128MP, not 100%.
EDIT: Blerrblerrblehgh.
Urm....
When you pick up a magic jar item, does your HP increase steadily or instantly?
If it's steadily, then this script wouldn't be very hard to do.
If it's instantly then you'd have to add a section to the global script which is a bit of a pain really.
Ya' know, that part's not important. Forget the gradual refill. What I really need if for the potion to fill 128 MP instead of the maximum. Also, how would I change this to work for HP, so I can make custom health potions as well?
D1: Amount to refilCode:item script CustomPotion{ void run(int refil,int counter){ if(counter == 0){ Link->MP += refil; if(Link->MP > Link->MaxMP) Link->MP = Link->MaxMP; }else{ Link->HP += refil; if(Link->HP > Link->MaxHP) Link->HP = Link->MaxHP; } } }
D2: 1 to refil hearts, 0 to refil magic
To take the item away after useage, there's a little checkbox somewhere in the item editor.
No, it's actually quite easy to do.
Code:void Refill(){ int hp = Link->MaxHP-Link->HP; for(int i;i<mp;i++){ Link->HP++; Game->PlaySound(SFX_REFILL); Waitframe(); } } void RefillMagic(){ int mp = Link->MaxMP-Link->MP; for(int i;i<hp;i++){ Link->MP++; if(Link->MP < Link->MaxMP){ Link->MP++;i++; } Game->PlaySound(SFX_REFILL); Waitframe(); } }
This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.
Yeah, I'm not worried about the gradual refill. I just wanted the custom MP potion to match the behavior of the normal potion, but I'm just using a custom HP potion instead so the both refill instantly.
There are currently 1 users browsing this thread. (0 members and 1 guests)