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.

Inteligent way to extend use of self switching for more than 5 page events??

I thought this may have been asked already, but I couldn't find it in the forums

Brief:
I have an event (page one) that is consumed by the player and then has the appearance of gradually reappearing on the map (page 2,3,4,5.) (N.B. I know I am being really picky with this one.)

The event is split up into pages so as after exiting the map and returning, the gradually reappearing item will be at the stage it was last at when the player left the map. (Not ideal, i would prefer it to continue growth in realtime)

I use a common event called from page one to perform player interactions on the item(it has several possible outcomes), then page 2,3,4, and 5 are used as stages of the reappearance, with a wait command and a switch change to move it along. Doing it this way I have only three graphical options, page two needs to remain empty. I know I am being greedy, but I would like a smoother animation rather than having only three frames left to me so to speak.

I have tried using a common event for the regrowth stage, but when returning to a visited map, the common event is recalled, and resets the regrowth, only after regrowth has completed would the map event reset to it's original starting position.

As I have wrote this I have had a thought. Do parallel common events, update the local switch of an event, when the map is no longer the same map that called the event? Any ideas would be much appreciated. Seemed a simple idea when I started writing it.

Many thanks in advance
 
<scratching head....>

It's hard to tell exactly what you are shooting for without an example. So, based on your description I'll make one up. (humor me, it helps to use something tangible.)
Let's say your event is a carrot, and the user picks it, then it slowly grows back.

First, if you use a character set (carrot.png), you have 16 images to work with.
You start on the top left, and increase the size down that column using the 'Turn' command. To change to the next column, use the "Change Graphic" command.

I would create a variable called "Carrot_Height" which will have a value from 0 (no graphic) to 16 (fully grown).

You want it to appear that it has grown even if you've left the map & returned. Set another variable "Carrot_Planted" equal to the game time when it was picked. Then, when you enter that map again, compare that time to the current game time, and display the appropriate graphic. (autorun event that executes once on entering map).

Make sense?

If I'm way off on my example, give me a better one!  :)

Be Well
 
Nearly spot on there with your example :)

The item in question is a harvest node. the problem I am having is that nearly all maps will have one and some with have a few, so to write a variable switch for each would use up many switches. If I had one more local switch problem would be nearly solved (enough for me to be satisfied with anyway ;) )

Example of operation:
Player approaches Harvest node (herb patch - possibility of harvesting different HP heal and SP heal items, increases with harvesting skill), Player starts harvest > map event calls common event > Common event checks skill and chance of harvest > Harvest completed and map event changed to no graphic by switching to page two with a local switch adjusted by the common event. Player continues on their way > After a short while blank map event flips a page, using another local switch, and appears as a small tuft of grass (tiny), if player remains on map, event continues to flip through two more pages (until I run out of local switches) and returns to it's usual state.

By using local switches, I can ensure that each single map event captures it's own status and remains at any given stage if the map is exited and returned to.

If I use a common event, to include more graphic changes ( so growth is more smooth), exited and returning to a map, resets the common event if it did not complete.

I require the harvest nodes to take some time to return else it will flood the game with heals, ditto for other harvest nodes and their produce.

I might just stick with the three graphics for regrowth to keep it simple, I just thought their might be an intelligent way around it. I shall give your idea a go. I assume you mean to use the the mentioned variables in the second with conditional branching comparing time against time stamp.

Cheers
 
This is not a bump as it was still at the top at time of writing...There are not enough hours in the day, by the time I am on here fiddling with RMXP, I am half falling asleep at my keyboard.

Anyway back on topic, I am unable to use the Carrot variable example as this would require many variable switches, no idea how many nodes I will be having, but each would need there own or a set proportion of the total node variable switch set.

I will stick with the growth happening in three stages, it's quite passable as an in game effect and why complicate things needlessly.

Thanks for taking the time to read...(if there is a solution I would still like to know, it may have other applications)
Please excuse my poor punctuation, when I am tired English seems to become my second language, first being zzzzzz
 

poccil

Sponsor

My script based switches script includes "event-based variables", which are specific to a particular event.  You could use it to store the state of an event, for example, whether it's a seedling, sprout, or full-grown plant:
Code:
  Script:  setVariable(1)
In your case, the variable here could represent that the event is a seedling, and higher numbers would mean more advanced growth stages.  (If necessary, add the line "$game_map.need_refresh=true" if the map's state needs to be refreshed afterwards.)
To check the value of an event-based variable, either use a Conditional Branch:
Code:
   Conditional Branch:  Script:  getVariableAsInt==1
       -- variable is 1 --
   Branch End
Or use a switch with a certain name as one of the conditions of the event page:
Switch s:varAsInt==1 is ON

Also, self switches (what you call "local switches") are in practice not limited to four per event.  To set further self-switches, you can use this
script (part of my script-based switch script):
Code:
  # turns on self switch E
  Script:  setSelfSwitch(get_character(0),"E",true)
Code:
  # turns off self switch E
  Script:  setSelfSwitch(get_character(0),"E",true)

To check whether such a self-switch is on, use a switch whose name is, for example, s:isOn?("E")

Remember, however, that common events cannot set self-switches, nor do they have event-specific variables.
 
Thank you for that, I will take a look at your script. Still getting used to scripts.

When you say common events cannot set self-switches, I am guessing you mean within itself as they have none, but they can set the local switch of the event that called the common event.
 

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