Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Getting an event to trigger based on player's SP

Hey all, this is my first post, looking for some eventing help.

So I'm trying to have a "Frenzy" mode activate when an actor's SP goes to 0. Of course, there's nothing simple under the Conditional Branch like "If Character's SP == x," so what I've done is set up a parallel process Common Event that states:

Set Variable x = Character's SP

I then have a second parallel process Common Event that states:

If Variable x == 0, inflict state "Frenzy"

For some reason I find it works better to split these two into separate common events, though in theory they should work as one. Also, the trigger is some arbitrary switch that's activated toward the start of the game.

In addition to this, I'd like Frenzy state to cause the player to attack randomly, i.e., target both friendlies and hostiles, so I've implemented a battle event, with the condition of Don't Run, using a Conditional Branch that states:

If "Frenzy" is inflicted, force "Actor" action "Attack" on target "Random."

So ideally, what we have, is when the player's SP hits 0, he goes into Frenzy, and attacks random targets. However, the way it's ACTUALLY happening is that if the player's SP goes to 0 outside of combat, it only registers after he enters combat. Further, if it goes to 0 inside of combat, nothing happens. And to top it off, even if the player IS Frenzy inflicted, he's not attacking random targets.

Now in a perfect world I'd like to get to the point where little message windows pop up like "[Actor] is losing control..." and (as I've tied the Frenzy state to NAMKOR's Deathwatch State, which kills the player after x rounds of being inflicted) "[Actor] has lost himself to the Beast Within." However, this is secondary to actually getting the crap to work.

So if anyone has any advice, or can do a better version of this (admittedly haphazardly patched together) event sequence, or, even better, can just whip up or point me to a script that does the exact same thing, please post away.

Thanks.
 
Here's a slightly different, and in my opinion easier way of doing it:
Go to (I think) the troops tab in the database.  Battle events wherever that is (I don't look at the tabs no more so I forgot many of them XD)
My memory may be hazy so I might have the wrong names here... but...
Create a new event that starts at the beginning of battle.
Have it run every turn.
Set variable x to actor's SP
Conditional Branch - if variable x = 0 - change state add "frenzy", message "So-and-so is Frenzy" (you do not need a if not branch).

If you have multiple characters, have each one on their own event page.  It won't muck anything up, don't worry.  It's just easier and less chance you'll accidentally screw up (I know I have when not splitting between battle event pages).

But anything I could think of to trigger outside of combat would not work - but is it really needed?

Repeat this for every character you would want this for.

Additionally Sandgolem/Gamebaker has this script I absolutely love: http://www.gamebaker.com/rmxp/scripts/b ... events.htm

If you set up one Troop to have the events you want, and have this script activated it will sling to all troops (effectively making all battles follow the same events).

-

As for making Frenzy a "Confused" state, do a search.  Go to the script forum and use the search feature there - just make sure to put "this forum" and not entire site/forum!  I idiotically put "confused" and it brought up everyone who ever said "how do you do this I'm confused" so refine it a bit more.

You could play around with more battle events.
This is theory not sure if it would work.
You could create more states.  Confuse for example in the database attacks only allies.  You could make a 2nd Frenzy that is like that - always attacks allies.  You could then add in another set variable command in a new battle event.  Random between 1-5.  If 3 or lower, attack random target.  If 4 or higher add state "frenzy (allies)".  Just make sure Frenzy Allies is set to last only that turn.

Now a note would be that you would either have to rename Frenzy (allies) to "frenzy" when your done.  I just recommend naming it such so while your playing with things you don't mistake it for the other.  Or you could set it to be 0 in rank in the state tab, so that it'll never show to the player.

What that should do is allow the character to attack both enemy and ally, with just a slightly greater chance to attack enemies.  You could change the variables of course.

Hope that helps it's the best I got and no guarantee.
 
Hey, thanks a lot for your help.

Yeah, you were definitely right, Battle Event is the way to go for something like this.  Keeps things a lot neater.

Interestingly enough, having the exact same event process as a parallel Common Event works outside of combat, but not in combat, so I've managed (accidentally) to have it fire both in and out of combat.

Also, good call on the two Frenzy states set by a random variable.  No, not even good call, amazing call.  I was too set on trying to get the whole thing jammed into one process to even think of that.  Genius.

Oh and thanks for the link to that script.  Should save me some time.

Thanks again for the help, everything appears to be working as desired now.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top