Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[RESOLVED] Creating events in RGSS

Hiyo! Even though I already know how to script, I am still just a beginner and need some help.

Well, what I need to know is how do I create events using scripts. You see, what I want to do is like, if you have a seed, you can plant it in the ground. I have it scripted where the seed will be planted, but I don't know how to make it an event where it will then show the graphic. Then when its fully grown, you can like... press enter and "talk" to it. And if it has a fruit, it adds it to your inventory.

I really DON'T want to use an event, because if I do, it will cause ALOT of lag and is more trouble than its worth.

If there is another way to do what I want to do with scripts, please tell me. I DON'T need anyone to make this for me, I just want to know how one function is done.

If you help, I will be forever edebted to you!
 
here's what I suggest:
-make an empty event wherever you can plant the seed.
-use a time system, which has:
1)a clock
2) ability to save the current time.
3)ability to check how much seconds passed since the saved time.
I know there is such system, but I forgot its name.

when the player has the item 'seed', say: "you planted the seed",
and create a "plant": plant.new (map id, event id).
inside 'plant' class: each plant will need a map id, event id, time it was planted(use the time script to save the current time), and stage (seed, plant, fruit). save all plants inside an array, say, $game_plants. in initialize method, add the new plant to the array- $game_plants.push(self) .
make a method to update all plants: if x minutes passed from the planting time, update the event's graphic & stage. call this method inside 'update' method of the time script. to avoid lag, only call it once in a minute- if the second on the clock is 0.
to decide if it gives fruit: whenever you set the plant's stage to fruit, set the event's self switch A to true.
in the event, make it give you fruit if self switch A is ON.
 

e

Sponsor

Out of kindness for the others, once you've resolved a particular problem, it would be a good idea to post your solution. I'm sure it'll help out anyone who ever bumps in the same problem. :thumb:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top