Hello.
I need to move a NPC character to multiple coordinate locations.
I need him to move to location A then B then C and so on and so forth.
But I do not want the script to be blocked as I want the player character to be doing stuff as the NPC is moving around.
So i cant use walk or move with a blocking feature.
I thought about using an int and with each number added having it to tell it to then go to the new location but I cant do that without blocking eighter.
Whats the best way to script it so the NPC moves around to all these multiple locations and does not block script.
Quote from: jamesreg on Tue 01/06/2010 17:10:27
Hello.
I need to move a NPC character to multiple coordinate locations.
I need him to move to location A then B then C and so on and so forth.
But I do not want the script to be blocked as I want the player character to be doing stuff as the NPC is moving around.
So i cant use walk or move with a blocking feature.
I thought about using an int and with each number added having it to tell it to then go to the new location but I cant do that without blocking eighter.
Whats the best way to script it so the NPC moves around to all these multiple locations and does not block script.
Is there a reason you can't use eNoBlock?
But wouldnt that just keep fireing all the other lines so in effect he would walk to my last location or somehting and not go from location 1 to location 2 to location 3 and so forth?
Basically something like this:
The room variable:
int characterLocation;
Also you put this in the room's Repeatedly Execute Always since you probably want the NPC to walk around during the Player's blocking moments and such.
function repeatedly_execute_always()
{
if (!theCharacter.Moving) //only check if the NPC isn't moving
{
if (characterLocation==1)
{
theCharacter.Walk(100, 100, eNoBlock);
characterLocation==2;
}
else
if (characterLocation==2)
{
theCharacter.Walk(200, 100, eNoBlock);
characterLocation==3;
}
else
if (characterLocation==3)
{
theCharacter.Walk(150, 200, eNoBlock);
characterLocation==1;
}
}
}
characterLocation==0 can be when the NPC isn't in one of those locations. When you start his cycle, you'll have to change the characterLocation variable to whichever location he's going to.