Item that recovers HP and MP outside of battle
Moderators: Bob the Hamster, marionline, SDHawk
- Willy Elektrix
- Liquid Metal Slime
- Posts: 910
- Joined: Sun Aug 15, 2010 11:30 pm
Item that recovers HP and MP outside of battle
I want to have a recovery that is usable out of battle and recovers both HP and MP to maximum. Inside of battle, this is easy. I made an HP recovery attack and chain it to an MP recovery attack. How would I script this to work when used from the player's inventory?
- FnrrfYgmSchnish
- Metal Slime
- Posts: 721
- Joined: Thu Jun 18, 2009 4:37 am
- Location: Middle of Nowhere, VA
Yeah, but going to a textbox for the HP/MP-restoring part also brings up a textbox, which doesn't normally happen when you use a regular healing item and might look a little weird. I guess it could work if it was a small box with "HP/MP restored!" or something along those lines, but... oh well.
It's not too hard to do this with a script, though.
This part brings up a hero-picking box, and uses a variable to keep track of who you picked. You'll probably want to change the global text string for pick-hero boxes before using this; I can't remember off the top of my head what the default is, but I know I've always changed it whenever I used "pick hero."
You'll probably want to use a different name for the variable (most likely something shorter, heh); I just used "insertnamehere" as a placeholder.
This part makes the game know what the character's max HP is by recording it in a variable, then sets their current HP to be equal to their max HP. To restore MP too, just copy the "set variable" and "set hero stat" lines and paste them in after the HP-restoring part... then just change every part that says "stat:HP" to "stat:MP" (or whatever MP is called in your game, if it's something else besides MP. Same goes for HP.)
And if you want to have the item play a sound effect or flash the screen or some other effect like that when used, just put that in after the HP/MP-restoring part.
It's not too hard to do this with a script, though.
Code: Select all
variable(insertnamehere)
set variable(insertnamehere,pick hero)You'll probably want to use a different name for the variable (most likely something shorter, heh); I just used "insertnamehere" as a placeholder.
Code: Select all
variable(anothername)
set variable(anothername,get hero stat(insertnamehere,stat:HP,maximum stat))
set hero stat(insertnamehere,stat:HP,anothername,current stat)
And if you want to have the item play a sound effect or flash the screen or some other effect like that when used, just put that in after the HP/MP-restoring part.
FYS:AHS -- Swapping out some step-on NPCs for zones + each step script
Puckamon -- Not until the reserve party is expanded.[/size]
Puckamon -- Not until the reserve party is expanded.[/size]
- Bob the Hamster
- Liquid Metal King Slime
- Posts: 7460
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
- Nathan Karr
- Liquid Metal Slime
- Posts: 1215
- Joined: Fri Jan 25, 2008 3:51 am
- Contact:
- Bob the Hamster
- Liquid Metal King Slime
- Posts: 7460
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact: