Graal Forums

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

fuzie 08-06-2001 05:11 AM

Scripting Questions
 
whats the script for making the player talk and making him move??? And whats the script if you want a weapon to lay down a pic where the player is and was da script if u want it to do something if the player touches that pic in that x,y???PLZ HELP!!!!
Thanx,
EvileDemon













http://eternaldestiny.8m.com/

General 08-06-2001 05:12 AM

Okay, you'll ge tthe results of your drug test back in 24 hours

LiquidIce00 08-06-2001 06:05 AM

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 ;)

fuzie 08-07-2001 04:59 AM

Thanx Man
L8

LilNiglet 08-07-2001 09:15 AM

Quote:

Originally posted by 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 ;)

heheh

LiquidIce00 08-07-2001 12:43 PM

woops I found a problem..
if you change playerx or playery it re-enables def movement.
so put this for the engine
NPC Code:

//the engine part
function move() {
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
disabledefmovement; //disable movement
}
enabledefmovement; //re-enable movement
setani idle,; //idle player animation
}


(just moved the disabledefmovement in the loop)

and LilNiglet what was that post for?!?

fuzie 08-08-2001 11:57 PM

*yawn i noticed that

fuzie 08-09-2001 10:27 AM

the player walk is still messed up....

Brian

08-09-2001 10:34 AM

NPC Code:

setani walk,;
playerx+= 0.02;
timeout = 0.05;



like that.. also you people got to read other post, thats like my third time today post something like that.

LiquidIce00 08-09-2001 10:47 AM

Quote:

Originally posted by IcePick_2001
NPC Code:

setani walk,;
playerx+= 0.02;
timeout = 0.05;



like that.. also you people got to read other post, thats like my third time today post something like that.

read the thread before u post
and ur forggeting a timereverywhere =(


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

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