The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Tutorials and Eventing => Topic started by: shintashi on April 24, 2010, 06:17:24 AM

Title: How do you die from an event?
Post by: shintashi on April 24, 2010, 06:17:24 AM
I've made some events that reduce sp or hp, but nothing seems to happen with the numbers hit 0. The status says knockout, but the actors still walk around talking like usual. I rather like this default for programming stuff like ghost worlds, or the planes when you die, but how do I get an event to register the character is "game over, dead" when their hp goes to zero from something like a trap?
Title: Re: How do you die from an event?
Post by: SirJackRex on April 24, 2010, 06:39:05 AM
I do not know what you mean by "ghost worlds" and "planes," but there's an event on the third page in the bottom right-hand corner called "Game Over." Simply trigger that, and it'll call the Game Over screen.

Hope that helps,
Rex.
Title: Re: How do you die from an event?
Post by: shintashi on April 24, 2010, 03:07:40 PM
So I made a basic single actor (my actor's name is Zeno) addition, it seems logical to make this into a common event,
but it also needs a swap mechanism for multiple actors.

@>Control Variables:[0009: actor hp] = [Zeno]'s HP
@>Conditional Branch: Variable [0009: actor hp] <= 0
@>Game Over
@>
: Else
@>
: Branch End


For example, if I have a second actor in the party and my leader dies, then my main actor and map avatar becomes the second party member.

Also need a way of saying "if [Actor 1] AND [Actor 2] ... AND [Actor 3,4,5, etc.] are 0 HP, then game over."
Title: Re: How do you die from an event?
Post by: Grafikal on April 24, 2010, 03:54:58 PM
If all your actors have 0 HP the game is over anyways dude.
Title: Re: How do you die from an event?
Post by: shintashi on April 24, 2010, 04:17:38 PM
not actually true. I've done this many times. When all my actors hit zero hp, through events, nothing happens. I can keep talking to other NPCs, trigger events, gain event/quest based exp, skills, and so forth. Try it yourself by creating a map with no monsters and events that deal damage.

Edit: i think this is so you can do those "all party is dead" events in battle like the boss fights, such as Final Fantasy 4.
Title: Re: How do you die from an event?
Post by: SirJackRex on April 24, 2010, 04:21:28 PM
I believe that you can have the death of all of your actors (or a specific amount) trigger a switch (or switches). It's just a matter of making the correct combination.

If you check in the menu, are they actually at 0 HP? Can you take a screen shot of this event you have, and upload it for us to look at? There may be something wrong with the setup and triggers.
Title: Re: How do you die from an event?
Post by: cozziekuns on April 24, 2010, 04:33:13 PM
SirJackRex pretty much has it on the ball. If you do not check the box "Allow knockout in battle", then your actors will only go to 1 HP. Or at least thats what happened when I tried it.

EDIT: Had no idea you were talking about XP. My mistake...

Title: Re: How do you die from an event?
Post by: Kidfox70 on April 24, 2010, 04:43:42 PM
It seems like all he would do is have a common event that was set to par pro.

have it checking to see if the party leader's hp is greater than 0. if it is, nothing, if it isn't then change the players graphic to the next member of the party.
Title: Re: How do you die from an event?
Post by: shintashi on April 25, 2010, 12:56:34 AM
Quote from: SirJackRex on April 24, 2010, 04:21:28 PM
I believe that you can have the death of all of your actors (or a specific amount) trigger a switch (or switches). It's just a matter of making the correct combination.

If you check in the menu, are they actually at 0 HP? Can you take a screen shot of this event you have, and upload it for us to look at? There may be something wrong with the setup and triggers.


here's an image shack screenshot of what I see:
Screenshot (http://img85.imageshack.us/i/screenshotdh.png/)
[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg85.imageshack.us%2Fimg85%2F6627%2Fscreenshotdh.png&hash=5856b80ad134a00c8d9e652b6d7ced08ab7683d3)
[/spoiler]

I can include screen shots of the code if you like.
Title: Re: How do you die from an event?
Post by: Ryosis on April 25, 2010, 01:11:42 AM
IIRC, there should be a Conditional Event that checks if the character's HP is equal to some value. You could play around with that and see what happens. I'm not entirely sure, though.
Title: Re: How do you die from an event?
Post by: Kidfox70 on April 25, 2010, 01:30:16 AM
QuoteConditional Event that checks if the character's HP is equal to some value.

Yeah, thats basicly what I said. But I'm pretty sure the best way to do what he wants (what I think he wants), is put it in a Common Event set by a Parallel Processing. All he would have to do is turn on a Switch in the very beginning of the Game or what have you, to make the Common Event check the Hp vaule of the Hp Variable. He can use this for the Swaping thing.

I have a problem here, I'm a bit confused. At first it seems like you want to give a Game Over to the Player when he triggers an Event, say a Trap Event. But then you talk about them walking around and you want to be able to Swap the main Sprite for the Sprite of the next person in your Party. Which is fine, I understand why you're confused. It's just, if you give a game over...then it's a game over, ergo you can't do the swaping thing. But if you want to have them, when knocked out, swaping for who ever is next. Then you need that Common Event I spoke of before and the Conditional Branchs Reading the Hp Variable of every actor, then changing sprite Graphics.

If there is something I'm missing, please tell me. As always I hope I've helped. Also, I like the Idea of the Swaping Party members for the Healthy one, nice work.  :D
Title: Re: How do you die from an event?
Post by: shintashi on April 25, 2010, 01:41:22 AM
The swapping out a "dead" one for a healthy one is a good idea, and you are right, the game shouldn't end just because one of the players is dead unless there's a storyline behind it (you are the main character and resurrection doesn't exist) or you are solo. The thing I was originally confused about is the fact that even with both characters knocked out, the game didn't end.

I don't know how to set a conditional branch that checks for multiple truths, like in flash,

if(Zeno.hp == 0 && Heron.hp == 0){run_gameover();}


But in Event systems? I am noob.

Title: Re: How do you die from an event?
Post by: SirJackRex on April 25, 2010, 02:16:16 AM
lol actionscript.

Okay, so here's what I did and it worked perfectly. This is assuming that you want a switch that triggers a game over when something is interacted with. In this case, you "activate" a chest and it kills you.
You need two events: One to turn on the switch that will call the game over, and one event to call the game over.
[spoiler=screen](https://rmrk.net/proxy.php?request=http%3A%2F%2Fi701.photobucket.com%2Falbums%2Fww11%2Fantlazz%2F54631f11.png&hash=786387ce1f9d54548ff4fda69a34bdcd773e7aeb)[/spoiler]
Tell if that's what you're after, if not, I'll try to help you further.

Good luck,
Rex.

EDIT: Lol, what did I just say? I think what you meant is you it to check whether or not the health is at 0 HP, and if it is to call the Game Over screen. Sorry, I had misunderstood. Anyway, you can use the former method if you wish, but I can tell you how to do the latter method in a moment, or I'm sure other members can help you. I need to go make dinner now, ho ho! ;)
Title: Re: How do you die from an event?
Post by: shintashi on April 25, 2010, 03:57:43 PM
i first tried a variable that totaled all party hp, but nothing happened, so I came up with this:

[spoiler]@>Conditional Branch: [Zeno] is [Knockout] inflicted
@>Conditional Branch: [Heron] is [Knockout] inflicted
_ @>Game Over
_ @>
: Else
_ @>Set Move Route: Player
_ : ______ : $Graphic:"128-Noble03', 0, 2, 0
_ : ______ : Move Animation ON
@>
_ : Branch End
@>
: Else
@>
: Branch End
@>
[/spoiler]

Which switches my main guy if he dies to my second guy, and ends the game if they both die. It's far from a "universal" code though, and if I change my party through events later, I would have to rewrite it.
Title: Re: How do you die from an event?
Post by: SirJackRex on April 25, 2010, 04:50:59 PM
Let's try this:
Code (Event: Parallel Process) Select

@>Conditional Branch: [Player One] is [Knockout] inflicted
  @>Conditional Branch: [Player Two] is [Knockout] inflicted
    @>Game Over
    @>
   : Else
    @>
   : Branch End
  @>
: Else
  @>
: Branch End
@>Conditional Branch: [Player Two] is [Knockout] inflicted
  @>Conditional Branch: [Player One] is [Knockout] inflicted
    @>Game Over
    @>
   : Else
    @>
   : Branch End
  @>
: Else
  @>
: Branch End

The conditional branch you're looking for is found on the second tab of the "Conditional Branch" event, if you do not already know.
So what that's going to do for it this: Check to see if Player one and two are knocked out, and then check to see if player two and one are knocked out, respectively. If it returns true, then it will call the Game Over screen. I have tested this method and it works well.

Good luck,
Rex.
Title: Re: How do you die from an event?
Post by: Grafikal on April 25, 2010, 05:31:55 PM
Rex is right about checking for Knockout rather than HP. It's easier to maintain in general that way. You don't have to add or subtract numbers to do it, you only need to apply or remove that state if necessary.