Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   looping question (https://forums.graalonline.com/forums/showthread.php?t=45174)

Azrael528 05-31-2003 07:24 AM

looping question
 
ok, i know how to do a basic loop like to make an npc continually slide in one direction or infinetly put leaps at certain coordinates, but how do i get an npc to move back and forth, usually you just use sleep or something but that screws up the loop

protagonist 05-31-2003 02:06 PM

Quote:

Originally posted by Kaimetsu
Move command
Timeouts/callback event

Hehe crap, and it was a question I actually could answer >_<;.

I like to use the x+=1 or y+=1 to slide NPCs around and use variable++ to determine how many spaces it slides.

Ningnong 05-31-2003 02:47 PM

Quote:


I like to use the x+=1 or y+=1 to slide NPCs around and use variable++ to determine how many spaces it slides.

yes, but he meant to move it back AND forwards.

If you didn't use the move command, then you would need to make a time function and set the value of the movement varible.

eg:

x-= this.move;

when the timer is at a certain time, this.move has a minus value, else it has a positive value.

- Thats just another way of doing it.

Since the move command does the job, I'd recommend using that - neat and tidy :)

protagonist 05-31-2003 04:10 PM

Quote:

Originally posted by Kaimetsu


Except that's a horribly inefficient method.

Not when you are trying to create a mini-game environment when the NPC bounces off of walls.

CheeToS2 05-31-2003 06:42 PM

if you don't want any time between it changing directions, you don't need timeout either.. add the right # to the end of the move command (see newfeatures2002) to make it call movementfinished, then use:
if(movementfinished){ (i could be wrong, make sure that event is right too)
move command here again
}

Pokilty 05-31-2003 06:49 PM

haha thats a nice sig cheetos :p

protagonist 05-31-2003 08:21 PM

Quote:

Originally posted by Kaimetsu


Yes, even when you are trying to create a mini-game environment where the NPC bounces off of walls.

Yeah, I was tired when I wrote that. :asleep:

tlf288 06-01-2003 05:51 AM

Quote:

Originally posted by protagonist


Yeah, I was tired when I wrote that. :asleep:

I think this excuse has been used to death.


All times are GMT +2. The time now is 06:07 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.