Autonomous Movement Multi Line Script Calls?

KingHazeel

Veteran
Veteran
Joined
Jul 5, 2018
Messages
125
Reaction score
5
First Language
English
Primarily Uses
RMVXA
I'm not sure if this belongs here or in a scripting section. The question is more involved with the feasibility of the idea than the actual scripting itself (though that would be helpful), but basically I'm trying to set up an NPCs Autonomous Movement in a way that I think will involve multiple script calls and I'm wondering if this is even possible.

To be more precise, I want an event to travel between multiple other events at random. I can have Event 1 travel to Event 2 with a script call, but say I wanted Event 1 to travel between Event 2, Event 3, and Event 4 at random, well then surely I would need to create a variable and then put this variable in where I would normally put an event number. This requires two lines of scripts, one to establish the variable and one for the move route script call to send Event 1 to the random event.

Also, let's say that Event 3 is erased. Well now I want Event 1 to only travel between Event 2 and 4. Though I'm flexible and could settle with a self switch check of other events. Either way, when an event is removed, I don't want my first event to travel to it anymore.

The move route options both seem to only support one line of script. Is what I'm proposing even possible with these limitations or is there a way to work around it?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,645
Reaction score
5,284
First Language
Indonesian
Primarily Uses
RMVXA
This requires two lines of scripts, one to establish the variable and one for the move route script call to send Event 1 to the random event.
Clamp it into a method by making your own method. Put this as a new script.
Code:
class Game_Character
  def your_custom_method
    # put your script call here
  end
end
Then in move route script call, you can just write it as
Code:
your_custom_method
I assume you know what to write
 

KingHazeel

Veteran
Veteran
Joined
Jul 5, 2018
Messages
125
Reaction score
5
First Language
English
Primarily Uses
RMVXA
I...do not, this was more to check if doing it was even possible, but if I'm understanding the general principle it would be something like this, right?

Code:
class Game_Character
  def special_event_id
    # Gather all events with "Special" commented on top. Maybe store them all in a dynamic array? I'm not sure how that works in Ruby.
    # Pick a random event.
    # Return id of said event
  end
end
And then call it in a way like this?

Code:
move_towards(special_event_id)
EDIT: Oh and add another condition to check if a self switch is on or the event is erased.
 
Last edited:

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

Latest Threads

Latest Profile Posts

I been rather busy lately with non RM projects so, it will take some time for me to release something.
Hmmmm, nice site UI change.
Swapped back to my original meds, but the flippity floppity has me reeling. T ^T I have game making and song collabs to do, hurry up, health. lol
It took me 6 retries to get the color of Yoshi I wanted. 30 mins of recording. 30 mins of voice work. Probably another 20 mins of waiting in between takes. But finally I got him...
I bought a 2 week emergency food supply. And people are already making fun of me :( I'll be fed for a bit while they go hungry when food supplies get cut(for whatever reason).

Forum statistics

Threads
93,678
Messages
914,526
Members
123,270
Latest member
carugatti
Top