• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Eevee Expo's webhost has been having technical issues since Nov. 20th and you might be unable to connect to our site. Staff are also facing issues connecting, so please send a DM to Cat on-site or through Discord directly for faster service!
Resource icon

v21.1 Randomly Rotating NPCs 2024-11-14

This resource pertains to version 21.1 of Pokémon Essentials.
Pokémon Essentials Version
Non-applicable
This ressource is an edit of the turn_random function that is part of base RMXP code, so it should theorically be compatible with any past and future version of Essentials and possibly with PSDK too.

What does it do exactly?

With this ressource, you can make any of your NPCs turn randomly. This feature is present is official games, especially for Trainers (I think they're informally called "Rotatoes" or something like that). However, keep in mind that this won't make your NPCs automatically turn toward the player when running near them like they do in (for example) Diamond and Pearl.

How to install?
  • First, look for def turn_random in the script editor (as of Essentials version 21.1, it is located in [[Game classes]] > Game_Character).
  • Then go to this page or click the Download button, and copy everything.
  • Back to the script editor, paste it between def turn_random and def turn_toward_player, and that's it!
PVRMdMd.png


How does it work?
As said earlier, this is an edit (and more exactly an extension) of the turn_random function.
Let's take turn_random_UD as an example : the UD at the end means that any NPC that is called to use this function will randomly turn up and down. The exact same logic is used for the four direction (U is up, D is down, L is left and R is right).
NPCs can also choose between three directions. In that case, you can call a function like turn_random_URD, to make it randomly choose between up, right and down.

If you want a full list of all available functions, you can find it below:
  • turn_random_UD
  • turn_random_RL
  • turn_random_UR
  • turn_random_UL
  • turn_random_DL
  • turn_random_DR
  • turn_random_ULD
  • turn_random_URD
  • turn_random_LUR
  • turn_random_LDR

How to setup an NPC?
This is pretty straightforward.
- First, change the autonomous mouvement type to Move Route
gwZKWA6.png

- Then click on Move Route to enter the editor and insert the script adapted to the random movement you want. Add a Wait function after that, and select Repeat Action at the bottom of the window, and there you go!
xnxBY9D.png

In this example, the NPC will randomly turn to face down or right every 32 frames. If the NPC is looking down and the random number chose by the function instructs it to turn down, it will stay in that position until it is instructed to turn right, and vice-versa.
You can pick any number you want for the Wait function, but I've personnally been satisfied with 32 frames, plus I think this is the number used for the Gen 3 games.

That's it for the tutorial. Have fun with this ressource, and please reach out to me if you encounter any issue with it!
Credits
Credit if used:
ChromusSama (not required, but appreciated)
Author
ChromusSama
Downloads
4
Views
8
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from ChromusSama

Back
Top