Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Server (https://forums.graalonline.com/forums/forumdisplay.php?f=14)
-   -   more scripting (https://forums.graalonline.com/forums/showthread.php?t=8120)

Bravo_LAT-Admin 07-26-2001 08:05 AM

more scripting
 
for this script it works fine offline but yet again won't work online with npcserver. What needs to be changed to get it to function properly:

if (playerenters) {
timereverywhere;
timeout=.05;
xmove=0;
ymove=0;
}
if(timeout){
timeout=.05;
if(playery<66&&playerx<64){
if(playersprite>0&&playersprite<9){
if(abs(xmove)<1.5){
if(playerdir=3)
xmove+=.1;
if(playerdir=1)
xmove-=.1;
}
if(abs(ymove)<1.5){
if(playerdir=2)
ymove+=.1;
if(playerdir=0)
ymove-=.1;
}
}
if(xmove>0){
if (!onwall((playerx+xmove+2),playery)&&
!onwall((playerx+xmove+2),(playery+1))&&
!onwall((playerx+xmove+2),(playery+2))){
playerx+=xmove;
xmove-=.05;
}else{
xmove=0;
}
}
if(xmove<0){
if (!onwall((playerx+xmove),playery)&&
!onwall((playerx+xmove),(playery+1))&&
!onwall((playerx+xmove),(playery+2))){
playerx+=xmove;
xmove+=.05;
}else{
xmove=0;
}
}
if(ymove>0){
if (!onwall(playerx,(playery+2+ymove))&&
!onwall((playerx+1),(playery+2+ymove))&&
!onwall((playerx+2),(playery+2+ymove))){
playery+=ymove;
ymove-=.05;
}else{
ymove=0;
}
}
if(ymove<0){
if (!onwall(playerx,(playery+ymove))&&
!onwall((playerx+1),(playery+ymove))&&
!onwall((playerx+2),(playery+ymove))){
playery+=ymove;
ymove+=.05;
}else{
ymove=0;
}
}
if(abs(xmove)<.05)
xmove=0;
if(abs(ymove)<.05)
ymove=0;
}
else{
ymove=0;
xmove=0
}
}

General 07-26-2001 08:18 AM

you must change everywhere it says if to else, and everywhere it says else to if

KJS 07-26-2001 09:19 AM

one thing I noticed just scrolling down really fast is your timeout

you have to timeout=0.1 (you cant do 0.05 on npc server unless it is clientside)

Bravo_LAT-Admin 07-26-2001 08:54 PM

ty
 
aww crap. Yeah this has to be serverside...hmmm maybe it'll look okay with that delay 0.o thx kjs

Falcor 07-27-2001 06:08 AM

That script could be cut down a lot using vector X and Y.... =\
Also there are some Really long stuff that dont need to be tehre butr ill let you figure it out. You learn better if its not done for you.

LiquidIce00 07-28-2001 05:13 AM

you can cut it down alot also by using an array of the onwall+loop instead of putting a whole bunch of if's

GarusRiblet 07-28-2001 06:04 AM

Quote:

Originally posted by Falcor
That script could be cut down a lot using vector X and Y.
yesh, and it would cut down on the lag to boot!:)


All times are GMT +2. The time now is 11:23 AM.

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