azure hunter said:
First is easy, because I've seen someone do it...I just simply forgot. He had the game set up that on certain maps (like a field map) whenever he hit "v" i believe, he would jump.
The second might be a little harder to figure. I want to have a system where you can take an item i made called a "floral kit" which can be used to cut out herbs from the map. The problem i run into is i want the herbs /plants to grow back after certain periods of time depending on how rare the herb/plant is rather than creating a large and complex switch system.
Problems I've already faced with this are: The herb comes back everytime i enter the screen, I would enter the map the herb was in but then would constantly recieve the herb and confirmation mesage. The herb never disappears because the item i have is always with me.
Basically all i want to see is something like this. ( I walk into the screen and hit the action key next to the herb to recieve it. the herb disappears and i walk out of the screen. I do something for about 5 minutes and decide to go back. I walk back into the screen and wait 5 minutes since it takes 10 minutes to grow back. It reappears and then I grab it.)
|
Ok, for the first, I'm not going to reinvent the wheel here -
http://zelaron.com/forum/showthread.php?t=39307
The second is interesting, because you want to keep all of your herb events separate, with differing regrowth rates, with three states each (grown/unpickable, grown/pickable, ungrown), and you want it all somehow uncomplicated
The problem you're describing with the herb disappearing is due to not 'getting' that there are those specific 3 states to the herb - you are very, very likely putting pages in the wrong order. You can set it up temporarily like
(Page 1 - Grown,No Item)(Page 2 - Grown,Has Item)(Page 3 - Plant Gone)
But then we would be using switches, and that would not be a good idea since we're dealing with numbers.
The only real way to do this is with a Timer event that "ticks" every 5 seconds or something. Here's a quick psuedocode example of a common event for the timer:
Code:
Comment: Making these variables at the start will help you later on when you need to change things.
Variable operation: variable herbCounterStart = 3000
Variable operation: set variable herbCounterEnd = 3100
Variable operation: set variable index = 0
If TIMER is 0
{
Comment: This part goes through all of your herb variables and reduces the number by 1
index = herbCounterStart
Loop
Variable operation: variable reference[index], subtract 1
Variable operation: index, add 1
if index > herbCounterEnd
{
Break out of Loop
}
:End Loop
Set TIMER to 5 seconds
} |
And each event, separately, would check to see if its own regrowTimer is 0 - if so, it's available to be cut, assuming you have the item. This means that, because we're using variables to determine the state of the herb, we can just use the regrowth variable to see if we can get it. As a bonus, all the regrowth timers will start out as 0 anyway, so there's fewer variables to set! Just remember not to name the herb regrowth variables as you go, and DO NOT INTERRUPT THE 'CHAIN' OF VARIABLES. In other words, keep a larger block of variables open than you think you will need. If you think you'll only have 100 herbs in the game, save 150 spaces just in case.
There is a small bug, which isn't too big of a deal - at worst, you might pick an herb when the timer is 00:01 instead of 00:05 and 'save' 4 seconds. If you want to, you can set the timer to a smaller interval to reduce this effect.
Edit:
The basic page structure for EACH herb would then be something like:
(Page 1 - Picture: Grown, Precond: no item)
(Page 2 - Picture: Grown, Precond: has item, var[3030] = 0)
(Page 3 - Picture: Plant gone, Precond: var[3030] > 0)
On Page 2 you would just set the variable number to be whatever you want the time to be. For a rare herb, you can set it to be 100 which would be 500 seconds, or whatever you want.
Edit 2:
Almost forgot something important that doesn't really have anything to do with the rest of the post - this should be self-evident, but
set your regrowth rates as variables somewhere in your first set-up event in the game. You do NOT want to find and edit all of your "potion herbs" to add a few seconds of regrowth time when just changing potionRegrowRate to 4 instead of 3 is possible.
Obviously, in Page 2 of an herb's event, you would set herbRegrow[3030] = potionRegrowRate instead of a number.