Change event graphic rdm

Hello again,

i could need a scriptcall for changing the graphic of an event to an random graphic.
All sprite sheets that it should change to are named in the same way:

"fighter_001_1"
"fighter_002_1"
"fighter_003_1"

the 001, 002, 003 etc should be random the number after that not.
also its everytime the same row/character, just on another spritesheet
Maybe someone has an idea?
You don't need a script call for that. You can simply use Control Variable to set a variable to a random number.

Then you can either:
- have Conditional Branches for the possible values, and use a Set Movement Route to change the image
- or, if you want the image to stay changed, have a different event page for each possible value of the variable with the appropriate image on it
You don't need a script call for that. You can simply use Control Variable to set a variable to a random number.

Then you can either:
- have Conditional Branches for the possible values, and use a Set Movement Route to change the image
- or, if you want the image to stay changed, have a different event page for each possible value of the variable with the appropriate image on it
sure, but i have over 80+ possible fighter sprites that it should random turn into... i would like to not set 80+ conditional branches for every possible outcome.
Don't you think a script call is possible?
Of course it's possible. But you didn't mention you had that many possibilities, so it made sense to provide the easy solution first.

The important thing to note about not using event pages is if you leave the map and come back, the image will reset to whatever is defined on the page.

You set a variable to a random value - I'll use variable 69, you change the numbers to be whatever you like.

Including the leading zeros is actually a bit of a pain, so I'd suggest renaming your files without them. (e.g. fighter_1_1 to fighter_80_1, etc.).

Control Variables -> Random -> 1-80
Script -> this.character().setImage("fighter_" + $gameVariables.value(69) + "_1", 0)
Of course it's possible. But you didn't mention you had that many possibilities, so it made sense to provide the easy solution first.

The important thing to note about not using event pages is if you leave the map and come back, the image will reset to whatever is defined on the page.

You set a variable to a random value - I'll use variable 69, you change the numbers to be whatever you like.

Including the leading zeros is actually a bit of a pain, so I'd suggest renaming your files without them. (e.g. fighter_1_1 to fighter_80_1, etc.).

Control Variables -> Random -> 1-80
Script -> this.character().setImage("fighter_" + $gameVariables.value(69) + "_1", 0)


sorry! forgot to give that info, cause i didn't think you could give me the easier info first XD
you were totaly right, if I have less options, i would choose conditional branches 🙂

also yes! i will rename the files! didn't think the zeros could be a problem with that!
it works great! thank you so much for your help! QwQ
@ATT_Turan (sorry to tag you, if its bothering you Iam sorry) or anyone other,

Do you have an idea, how to change the image of the character, but the row on the same sheet per scriptcall?
Because I have a random character sprite, I can't just use the moveroute, I would need a script call were I can use a variable number or something like that to change the current sprite.
Maybe better explained:
I want my hero to have little animations for actions like... swimming... hitting u know?
I have the animation for that on the same sheet as the walking sprite.
With the moveroute I can do: change graphic -> change row (e.g. row 2 for hitting) -> stepping animation on -> stepping animation off -> change graphic row 0 for walking again

It works, but as I said I would need that as script call to change the animation for the random hero Iam playing right now.

Maybe something like this?
this.character()._characterIndex = 5;

Is there a way to just change the row and back? Iam bad at explaining, Iam sorry
Yes, but you might find it easier to use one of the poses plugins.

Original thread: https://forums.rpgmakerweb.com/threads/change-event-graphic-rdm.165660/