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.

Looking for some tips with events.

Alrighty, so what I am trying to do is use a function that returns 0-10 depending on certain conditions, and I want to directly use the numbers for pages 1-11 in events, any suggestions on how I can go about this? I am trying to make it as simple as possible as I have to make quite a few events that follow this method.
 
Could you be a little more descriptive?
If you mean you want 1 out of 11 pages to activate in an event, you could always use the Variable Condition feature (keep the first page none, the second page to "Variable == 1", etc). Then all you would need is a parallel process that modifies the variable depending on the circumstances.

If you need multiple events, however, they must all follow the same conditions, or use different variables. That could get tedious, and would probably require a bit of coding to simplify things.
 
I have a function that generates a number 0 - 10, if 1 comes up, the event will use page 1.. or something similar to that.

The problem is I will have ~ 100 events on the same map that use the same method, but based on where they are on the map a different number will return, so each time the base # changes the entire map generates differently, I did not want to have an idividual variable for every single event but I could use variables.

Let me try to describe this in better detail.

I am generating a number then adding (itself * event ID) which gives me a seed.
I then use the seed for rand(10).

So say in this case Event 001 returns 8 from rand(10), I want to use page 8 in the event, and I would prefer not to use variables because as I stated above. The idea is, for example Event 008 may be the same exact event as 001, but it would return a 3, which would give it a different state...did I lose ya yet? lol

I mean is it possible to have custom activation conditions or am I going to have to just use a variable per event? This is just for a sort of sidegame in the game I am making so I would prefer not to use 100 variables for it but I will if I have to.
 
I see what you mean. Your best bet would be to either code in a self-variable (ie independent to all but one event) or, if all/most events have this feature, recode the method of selecting pages to choose randomly.

For the former, check line 100 of "Game_Event" (assuming this is XP; VX might be different). You want to create a new "if" statement to check if the variable is a certain ID (your self-variable ID). If so, you then want to check a self-variable array (which you would randomly generate; see below). Unless it meets the condition, go to the "next" page. If the first "if" statement failed, use "elsif" to jump to the regular variable check.

Now you want to create a self-variable array. I would just create a new class, identical to Game_SelfSwitches, except with multiple values rather than just ON and OFF. Somewhere, you would need to randomly generate the self-variables based on your seeds.

If any of this was confusing, let me know and I'll elaborate :P
 
I am looking in Game_Event, I am curious is @page in reference to the current page the event is running? if so, couldn't I just use page 1 to change what @page = ??

Edit: nevermind, I tried this. adding a script of @page = 2 pushes the event to page 2, so all I have to do is
Code:
 

if rand_function == 0 

do nothing

else

@page = rand_function  

pretty simple lol.
 
Heh, that's what you get when you overthink things. While a self-variable may be useful for other things, your method is a lot simpler.

I'm curious though, if there are certain Conditions on that page, will they override the page change when the event updates?
 
It would since the conditions are actually defined and checked BEFORE the event is run, so if I place script inside the event to change @page, it would occur after it has already switched pages if there are activation conditions for another page. So in a sense, you could force it to go to another page if there are no conditions met, and still work different when the pre-built conditions are met.
 
I spent more time working with this, it really didnt work as expected... o well time to think somethin else up lol

For some reason even using variables, it just defaults to the last page. I am gonna pick it back up tomorrow and see what happens. I swear @page was working, I dunno lol.
 
Remember that events process from the highest page number whose conditions are met. I would suggest putting the "@page = X" on the last page, so even if it defaulted it would immediately change back.
 

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