Zelaron Gaming Forum

Zelaron Gaming Forum (http://zelaron.com/forum/index.php)
-   RPGMaker (http://zelaron.com/forum/forumdisplay.php?f=188)
-   -   I've got a "few" problems I might need BlueCube (http://zelaron.com/forum/showthread.php?t=40935)

azure hunter 2006-11-02 11:05 AM

I've got a "few" problems I might need BlueCube
 
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.)

azure hunter 2006-11-02 11:08 AM

I forgot to ad this is for 2k3

Dar_Win 2006-11-02 12:56 PM

*SUMMON BLUECUBE*

This noob with two posts needs your wisdom!

Lenny 2006-11-02 03:29 PM

It's interesting to see that he seems to know about BC's mastery. He must travel far and wide. :)

-----

I know the Jump is possible, and I'm pretty sure that someone has posted a thread about it... but I'm known to be wrong.

As for the growing back, welllll... I think you can make a timer in RM2K3. Most people use it for night and day, but I don't see why one can't distort it to fit ones needs.

BlueCube 2006-11-02 05:21 PM

-Remove this-
 
Oh hey, double post, that doesn't happen too often

BlueCube 2006-11-02 05:28 PM

Summon Successful
 
Quote:

Originally Posted by azure hunter
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.

Lenny 2006-11-03 10:37 AM

You put all this code in as a Comment, right?

What language do you use? Is it Ruby like RMXP? Or a normal programming language like C++ or VB?

BlueCube 2006-11-03 09:22 PM

Quote:

Originally Posted by Lenny
You put all this code in as a Comment, right?

What language do you use? Is it Ruby like RMXP? Or a normal programming language like C++ or VB?

Nah, that's all pseudocode, I don't use regular RM2k3 language because it's tougher to read and longer to type out. If someone needs shown exactly what commands to use, I'll oblige, but in general "Set TIMER to 5 seconds" should be obvious enough, especially since the "real" code is generated for you by RM2k3 anyway.

For pseudocode, I just use a blend of random languages, I mainly use vbscript but I like C++ conventions as well. (I just noticed I capitalized TIMER, I think it was capitalized way back when I was 10 and playing with QBASIC for DOS and it stuck with me. Good old RANDOMIZE TIMER. Even if the timer in RM2k3 is nothing like the QBASIC TIMER variable, but whatever)

azure hunter 2006-11-06 06:35 AM

I might need to be shown exactly how to do it. I'm still new to all this. I got the jumping but still having trouble with the herbs

BlueCube 2006-11-06 09:24 PM

Quote:

Originally Posted by azure hunter
I might need to be shown exactly how to do it. I'm still new to all this. I got the jumping but still having trouble with the herbs

Alright, did this demo in about 25 minutes (and it shows!)


http://www.make7.org/files/trees.zip

Trees instead of herbs, but hey, it's the RTP default trees, so who cares. (I assume you have the "standard" RTP, but if not, I can add that in as well, though it'd make the zip a bit huge)

azure hunter 2006-11-09 06:22 AM

Thank you very much BlueCube. I understand the variables now. I will be sure to put you on my special thanks list.

Lenny 2006-11-09 10:04 AM

I wonder how many "Special Thanks to..." lists BlueCube has been on...

In the day he was helping 10 people a day with things.

azure hunter 2006-11-09 11:32 AM

My timer stays at zero. Do you know why?

heres a quick drawing of my common event
I dont have a clock noise

if timer 0 0 less/equal
VO : 0008 Loop Index set VAR [0007] value (Which is set to 0)
Branch if switch [0006: start time] is on
Timer 1 Operation: Start
Else handler
Timer 1 operation: start
end
Loop
Variable Oper [0008 loop index 0] Set Var [0001]'s Value
loop
Variable Oper [v[0008]-, 1
Variable Oper [0008: loop index 0] +. 1
Branch if Var [0008:loop index 0] is V[0002] Greater
Break Loop

End

End Loop

End loop

end

azure hunter 2006-11-09 11:38 AM

and i mean i dont have a clock noise because i dont want one
Also...how do i edit a post? i cant find the button

BlueCube 2006-11-09 03:13 PM

Quote:

Originally Posted by azure hunter
My timer stays at zero. Do you know why?

heres a quick drawing of my common event
I dont have a clock noise

if timer 0 0 less/equal
VO : 0008 Loop Index set VAR [0007] value (Which is set to 0)
Branch if switch [0006: start time] is on
Timer 1 Operation: Start
Else handler
Timer 1 operation: start
end
Loop
Variable Oper [0008 loop index 0] Set Var [0001]'s Value
loop
Variable Oper [v[0008]-, 1
Variable Oper [0008: loop index 0] +. 1
Branch if Var [0008:loop index 0] is V[0002] Greater
Break Loop

End

End Loop

End loop

end

I'm not seeing where you are actually Setting the clock - remember to toss in a

<>Timer 1 Operation: Set, V[####]

Where #### is the variable that stores the seconds for the timer. (You can set it directly, but it's much, much easier for editing if you do it via variables). Setting and Starting the timer are two separate steps and are usually done right after one another.

Unrelated, there's a quirk with the timer - if you <>Set it while it is already running, the timer will continue counting down from the new number. However, if the timer is at zero, it'll automatically stop (and disappear from view), forcing you to <>Start it again when needed.

I do not know why you cannot edit, I'd imagine it has something to do with your postcount, but who knows

Edit: Yeah, there's no need for a clock noise, that's only in my example game for debugging purposes, so you can tell exactly when the timer is being set.

azure hunter 2006-11-10 08:16 AM

I was able to figure it out. Yes you were right. I didn't actaully set the clock. I also accidently set the variable of my herbs to its number. I.e. herb number 81 would have 81 tiicks before respawn. Just something i didn't understand at the time.

also with the clock quirk. If i only set the clock once, and only once. would it happen since i never set it a second time? And could it happen if i set the second timer right when it hits zero?

BlueCube 2006-11-10 12:05 PM

Quote:

Originally Posted by azure hunter
I was able to figure it out. Yes you were right. I didn't actaully set the clock. I also accidently set the variable of my herbs to its number. I.e. herb number 81 would have 81 tiicks before respawn. Just something i didn't understand at the time.

also with the clock quirk. If i only set the clock once, and only once. would it happen since i never set it a second time? And could it happen if i set the second timer right when it hits zero?

If you set the clock once, then the first time it hits zero, the clock will never work again in the game (obviously, the solution is to reset the clock every time you know it hits zero). Depending on how you have everything set up, it might also cause things to instantly respawn because it would keep checking to see if the clock was zero (thus making every 1/10 of a second a tick)

The second timer behaves the same way as the first one, and is completely separate, so in that situation the first timer would stop and the second timer would be set properly - but it would be hidden, and it wouldn't start until you told it to anyway.

azure hunter 2006-11-14 06:51 AM

I suppose My next question is, If I pick an Herb right when the clock hits zero, then the clock will stay at zero? making the herbs never disappear in the game and a player can continually pick the herbs since they never disappear. If this is what happens could i make and event so that whenever the clock is right on zero i can't pick the herbs just for that second, and so that when that event is activated the clock doesn't stay at zero?

BlueCube 2006-11-14 06:40 PM

No, the clock will reset instantly as usual, and it would basically subtract one tick total from the regrowth rate for that particular herb for that particular cycle

In practice you will never actually pick anything when the timer is zero, because as soon as it hits zero, the common event will activate and reset the timer back to whatever the tick length is.

However, if you DO pick it during that 1/500th of a second or whatever, here's what would happen:
  1. Your herb would have its regrowth rate set to its normal time
  2. Clock resets and regrowth is decremented by 1
And that's it, basically. All that would happen is that the herb effectively grows one tick faster for that cycle. The next time you pick it, it would behave as it normally would.

azure hunter 2006-11-15 06:34 AM

Okay okay i understand. Say i have the clock at 60 seconds and resets. and after 3 ticks an herb respawns after i pick it. but if i pick it at zero seconds it simply resets and takes away a tick so there is only 2 (2 minutes) ticks instead. right


All times are GMT -6. The time now is 09:27 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.