The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX Ace => Topic started by: Gracie on August 20, 2015, 09:49:57 AM

Title: How would I go about doing this?
Post by: Gracie on August 20, 2015, 09:49:57 AM
Hello!

I have been trying to create a hunger system for a project I'm working on. I wanted to make it so there would be a variable that kept track of how hungry you are - something simple like 0-10 = not hungry, 11-20=peckish, etc etc

I was trying to make it so that moving between areas on a map (say through a door) would a 1 point to this, kept track of by a single variable. At around say 50 points out of 100, the character would no longer be able to run. At 90 points out of 100, they would move at an incredibly slow pace. At 100 points, a cutscene would play automatically. Hunger could be "removed" by eating items that changed the variable.

However, I tried doing this with a series of common events + parallel procresses and it was.. it was a mess. If there was a story event on the map, it wouldn't always work. Sometimes it just straight up wouldn't work.

I figure the best way to do this is through a script, as then it would be constantly running throughout the game and would kick in instantly once the requirements were met.

Problem is I'm a novice scripter at best and I couldn't really get my head around how I would do it. Anyone feel like helping?

I figured it would be like this roughly:

>check variable on map load/change
>if under 50, do nothing
>if over 50 then disable running
>if over 90 then half move speed
>if = 100 then transfer to map ###

but part of me thinks thats way too simple and theres something I'm missing here. With it set up around a variable, I could have events and items change that variable and not have to worry about having a parallel process on every map slowing things down/not really working.

This has to be tackled before I can really get on with things beyond graphics so any help would be appreciated.
Title: Re: How would I go about doing this?
Post by: Sated on August 20, 2015, 11:17:55 AM
I could write pseudo-eventing for this now, but I'm in work and it'll take me too long. I need to eat during lunch breaks as well! I can look into eventing it when I get home from work, but I don't know how to script so if you really want a script then I won't bother.

I can tell you that your problem with cutscene events is a simple one to solve. Have a second page to the Parallel Process that is "On Hero Touch" and does absolutely nothing. Turn that second page on with a switch. Turn that switch on at the start of any cutscene and off after the cutscene. You don't want cutscene map-changes to affect the hunger variable, and you certainly don't want it triggering in the middle of a cutscene. A lot of Parallel Process-style systems have this problem.

Your bigger problem is going to be timing out cutscenes when you don't know how faster the player will be moving... =P
Title: Re: How would I go about doing this?
Post by: Gracie on August 20, 2015, 12:24:21 PM
I could write pseudo-eventing for this now, but I'm in work and it'll take me too long. I need to eat during lunch breaks as well! I can look into eventing it when I get home from work, but I don't know how to script so if you really want a script then I won't bother.

I can tell you that your problem with cutscene events is a simple one to solve. Have a second page to the Parallel Process that is "On Hero Touch" and does absolutely nothing. Turn that second page on with a switch. Turn that switch on at the start of any cutscene and off after the cutscene. You don't want cutscene map-changes to affect the hunger variable, and you certainly don't want it triggering in the middle of a cutscene. A lot of Parallel Process-style systems have this problem.

Your bigger problem is going to be timing out cutscenes when you don't know how faster the player will be moving... =P

Hmm, thank you! Thats another thing I had to think about, but I think I can work around it.
Title: Re: How would I go about doing this?
Post by: strike on August 20, 2015, 12:46:33 PM
couldn't you just add some events to the map transfers? potentially calling a common event that adds 1 to the global variable and then checks what the number currently is? I don't think you'd need a parallel process then as it would only perform the check each time you transferred zones.
Title: Re: How would I go about doing this?
Post by: Sated on August 20, 2015, 03:08:00 PM
couldn't you just add some events to the map transfers? potentially calling a common event that adds 1 to the global variable and then checks what the number currently is? I don't think you'd need a parallel process then as it would only perform the check each time you transferred zones.

You could do it that way: You'd simply call a Common Event that +1s the hunger variable whenever you teleport off a particular map. You'd just have to be sure that you don't call the event and then trigger the "hungry" code when the teleport leads straight into a cutscene on the other side!
Title: Re: How would I go about doing this?
Post by: Gracie on August 20, 2015, 03:30:37 PM
couldn't you just add some events to the map transfers? potentially calling a common event that adds 1 to the global variable and then checks what the number currently is? I don't think you'd need a parallel process then as it would only perform the check each time you transferred zones.

You could do it that way: You'd simply call a Common Event that +1s the hunger variable whenever you teleport off a particular map. You'd just have to be sure that you don't call the event and then trigger the "hungry" code when the teleport leads straight into a cutscene on the other side!

See thats not the problem. The problem is having the event that executes the effect based on how hungry the player is. Sometimes, it just doesnt seem to work.

I've got some idea thanks to a bit of help from my friend demi, so heres hoping I can figure it out.