Thank you for the information, it'll definitely be useful in later scripting projects.
Especially the exponential one.
. . .
Having a weird new error though. Attempted to sort it out to no avail.
For some reason the Sprite with RandomMovement() attached keeps facing north.
At first, I figured it was being caused by:
if (Direction == Wait && Face == undefined) {QueuePersonCommand(Name, Face_south, false);}
else {QueuePersonCommand(Name, Tiles, Face, false);} //If Direction commands sprite to Wait. It simply faces
However it has nothing to do with Facing North, and logic instead says Faces South when left undefined.
So that definitely couldn't have been it. Continuing on...
Was wanting to add a Wait to the end of the directions during RandomMovement()
Why? The sprite kept changing direction so swiftly and wanted to slow him down.
Take a breather ya know?
So I added:
Move(name, Uniform(2, 9), Wait);
And also attempted adding a Face_direction behind 'Wait' appropriately to each line.
So changed the (face==undefined && Direction == Wait) code in the Move() function to:
QueuePersonCommand(Name, SetPersonDirection(Name, GetPersonDirection(Name)), false);
And now got this weird error:
In no part of my code is the sprite being told to head 'northeast'
so why is it even returning 'northeast' as a direction?
. . .
For reference, here's what the RandomMovement() function looks like now:
function MoveRandom(name) {
if (DoesPersonExist(name) == true) {
var direct = Uniform(0, 4);
var tiles = rng.random(1, 4);
if (direct == 0) {Move(name, tiles, Wait);}
if (direct == 1) {QueuePersonCommand(name, Face_north, false); Move(name, tiles, North, Face_north); Move(name, Uniform(2, 9), Wait);}
if (direct == 2) {QueuePersonCommand(name, Face_south, false); Move(name, tiles, South, Face_south); Move(name, Uniform(2, 9), Wait);}
if (direct == 3) {QueuePersonCommand(name, Face_east, false); Move(name, tiles, East, Face_east); Move(name, Uniform(2, 9), Wait);}
if (direct == 4) {QueuePersonCommand(name, Face_west, false); Move(name, tiles, West, Face_west); Move(name, Uniform(2, 9), Wait);}
}
}