Changing event image randomly without using event pages

Here's the new harold event, per your instructions.

View attachment 303840

Unfortunately still no images 🙁 The console:

View attachment 303841
We are close! I can feel it.

Sorry, do this for the 2nd line of the script call (the reduce line):
JavaScript:
eventId = eventId.reduce...
That was my mistake - I forgot about the datamap part of the 2nd eventId assignment.
Just change out the $dataMaps.events.reduce to eventId.reduce and it should work.

@cuby let me know - this should do it and it shouldnt conflict with anything you had before.
So here is the newest Control Harold:

2024-05-02 04_06_20-Window.png


Did I get it right?

Still no images though 🙁

Appreciating the help, let me know if you have any thoughts!
So here is the newest Control Harold:

View attachment 303843

Did I get it right?

Still no images though 🙁

Appreciating the help, let me know if you have any thoughts!
No. It needs to be eventId not eventID.
Lowercase d.

Close but no dice lol.

It should work after that.
No. It needs to be eventId not eventID.
Lowercase d.

Close but no dice lol.

It should work after that.

Massive difference after this change! Not quite what we want though, but we now have images! I'm excited 🙂

2024-05-02 04_14_08-Window.png


Each of those bus-backs is a garbage event. It seems to have latched onto that one tile in the tilesheet?

I'm with you -- you got this 😀

EDIT Oops nevermind, it was my bad!!

I changed the random number of the tile and we have this!

2024-05-02 04_17_48-Window.png


I think I just need to dial in the random numbers and we have our solution.

I'm exhausted but I'll check back in tomorrow to close out the thread -- amazing work dude! I might need a touch of help with these numbers (never quite understood how it works) but clearly you've worked it out.

Awesome!!

EDIT 2: Might have spoke too soon -- whereas the images now seem to work, the player touch events no longer work as they did before.

They are now functioning as "same as players" events rather than "below characters". I cannot move over the events as I used to be able to. They block me! Might this be solvable if I edit the B Tilesheet and edit the passability of the tiles?
Massive difference after this change! Not quite what we want though, but we now have images! I'm excited 🙂

View attachment 303846

Each of those bus-backs is a garbage event. It seems to have latched onto that one tile in the tilesheet?

I'm with you -- you got this 😀

EDIT Oops nevermind, it was my bad!!
Your last change of Math.randomInt(1) + 200 means that it is always set to tileId 200. Change it back to Math.randomInt(8) + 40 and that will fix the random garbage tiles.

Massive difference after this change! Not quite what we want though, but we now have images! I'm excited 🙂

View attachment 303846

Each of those bus-backs is a garbage event. It seems to have latched onto that one tile in the tilesheet?

I'm with you -- you got this 😀

EDIT Oops nevermind, it was my bad!!

I changed the random number of the tile and we have this!

View attachment 303847

I think I just need to dial in the random numbers and we have our solution.

I'm exhausted but I'll check back in tomorrow to close out the thread -- amazing work dude! I might need a touch of help with these numbers (never quite understood how it works) but clearly you've worked it out.

Awesome!!

EDIT 2: Might have spoke too soon -- whereas the images now seem to work, the player touch events no longer work as they did before.

They are now functioning as "same as players" events rather than "below characters". I cannot move over the events as I used to be able to. They block me! Might this be solvable if I edit the B Tilesheet and edit the passability of the tiles?

When you touch the events, they are supposed to selfswitch to page 2 which is supposed to be set to below characters. If you set page 1 to below characters, it will not interact with the player. Double check what I have (plus what we just worked on to update everything - make those changes as necessary) and compare it to what you have. You'll notice in my video that I was able to just walk right through the garbage and it disappears (player touch activates common event).

Be sure to review your events and double check those pages. Page 1 should be set to run the common event garbage and same as characters so you can touch them with player touch. Page 2 of garbage events should have self switch A checked on and set to below characters.
We have success @bass2yang !

Reset the numbers as you indicated. The event pages were set up correctly, the problem indeed was passability settings on the B Tileset. Once I cleared that up, everything works perfectly, as does the reset function. You're a wizard!

I think to tie it all up, I wonder if I could ask just one final question, since I just can't seem to wrap my aged brain around Math.randomInt. I'll do the proper study on it for sure but for now, if I continue adding garbage images (just in the left column of the tileset), lets say I add another row of 8 garbages, I would change "(8) + 40" to "(16) + 40", yes?

But that's it! Thanks tons for holding my hand through this, it's a big deal for my project and super appreciated.
We have success @bass2yang !

Reset the numbers as you indicated. The event pages were set up correctly, the problem indeed was passability settings on the B Tileset. Once I cleared that up, everything works perfectly, as does the reset function. You're a wizard!

I think to tie it all up, I wonder if I could ask just one final question, since I just can't seem to wrap my aged brain around Math.randomInt. I'll do the proper study on it for sure but for now, if I continue adding garbage images (just in the left column of the tileset), lets say I add another row of 8 garbages, I would change "(8) + 40" to "(16) + 40", yes?

But that's it! Thanks tons for holding my hand through this, it's a big deal for my project and super appreciated.
Awesome! That's good to know that passability also affects the event since it is utilizing the tile ID - I will make note of that.

Math.randomInt(8) + 40 basically means "Randomly choose from 8 integers (0-7) and add 40 to it", making the range 40-47.

Correct! Math.randomInt(16) + 40 is "randomly choose from 16 integers (0-15) and add 40 to it", making the range 40-55.

You are welcome and I'm glad it worked out for you!

When working with the engine, always approach it with the event commands first until you know that a script call or a plugin would be more efficient or is needed. As you have already experienced, debugging took the longest, but you also learn a lot about the engine as well. Basically, event commands are RTP/preloaded script calls to the corescripts of the engine), script calls are custom event commands, and plugin commands are simple to read/write (depending on the plugin)
syntax that calls a custom group of functions and makes them work together to extend the system (as defined by the plugin).

Seeing that this mechanic would have needed several pages of event commands, variables, conditions, etc. (which would have been harder to set up since it was unable to use some of the powerful functions like filter/reduce/for-of without a script call), it was better (at least from my perspective currently) to create a script call for it (really, only a couple of lines when you think about it).

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/changing-event-image-randomly-without-using-event-pages.168137/