Spend energy to walk

I am working on a survival game. It's only one map for now, but I want to make sure I have all of the mechanics worked out before continuing.


There are a few ares I could really use some advice in. 


1) an energy system. Like calories I want to rave energy drain when walking, crafting, fishing etc. And replinish when sleeping or eating.


2) possible fails within events. Like fishing or fire starting. Right now the player is a master survival expert as he can light a fire with 2 sticks instantaneously.


3) regenerating events. Resources like sticks and vines. I would like them to regenerate after so long. Completely lost on this one.


4) I have little experience in scripting so if anyone has any cool event driven mechanisms that might fit with a wile Ness survival games I am all ears.
1. This can be done with a common event that checks your current X,Y location (saved as two variables) against your last X,Y location (saved as two other variables), if these locations are different (basically detecting when you move), you can have it change another variable or character stat, then update the last X,Y location variable to match the current one. It sounds really complicated with how I quickly outlined the event, but if you need more detailed help let me know.


2.Make five variables,

  • One for the skill level itself (A), this will be 1-4 or whatever your level range is for that skill. This will always be set to the player's current level in that skill.
  • One for a set variance amount based on the skill level itself (😎, So in your event, you would have IF A=1 THEN B = 30, ELSE IF A=2 THEN B=40 and so on.
  • One another for a random variance amount (C). This would just be to make the game have a small random chance of increased failure. You can ignore this one if you want it based on skill alone.
  • One for the totals of B and C to be added together and have the sum saved in whenever you want to have the check run. This would be (D)
  • And the last one to compare against variable D to convert the chance of success into a 0-100% success function.

Ok, so whenever the player attempts to make a fire, have B become set to a certain value based on the player's skill level, for our example, (😎 becomes 30 because skill level saved in A is 1.


Have C become a random number between -10 and +10 each time the player attempts. (or whatever positive/negative variance you want.) C should be a number you specifically set based on game difficulty on how big you want your random variance chance to be to succeed. I'd say 10% in either direction would be a good number for normal difficulty ( between -10% and +20% on an easy difficulty). So in our example, the totals of B and C equal anywhere between 20 and 40 ( which is saved to variable D).


Then set E to a random number between 0-100. Check the random outcome of E against D. Have the Conditional Branch see If E is "Less than or Equal To D", if it is, crafting the fire will succeed, if not, it will fail. This makes skill level 1 have a 20-40% chance to create a fire.


3. Check out this tutorial by Syndicate, it may help even though it's for MV. 
Okay, I have sat my variables up. Had a conditional branch so that when I try to make fire if 


e <= d then


fire


Else


No fire


But I am still having fire every time.


I did this with a show text so that I could continuously check this without having to start a new playtest. But it consistently showed fire. 


And ideas?
Are you having C, D and E change every time you run the event?


C should be set to become -10 to 10 each time before your conditional is checked.


D should always update its math because C has changed.


and E should always be trying to get a new 0-100 value.


I put together the event to test it, and with B=30 and C=-10to10 , I got the fire to start about 30% of the times. Sometimes it came on 4 times in a row, so even though its chanced base, RANDOM NUM GEN may be on the player's side.


helpwithchance.jpg


That was my event. As you can see, if failed, I had it display the values it got, so I could double check it.


If you want to, you could always make another variable (F), that starts at 0, and gets bigger every time you try to light a fire after failing. (Add it to D after you add C) That way the more they fail the more they have a chance of succeeding when they try again. This way you could make it fail more often to begin with by lowering B to like 10 or something, and making the player HAVE to attempt over and over to have a better chance. Then after a success the value of F would of course reset to 0 so the next fire would be difficult again.
Yep. You are good... My fire works perfectly now. Trying to make it to where it wastes resources when failing. I added in under the failure report a


Control Variable :fails +=1


then a


conditional branch that


if :fails == 5,


show text "broke a stick"


and control variable :sticks -= 1. 


That way after every five fails a stick breaks and you might need to gather more resources. However it doesn't seem to work at all.


Thank you for your help, and how can I credit you for the help?
Glad to be of help!


I believe it's if you like my post. Also, if you click the little arrow on my post on the top left (on the one that actually answered your Q). It will select it as "Answered" so people know you have no more need for assistance.


EDIT : I couldn't send images in the private messages thing, so I am sending you the image for the "Check to see if player moved" common event here instead.


Make the following common event.


helpwithchance.jpg


And then on any map, or whenever you want the player to have the limited stamina, turn on switch 7 (or whatever switch you set in that top box there.)

Original thread: https://forums.rpgmakerweb.com/threads/spend-energy-to-walk.59804/