Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Scripted by Graal2007722
- //#CLIENTSIDE
- function onCreated() {
- showcharacter();
- this.head = "mum_head71.png";
- this.colors[0] = "orange";
- this.colors[1] = "black";
- this.colors[2] = "black";
- this.colors[3] = "black";
- this.colors[4] = "black";
- this.shield = "no-shield.png";
- setcharani("idle",NULL);
- this.ap = 50;
- this.nick = "Mary";
- this.speed = 0.25; // Customizable.
- this.range = 1; // Non-Customizable.
- onNewState();
- }
- function onNewState() {
- temp.state = randomstring("walk", "idle");
- if (temp.state == "walk") {
- this.ani = temp.state;
- this.isWalking = true;
- setTimer(random(3,8)); // Timer to choose arbitrary state.
- onNewDir();
- } else {
- this.ani = temp.state;
- this.isWalking = false;
- setTimer(random(3, 8)); // Timer to choose arbitrary state.
- }
- }
- function onNewDir(olddir) {
- this.dir = int(random(0,4));
- if (this.dir == olddir) {
- onNewDir(this.dir);
- }
- switch (this.dir) {
- case 0:
- onMove(this.dir);
- break;
- case 1:
- onMove(this.dir);
- break;
- case 2:
- onMove(this.dir);
- break;
- case 3:
- onMove(this.dir);
- break;
- }
- }
- function onMove(this.dir) {
- if (this.isWalking) {
- switch (this.dir) {
- case 0: // Move up.
- for (i = this.y; i > 4; i -= this.speed) {
- if (onwall(this.x,this.y - this.range)) { break; }
- if (!this.isWalking) { break; }
- sleep(0.01);
- this.y -= this.speed;
- }
- onNewDir(this.dir);
- break;
- case 1: // Move left.
- for (i = this.x; i > 4; i -= this.speed) {
- if (onwall(this.x - this.range,this.y)) { break; }
- if (!this.isWalking) { break; }
- sleep(0.01);
- this.x -= this.speed;
- }
- onNewDir(this.dir);
- break;
- case 2: // Move down.
- for (i = this.y; i < 60; i += this.speed) {
- if (onwall(this.x,this.y + this.range)) { break; }
- if (!this.isWalking) { break; }
- sleep(0.01);
- this.y += this.speed;
- }
- onNewDir(this.dir);
- break;
- case 3: // Move right.
- for (i = this.x; i < 60; i += this.speed) {
- if (onwall(this.x + this.range,this.y)) { break; }
- if (!this.isWalking) { break; }
- sleep(0.01);
- this.x += this.speed;
- }
- onNewDir(this.dir);
- break;
- }
- }
- }
- function onPlayerTouchsMe() {
- sleep(0.01);
- onNewDir(this.dir);
- }
- function onTimeout() {
- onNewState();
- }
Advertisement
Add Comment
Please, Sign In to add comment