Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Reload this Page [Essentials script] Better Random Move Routes for NPCs

For all updates, view the main page.

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Thread Tools
Old October 2nd, 2014 (08:31 AM). Edited October 2nd, 2014 by mej71.
mej71's Avatar
mej71 mej71 is offline
Join Date: Mar 2014
Location: Omnipresence
Gender: Male
Posts: 715
Moves the desired NPC in a (seemingly) more natural move route. Moves in a random direction still, but continues that path for a random number between 1 and 4.

Basically, just add this in a new section

def pbBetterRandom(eventid)
  character = get_character(eventid)
    # If no character exists
    if character == nil
      # Continue
      return true
    if numToMove>0
      numToMove.times do
        if character.passable?(character.x,character.y,directionpass)
Make you event look like this one. Should be parallel process, the "23" should coordinate to your desired event, and have a Wait X frames command before that. The wait command makes sure the event doesn't move overly fast.

Can be called for a different event than it's placed on (for instance, I could keep my example event but change the 23 to 22, and event 22 would move instead).
Reply With Quote
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are UTC -8. The time now is 11:23 PM.