Ok so what I am trying to do is make an item that when you have it in your inventory and you get knocked out it doesn't go gameover and you heal and the item gets removed. Ive tryed to do this alot of different ways but can't seem to get it to work it allways goes gameover :sad: . Does anyone have any ideas on how i could get this to work.
Trying to make a weird heal type item in RMXP
RPG Maker XP/VX General SupportI'm not sure if you want this in battle or on the map.
I know on the map you can change the party's status to Death without going to the GameOver screen. So when you add the item to the inventory just inflect death on everybody. You'll have to use a another event that waits for you to heal to remove the item.
Edit:
You can use a common event with a conditional branch that looks like this
@>Conditional Branch:[Hero] is [Death] inflicted
@>
:else
@>Remove items: [your item],-1
@>
:end branch
I know on the map you can change the party's status to Death without going to the GameOver screen. So when you add the item to the inventory just inflect death on everybody. You'll have to use a another event that waits for you to heal to remove the item.
Edit:
You can use a common event with a conditional branch that looks like this
@>Conditional Branch:[Hero] is [Death] inflicted
@>
:else
@>Remove items: [your item],-1
@>
:end branch
O i should of said that oops i want this in battle
how do you get the item in the first place? A steal ability?
So you get the item which is a little stone that can be used only once. But you can get more for a really high price. What it does is in battle if you have it in your inventory and then you die it will bring you back to life. Well thats what i want it to do. does that make sence?
Not sure if this works 100% of the time.
-First you need a switch, call it "Fairy Bottle" or something.
-Turn it on when you receive the item.
Go to your troop page and make an Event page with the condition fairy bottle switch is on.
When the players are dead. Heal whoever, however. Remove the item. In the case you have more then one use a conditional branch to turn off the switch when you're out.
-You'll have to copy this event page to every troop so it works everytime.
-First you need a switch, call it "Fairy Bottle" or something.
-Turn it on when you receive the item.
Go to your troop page and make an Event page with the condition fairy bottle switch is on.
When the players are dead. Heal whoever, however. Remove the item. In the case you have more then one use a conditional branch to turn off the switch when you're out.
-You'll have to copy this event page to every troop so it works everytime.
aww I tryed what you said coyotecraft but it still does game over. Just to let you know I only have one charature in my party. :sad:
I'm at work now, so don't have rmxp with me to look at the scripts, but something along these lines should work:
Go into the scene_battle script.
Goto the judge method.
In that method you'll need to add something along the lines of,
"if $game_party.items.include?(id of the item)
$game_party.recover_all
battle_end(T)"
end"
T is the way the battle ends, you'll need to look there to determine what exactly T should be.
I know this isn't exactly comprhensive, if you need additional help, or I have time when I get home, I'll provide the details:)
Go into the scene_battle script.
Goto the judge method.
In that method you'll need to add something along the lines of,
"if $game_party.items.include?(id of the item)
$game_party.recover_all
battle_end(T)"
end"
T is the way the battle ends, you'll need to look there to determine what exactly T should be.
I know this isn't exactly comprhensive, if you need additional help, or I have time when I get home, I'll provide the details:)
Thanks Phoenixia for all your help when ever you get the time that would be great
Go into the script editor.
Goto Scene_Battle1 and goto the judge method.
Directly beneath the line
Paste
Just replace the K's with the id of the item you are using:)
Goto Scene_Battle1 and goto the judge method.
Directly beneath the line
- if $game_party.all_dead? or $game_party.actors.size == 0
Expand to see the code.
Paste
- if $game_party.item_number(K) > 0
- $game_party.lose_item(K,1)
- $game_party.actors.each() {|x| x.recover_all}
- $game_system.bgm_play($game_temp.map_bgm)
- battle_end(2)
- return true
- end
Expand to see the code.
Just replace the K's with the id of the item you are using:)
Phoenix' code needs to be right above "# Set game over flag", and T should be 2 (0:win 1:lose 2:escape)
and you need a 'return true' or you may get an extra battle event.
Oops, we forgot to remove the item... fixed. Change "item_id" in 2 places.
Be Well
and you need a 'return true' or you may get an extra battle event.
- #--------------------------------------------------------------------------
- # * Determine Battle Win/Loss Results
- #--------------------------------------------------------------------------
- def judge
- # If all dead determinant is true, or number of members in party is 0
- if $game_party.all_dead? or $game_party.actors.size == 0
- # If possible to lose
- if $game_temp.battle_can_lose
- # Return to BGM before battle starts
- $game_system.bgm_play($game_temp.map_bgm)
- # Battle ends
- battle_end(2)
- # Return true
- return true
- end
- ### Add this part. Replace item_id with the number of your item in the database
- if $game_party.items.include?(item_id)
- $game_party.recover_all
- $game_party.gain_item(item_id, -1)
- battle_end(2)
- return true
- end
- ### End of custom code
- # Set game over flag
- $game_temp.gameover = true
- # Return true
- return true
- end
- # Return false if even 1 enemy exists
- for enemy in $game_troop.enemies
- if enemy.exist?
- return false
- end
- end
- # Start after battle phase (win)
- start_phase5
- # Return true
- return true
- end
Expand to see the code.
Oops, we forgot to remove the item... fixed. Change "item_id" in 2 places.
Be Well
I'm confused...my code does have a 2 in it, no T, and there is a return true...I tested it twice as is, it worked perfect.
*Edit
Also odd:
Game_Party doesn't have a recover_all method.
Why use $game_party.items.include?(item_id) since items isn't attr_reader by default;
Also, last I checked, using inlucde? on a hash in Ruby checks if it has a key with that value,
So if he has 0 of the item, the inlcude? will still return a true, not false as it should
(You only get a false if the party never yet encountered the item.)
**Edit
Sorry if the above seems snippy,
I just noticed the apostrophe next to the "Phoenix" as in "Phoenix's code",
but without the 's, it looked like you were direclty addressing me by name...
From that perspective, your message seemed kind of mean;
The ending seemed very sarcastic the way I was reading it:)
*Edit
Also odd:
Game_Party doesn't have a recover_all method.
Why use $game_party.items.include?(item_id) since items isn't attr_reader by default;
Also, last I checked, using inlucde? on a hash in Ruby checks if it has a key with that value,
So if he has 0 of the item, the inlcude? will still return a true, not false as it should
(You only get a false if the party never yet encountered the item.)
**Edit
Sorry if the above seems snippy,
I just noticed the apostrophe next to the "Phoenix" as in "Phoenix's code",
but without the 's, it looked like you were direclty addressing me by name...
From that perspective, your message seemed kind of mean;
The ending seemed very sarcastic the way I was reading it:)
We were typing at the same time, and I'm a slow typer (I reread a lot). I was referring to your previous post. :scruff:
I also didn't check the 'recover_all' method. Or test it for that matter... :)
I just copied your code from the previous post, and showed him where to put it. (assuming "...when I get home" meant much later.)
Use Phoenixia's code, not mine!!!! :grin:
Now I'm scratching my head on the order. You have the heal code before the "Continue even when loser" code.
"Continue even when loser" typically gets used for simulated battles where the party doesn't really die. (fist fight, training, test of strength). Would you want the party to 'auto-heal' and waste the magic item? Will you even use this type of battle?
Something to ponder...
Be Well
I also didn't check the 'recover_all' method. Or test it for that matter... :)
I just copied your code from the previous post, and showed him where to put it. (assuming "...when I get home" meant much later.)
Use Phoenixia's code, not mine!!!! :grin:
Now I'm scratching my head on the order. You have the heal code before the "Continue even when loser" code.
"Continue even when loser" typically gets used for simulated battles where the party doesn't really die. (fist fight, training, test of strength). Would you want the party to 'auto-heal' and waste the magic item? Will you even use this type of battle?
Something to ponder...
Be Well
Phoenixia wrote:
**Edit
Sorry if the above seems snippy,
I just noticed the apostrophe next to the "Phoenix" as in "Phoenix's code",
but without the 's, it looked like you were direclty addressing me by name...
From that perspective, your message seemed kind of mean;
The ending seemed very sarcastic the way I was reading it:)
Sorry if the above seems snippy,
I just noticed the apostrophe next to the "Phoenix" as in "Phoenix's code",
but without the 's, it looked like you were direclty addressing me by name...
From that perspective, your message seemed kind of mean;
The ending seemed very sarcastic the way I was reading it:)
No worries, love. It's all in fun. (I'm a big giant teddy bear. Very rarely mean.) 😉
My "Oops" was tongue in cheek. I was narrating the fact that I suddenly realized we also needed to remove the item.
Be Well
[edit] It also just occurred to me that if we are using event based battles, we could just use the "Continue even if loser" setting, and handle it all with events. But I like this solution better, less work, and it works for random encounters too.
No, you're right about the order; I never use it, so guess I over looked it.
I feel like an idiot now though, I thougt you were refering to my second post, not the first...
I was wondering what you were talking about...
I feel like an idiot now though, I thougt you were refering to my second post, not the first...
I was wondering what you were talking about...
Original thread: https://www.hbgames.org/forums/viewtopic.php?t=66365