This is probably beginner script but, how do I make a NPC wander around the screen?
I'm not sure how to do it with the walkable areas messing it up. NPC walks off in one direction, randomly pauses.
This will be a 'cleaning' character.
Thanks!
in the room's repeatedly execute:
if (character[NAMEOFCHAR].walking!=1){
MoveCharacter(NAMEOFCHAR, Random(320),Random(200));
}
that should do it yes no?
Quote from: MrColossal on Sun 16/11/2003 20:03:02
in the room's repeatedly execute:
if (character[NAMEOFCHAR].walking!=1){
MoveCharacter(NAMEOFCHAR, Random(320),Random(200));
}
that should do it yes no?
Would that mean the player character could do his actions while NAMEOFCHAR is sort of minding his business in the background?
yup, i've done it tons of times, it's quite neat
only thing is it's random, so they'll just walk around bumping into walls and heading off in the strange directions
so it's best for birds or cats or robots or maids
not trying to trick someone into thinking the character has an agenda
many thanks from me allso ive been doing it with all this messy stuff!
if (IsTimerExpired(1)==1)
{int ran=Random(7);
if (ran==0) MoveCharacter(GDTWO,character[GDTWO].x-36,character[GDTWO].y);
else if (ran==1) MoveCharacter(GDTWO,character[GDTWO].x+34,character[GDTWO].y);
else if (ran==2) MoveCharacter(GDTWO,character[GDTWO].x,character[GDTWO].y-36);
else if (ran==3) MoveCharacter(GD,character[GD].x+34,character[GD].y);
else if (ran==4) MoveCharacter(GD,character[GD].x,character[GD].y-36);
else if (ran==5)MoveCharacter(GD,character[GD].x,character[GD].y+36);
else MoveCharacter(GDTWO,character[GDTWO].x,character[GDTWO].y+36);
SetTimer(1,200);
}
then put this in enters room after fade in
SetTimer(1,200);
you saved me a lot of messing around !
great source this forum many thanks all!
Thank you! I think I can make this a function then and tell a character to wander after each conversation is over.
It should also work with a group of insects I wanted swarming above the swamp! Thanks again!