Any possible scripts that would allow for random enemy encounters on event tiles?

dealwithitdewott

Villager
Member
Joined
Jun 19, 2016
Messages
13
Reaction score
0
First Language
English
Primarily Uses
I've been testing out my game as of late and one of the maps uses event tiles heavily, however I've hit a roadblock where I also want the map to have random enemy encounters, however it seems that enemy encounters don't spawn on tiles already occupied by events. Is there any workaround to this? Like something I could modify in the scripts for the game or any new custom scripts I could add to the game? I'd really appreciate a bit of help here.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,863
Reaction score
5,538
First Language
Indonesian
Primarily Uses
RMVXA
however it seems that enemy encounters don't spawn on tiles already occupied by events
There is no "spawn" function. The question is how you spawn an enemy? Is it a script you get from the internet or eventing that you make it by yourself? I assume you use a visual encounter and somewhat spawns the enemy randomly.
 

dealwithitdewott

Villager
Member
Joined
Jun 19, 2016
Messages
13
Reaction score
0
First Language
English
Primarily Uses
There is no "spawn" function. The question is how you spawn an enemy? Is it a script you get from the internet or eventing that you make it by yourself? I assume you use a visual encounter and somewhat spawns the enemy randomly.
I'm not using any scripts for the enemy encounters, I meant "spawn" as in when a random encounter occurs. Perhaps I could have worded that better, but you should get the point now, random enemy encounters aren't working when I have my characters walk on event tiles basically.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,568
Reaction score
6,892
First Language
German
Primarily Uses
RMMV
how are you making those tiles and what are their functions?
usually you would simply add a battleprocessing and code your own battle-chance on the event tile
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,863
Reaction score
5,538
First Language
Indonesian
Primarily Uses
RMVXA
random enemy encounters aren't working when I have my characters walk on event tiles basically.
I haven't tried this myself and I might try that later when I have a chance to open RM, but how did you confirm that it actually happened? Was it simply because your map is full of cosmetic tile events and you happened to trigged not in these tiles? Or do you have a concrete testing method that it is actually what happened?
 

dealwithitdewott

Villager
Member
Joined
Jun 19, 2016
Messages
13
Reaction score
0
First Language
English
Primarily Uses
how are you making those tiles and what are their functions?
usually you would simply add a battleprocessing and code your own battle-chance on the event tile
Well the map I'm working on uses a minimap script that doesn't seem to function as I intend it to, the icons that are supposed to show up for tiles aren't so I have to put in commands on events for each tile just to get that function working. I'll admit that the process is rather impractical and I'd probably benefit more if I'd have asked how to make the icons appear in the first place, but it's a little too late to change that now anyways. The script is Tidloc's minimap I believe. As for battle processing, if I were to resort to that, what would I have to code in to have it be random? I'm not exactly wanting to have a battle occur every time the player steps on a tile.

I haven't tried this myself and I might try that later when I have a chance to open RM, but how did you confirm that it actually happened? Was it simply because your map is full of cosmetic tile events and you happened to trigged not in these tiles? Or do you have a concrete testing method that it is actually what happened?
To make sure that the event tiles were the problem I had removed a few event tiles and set the frequency for the random encounters to be a single step, and that led me to the conclusion that random encounters don't show up when the player walks over an event.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,863
Reaction score
5,538
First Language
Indonesian
Primarily Uses
RMVXA
To make sure that the event tiles were the problem I had removed a few event tiles and set the frequency for the random encounters to be a single step, and that led me to the conclusion that random encounters don't show up when the player walks over an event.
What if you do the opposite, set the encounter rate at low, 2 or 3 steps and make sure your character always walks at the tile with events?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,568
Reaction score
6,892
First Language
German
Primarily Uses
RMMV
As for battle processing, if I were to resort to that, what would I have to code in to have it be random?
there are several ways to do this, I'll describe the easiest way. Variants should be obvious from there.

1) control variable temp=random between 1 .. 100
you can add more control variable to make it a more complex formula, including adding step counters and so on. The result has to be a number, in this case it's a random number between 1 and 100

2) conditional branch temp>95
With a check of >95 on random 1-100 the condition will be true in one of twenty rolls, which means that one of twenty steps will trigger the battle on average.

3) battle processing, chosing random troop or whatever you want. you can even make your own formula selection for troop ID.


However it would be a better solution to bughunt the minimap
 

dealwithitdewott

Villager
Member
Joined
Jun 19, 2016
Messages
13
Reaction score
0
First Language
English
Primarily Uses
there are several ways to do this, I'll describe the easiest way. Variants should be obvious from there.

1) control variable temp=random between 1 .. 100
you can add more control variable to make it a more complex formula, including adding step counters and so on. The result has to be a number, in this case it's a random number between 1 and 100

2) conditional branch temp>95
With a check of >95 on random 1-100 the condition will be true in one of twenty rolls, which means that one of twenty steps will trigger the battle on average.

3) battle processing, chosing random troop or whatever you want. you can even make your own formula selection for troop ID.


However it would be a better solution to bughunt the minimap
Bughunting? Is that like going through the script and looking for whats wrong? Even if I did have coding knowledge, I'm afraid there might not be anything wrong with the code. I've copied the script from a demo the script's creator had made, and the script worked fine in the demo. I had also copied all the graphical assets associated with the script, so things should be working fine, and yet the tiles don't appear on the map still.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,863
Reaction score
5,538
First Language
Indonesian
Primarily Uses
RMVXA
So you didn't respond to my reply. And now I had a chance to test it in an actual project and it's happening.
Screenshot_68.jpg
itshappening.gif
Let me ask it once again, are you sure?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,568
Reaction score
6,892
First Language
German
Primarily Uses
RMMV
Bughunting? Is that like going through the script and looking for whats wrong?
not exactly.

in 99% of all cases the scripts themselves are bug-free and the problem is caused either by wrong configuration or incompatibility between two different scripts. And that are points that could be checked without any coding knowledge.

From your description it sounds as if you never bothered to check the configuration, you just copied everything and assumed that it would work. But there are a lot of scripts that require data to be configured for the project they're used in.
And because you didn't give a link to the website of the mapscript we can't check if there is anything special that needs to be configured.
 

Traverse

Veteran
Veteran
Joined
Jul 3, 2014
Messages
129
Reaction score
80
First Language
English
Primarily Uses
So you didn't respond to my reply. And now I had a chance to test it in an actual project and it's happening.
I'm guessing the events in question that are being used are Touch events.

By default, the engine will purposely fail to update the random encounter progress counter under one of several conditions:
1) Game_Map's instance of Game_Interpreter is running (i.e. an Autorun event is in effect).
2) A Touch event has been triggered. It can't be a blank-page event either, otherwise it doesn't count as an event, there has to be something on page, even if it's just an empty Comment.
3) The player is in an airship, has the Encounter None feature active or is being moved by a Move Route event command.
4) The developer presses the Ctrl button to activate noclip during game testing.

The code for this is contained in Game_Player:
Ruby:
  #--------------------------------------------------------------------------
  # * Processing When Not Moving
  #     last_moving : Was it moving previously?
  #--------------------------------------------------------------------------
  def update_nonmoving(last_moving)
    return if $game_map.interpreter.running? # Fails check so long as Autorun event is running.
    if last_moving
      $game_party.on_player_walk
      return if check_touch_event # Fails check if Touch event is triggered, which is everytime player steps on one.
    end
    if movable? && Input.trigger?(:C)
      return if get_on_off_vehicle
      return if check_action_event
        # ^^ These don't actually completely fail the check. It seems that after the player moves into a vehicle, the
        # update is called again at some point along the way. So the player can encounter while boarding vehicles.
    end
    update_encounter if last_moving
  end
  #--------------------------------------------------------------------------
  # * Update Encounter
  #--------------------------------------------------------------------------
  def update_encounter
    return if $TEST && Input.press?(:CTRL) # Fails if the Noclip is being used.
    return if $game_party.encounter_none? # Fails if Encounter None feature is active.
    return if in_airship? # Fails if in airship.
    return if @move_route_forcing # Fails if player is Move Routed.
    @encounter_count -= encounter_progress_value
  end
You have two options - alter the base code to ignore Touch Events and update the encounter counter anyway. Or manually update the counter on the Touch Events you want there to be encounters on.

If you want to manually update the counter, you can use this Script Call, encounters will trigger after whatever other event commands in the Touch Event finish running:
Ruby:
$game_player.update_encounter
Otherwise you'll be removing/commenting out the line "return if check_touch_event" in the base code, though I wouldn't recommend it since there may be Touch Events somewhere else in your game where you might not want to let random encounters trigger afterwards.

@Andar
in 99% of all cases the scripts themselves are bug-free and the problem is caused either by wrong configuration or incompatibility between two different scripts. And that are points that could be checked without any coding knowledge.
Not necessarily with incompatibility, that one tends to need some coding knowledge. Because you can get scripts that ARE actually compatible with each other... if you put one above the other in the Script Editor (because one overwrites a Method and the other only aliases it). You won't know that for sure unless you can tell/guess which Methods were being accessed by which scripts and that needs a bit of coding knowledge.

Yes, you can try swapping around all your scripts randomly and pray something works, but if you have a lot of scripts that's basically throwing darts blind and hoping to hit a bullseye.
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,837
Reaction score
12,251
First Language
English
Primarily Uses
RMMV
Perhaps you should disable the other scripts and see if the random encounters spawn on those tiles without the other scripts.

If someone gives you a mod to make it happen, but it's already happening by default and it's one of your scripts that's stopping it, then a mod might not work either.

And I think you're better off getting that minimap script fixed, rather than adding heaps of events to compensate for it not working. Never a good idea to throw on bandaid after bandaid to cover up something that's broken. Always better to fix the broken thing.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Welp, finally posted some images to Twitter that I meant to post last year... Better late than never, right?
Just going to leave this here. :LZSexcite:
Going for a spooky theme with my animal crossing home/town. All I gotta do is find that one gravestone recipe out of hundreds for my cemetary ; u;
Asthma has been getting worse because I can't get my paws on a brown (preventer) inhaler. Been without one for over a week now. Struggling to breathe sucks.
I'm wondering, what if I took the time to make a Bee Hive mirco-biome. It sounds cute, and be a home to that hornet monster, but would anyone actually use it?

Forum statistics

Threads
95,781
Messages
931,896
Members
126,197
Latest member
Sinnott
Top