Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > NPC Server
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-06-2001, 07:52 AM
RawPower RawPower is offline
Godd Bye
RawPower's Avatar
Join Date: Mar 2001
Location: Canada
Posts: 3,554
RawPower is on a distinguished road
Send a message via ICQ to RawPower Send a message via AIM to RawPower
Script Question

Ok since Faheria is set in more of a modern day civilization, we are replacing the horses with cars that you can buy that last forever til you have to refill the fuel at a gas station. Anyways I dont think the NPC Server is supporting it, perhaps there is something wrong with this script that is not making it work online? Please help, thanks.


NPC Code:
if (created) {
message Car Key;
}
if (playertouchsme) {
toweapons Car Key;
setstring carfuel,100;
}
function HitCheck() {
for (this.p=1; this.p<playerscount; this.p++) {
if (abs((this.px)-(players[this.p].x+1.5))<=1 &&
abs((this.py)-(players[this.p].y+1.5))<=1.5){
hitplayer this.p,2,this.px,this.py;
}
}
}
if (weaponfired) {
disabledefmovement;
this.key4=0;
playerdir=2;
if (car1) {
setani INVsportscarin,;
}
if (suv1) {
setani INVsuvin,;
}
sleep .8;
this.fuel=strtofloat(#s(carfuel));
set caron;
timeout=.05;
}
if (caron) {
if (timeout) {
if (this.fuel>100) {
this.fuel=100;
}
this.key0=1;
this.key1=1;
this.key2=1;
this.key3=1;
if (car1) {
setani INVsportscar,;
}
if (suv1) {
setani INVsuv,;
}
if (this.skate=1.5) {
if (playerdir=0) {
this.px=playerx+1.5;
this.py=playery-2;
}
if (playerdir=1) {
this.px=playerx-2;
this.py=playery+1.5;
}
if (playerdir=2) {
this.px=playerx+1.5;
this.py=playery+5;
}
if (playerdir=3) {
this.px=playerx+5;
this.py=playery+1.5;
}
}
if (keydown(0)||keydown(1)||keydown(2)||keydown(3)) {
if (this.fueltime=0) {
this.fuel-=.05;
this.fueltime=8;
}
this.fueltime-=1;
if (this.skate<1.5) {
this.skate+=.05;
}
if (keydown(0)) {
if (onwall(playerx+1,playery-.5)||
onwall(playerx+2,playery-1.1)) {
this.key0=0;
}
}
if (keydown(2)) {
if (onwall(playerx+1,playery+3.5)||
onwall(playerx+2,playery+4.1)) {
this.key2=0;
}
}
if (keydown(1)) {
if (onwall(playerx-.5,playery+1)||
onwall(playerx-1.1,playery+2)) {
this.key1=0;
}
}
if (keydown(3)) {
if (onwall(playerx+3.5,playery+1)||
onwall(playerx+4.1,playery+2)) {
this.key3=0;
}
}
if (keydown(0)) {
if (this.key0=1) {
playery-=this.skate;
}
playerdir=0;
}
if (keydown(1)) {
if (this.key1=1) {
playerx-=this.skate;
}
playerdir=1;
}
if (keydown(2)) {
if (this.key2=1) {
playery+=this.skate;
}
playerdir=2;
}
if (keydown(3)) {
if (this.key3=1) {
playerx+=this.skate;
}
playerdir=3;
}
}
if (!keydown(0)&&!keydown(1)&&!keydown(2)&&!keydown(3 )) {
if (this.skate>0) {
this.skate-=.05;
}
if (playerdir=0) {
if (onwall(playerx+1,playery-.6)||
onwall(playerx+2,playery-1.1)) {
this.skate=0;
}
playery-=this.skate;
}
if (playerdir=1) {
if (onwall(playerx-.5,playery+1)||
onwall(playerx-1.1,playery+2)) {
this.skate=0;
}
playerx-=this.skate;
}
if (playerdir=2) {
if (onwall(playerx+1,playery+3.5)||
onwall(playerx+2,playery+4.1)) {
this.skate=0;
}
playery+=this.skate;
}
if (playerdir=3) {
if (onwall(playerx+3.5,playery+1)||
onwall(playerx+4.1,playery+2)) {
this.skate=0;
}
playerx+=this.skate;
}
}
HitCheck();
setstring carfuel,#v(this.fuel);
this.fuel=strtofloat(#s(carfuel));
showimg 555,sysfuel.gif,15,160;
showimg 556,carfuel.gif,17,170;
showimg 554,speedometer.gif,15+(this.skate*66),200;
changeimgpart 556,0,0,this.fuel+1,7;
changeimgvis 555,4;
changeimgvis 556,4;
changeimgvis 554,4;
if (this.fuel<=0) {
TurnOff();
}
if (playerhearts=0) {
TurnOff();
}
if (keydown(4)&&this.key4=1) {
TurnOff();
}
if (keydown(5)&&this.skate>.05) {
this.skate-=.1;
}
if (this.key4=0) {
this.key4wait+=.05;
if (this.key4wait=1) {
this.key4=1;
this.key4wait=0;
}
}
timeout=.05;
}
}

function TurnOff () {
hideimg 555;
hideimg 556;
hideimg 554;
playerdir=2;
if (car1) {
setani INVsportscarout,;
}
if (suv1) {
setani INVsuvout,;
}
unset caron;
freezeplayer .8;
enabledefmovement;
}



Yes I know it doesnt use arrays =\ but this is mainly a beta its just testing the movement and such.
__________________
Farewell graalians...

Last edited by RawPower; 07-06-2001 at 08:52 AM..
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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