View Single Post
  #3  
Old 08-06-2001, 06:05 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
POST UPDATE
engine ..
NPC Code:

//the engine part
function move() {
disabledefmovement; //disable movement
for (this.i=0;this.i<this.SpacesToMove;this.i=this.i+t his.PlayerSpeed) { //loop
playerdir=this.PlayerDirection; //set direction of player
setplayerprop #c,#s(playermsg); //display message
playery+=vecy(this.PlayerDirection)*this.PlayerSpe ed; //move y
playerx+=vecx(this.PlayerDirection)*this.PlayerSpe ed; //move x
setani walk,; //set animation to walk
sleep .05; // sleep
}
enabledefmovement; //re-enable movement
setani idle,; //idle player animation
}


thats the engine.. to use it u just call it .. ill show u an example

NPC Code:

if (playerenters) {
this.SpacesToMove=5; //how many steps?
this.PlayerSpeed=.5; //Speed
this.PlayerDirection=2; //Direction 0=up, 1=left, 2=down, 3=right
setstring playermsg,Message; //Message for player to say
move(); //call function
}



but if you want the player to go a direction then go another direction and so on you just do
NPC Code:

if (playerenters) {
this.PlayerSpeed=.5;
//first walking part
this.SpacesToMove=5;
this.PlayerDirection=2;
setstring playermsg,First Part;
move();
//second walking part
this.SpacesToMove=10;
this.PlayerDirection=0;
setstring playermsg,Second Part;
move();
//third walking part
this.PlayerSpeed=1;
this.SpacesToMove=10;
this.PlayerDirection=3;
setstring playermsg,Third Part;
move();
}


If you notice you dont always need to change the playerspeed..
but I changed in the last part to make him walk faster.
there you go
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)

Last edited by LiquidIce00; 08-06-2001 at 06:20 AM..
Reply With Quote