Themaninthemac
Mar 24 2010, 09:27 PM
Hey guys, OK so I'm hoping somebody can help me out with this. I'm currently working on a project in which the main character is the only member in the party. As you can imagine a lot of re-tooling is needed within VX's Database, right now though what I'm trying to do is make it so when the character dies, (enters incapacitated state) he automatically uses one of his Stimulants in his inventory (like the fairy's in Zelda, if you die they bring you back to life automatically). Now I tried creating a common event, linked to a conditional switch that turns on (and stays on) at the very opening cutscene, that says IF main character falls into incapacitated state, and IF he has a Stimulant (Extra life potion) in his inventory, THEN restore all HP and MP, and Change Item, to Stimulant to -1 (branch end). I set the common event as a parallel process, linked to the conditional switch that turns on at the beginning of the game, yet when I play tested (and used F9 menu to turn on the switch) the enemies killed me and I was instantly given a game over. My only guess is that this must be a scripting issue, where a game over is set to override any other events, but I can't be sure. If somebody could give me advice on how to override the game over thing, or tell me what I need to change in the games script, or some other way to do this, I would be very grateful.
Thanks.
mudducky
Mar 25 2010, 03:13 PM
It relates to Game_Actor
around the code
CODE
#--------------------------------------------------------------------------
# * Perform Collapse
#--------------------------------------------------------------------------
def perform_collapse
if $game_temp.in_battle and dead?
@collapse = true
Sound.play_actor_collapse
end
end
Change that to
CODE
def perform_collapse
if $game_temp.in_battle and dead?
if $game_party.item_number($data_items[5]) >= 1
self.hp += 1
$game_party.lose_item($data_items[5], 1)
else
@collapse = true
Sound.play_actor_collapse
end
end
end
$data_items[5] 5 being the item ID you want to use up and remove afterwards.
I think that will only apply it in battle though.
leongon
Mar 26 2010, 01:33 PM
and
self.hp += 1 1 being the exact Hp you come back with.
Can you set it to a percent of the actor's max hp?
Very helpful. I'll take your script mod too if you don't mind mudducky.
Callista
Mar 26 2010, 02:48 PM
CODE
self.hp = self.maxhp*0.5
for example would do 50% of the actor's max HP.
leongon
Mar 26 2010, 03:28 PM
Thank you Callista.
Themaninthemac
Mar 27 2010, 11:06 PM
Thank you mudducky for the script, and Callista and leongon for the explanations. This works great, but I have two more questions pertaining to it. First I was wondering if it's possible to display text when this script takes effect, like, (Actor1 was defeated, but was revived with the potion of fate), that would be great, because otherwise the player is going to be like, "What the heck just happened, I thought I died!" Second, when I entered the percentage number as Callista suggested (self.hp=self.maxhp*0.8) it worked fine, but the number displayed in the health bar was all 400.00 or something like that. This is a minuscule detail I know, but I was wondering if there was anyway to fix that as well. Again thank you guys so much, you can't believe how much of a help this was.
mudducky
Mar 30 2010, 12:06 PM
CODE
#--------------------------------------------------------------------------
# * Perform Collapse
#--------------------------------------------------------------------------
def perform_collapse
if $game_temp.in_battle and dead?
if $game_party.item_number($data_items[5]) >= 1
$game_message.texts.push("text")
self.hp = self.maxhp* 80 / 100
$game_party.lose_item($data_items[5], 1)
else
@collapse = true
Sound.play_actor_collapse
end
end
end
The text will rush off the screen straight away, I'm not sure what you can do there. Someone here may know scripting and be able to help you out.

CODE
self.hp = self.maxhp* 80 / 100
The 80 / 100 is the same as 0.8 but it removed the decimal.
CODE
$game_message.texts.push("text")
Puts a text box with the word "text" on screen, usually will give an input button before the text is removed...
BasharTeg6
Mar 31 2010, 04:46 AM
Just a quick suggestion for the text issue. I'm not sure what the script equivalent for the delay and skip characters are (/| /. and /^) but you could probably use those to keep the text box up. Unless it's just a script error...
poisonshift
Apr 1 2010, 01:27 PM
Is there a way to do this without an item? also included with that would be, can the player be regenerated to a certain point that beings an automatic event? Lets say your game has only one save point, and when you die you return to the save point, with less gold. don't worry about the gold unless you can help with that too.
mudducky
Apr 1 2010, 01:31 PM
If I understand what you are asking correctly, this can happen with events easily.
Disable saving by using event page 3, change save access, disable at the start of the game. This will disable saving from the menu.
Then place event page 3, Open Save Screen, on the crystal. The actors when they die will automatically be restored to their previous save point.
Themaninthemac
Apr 1 2010, 05:32 PM
Thank you very much sir, I will try this out and see If I can get it to work. Thanks for your time I appreciate it.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.