How would I go about doing this?

0 Members and 1 Guest are viewing this topic.

*
Small Bat Dev
Rep:
Level 76
2012 Best Artistf*ck u >:(2011 Best Artist2010 Best NewbieParticipant - GIAW 11Bronze - GIAW 92011 Most Attractive Female MemberBronze - Game In A Week VII
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.


***
Rep:
Level 84
puking up frothing vitriolic sarcastic spittle
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
My amateur game-development blog is over at this address: http://sorelosersgaming.blogspot.com
Information on my personal game development projects can be found here!
A list of games that I've reviewed can be found here!

My Twitter is here: @Sated86

*
Small Bat Dev
Rep:
Level 76
2012 Best Artistf*ck u >:(2011 Best Artist2010 Best NewbieParticipant - GIAW 11Bronze - GIAW 92011 Most Attractive Female MemberBronze - Game In A Week VII
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.


*
Avatar Gallery, Lol
Rep:
Level 88
Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.Secret Santa 2012 ParticipantSilver - GIAW 10Silver - GIAW 92011 Biggest Drama WhoreBronze - GIAW HalloweenGold - Game In A Week VII
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.
:tinysmile:

***
Rep:
Level 84
puking up frothing vitriolic sarcastic spittle
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!
« Last Edit: August 20, 2015, 03:10:25 PM by Sated »
My amateur game-development blog is over at this address: http://sorelosersgaming.blogspot.com
Information on my personal game development projects can be found here!
A list of games that I've reviewed can be found here!

My Twitter is here: @Sated86

*
Small Bat Dev
Rep:
Level 76
2012 Best Artistf*ck u >:(2011 Best Artist2010 Best NewbieParticipant - GIAW 11Bronze - GIAW 92011 Most Attractive Female MemberBronze - Game In A Week VII
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.