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
  #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..
  #2  
Old 07-06-2001, 08:46 AM
Er1c Er1c is offline
Registered User
Er1c's Avatar
Join Date: Mar 2001
Location: Chicago, IL
Posts: 791
Er1c is on a distinguished road
Use the "
NPC Code:
" and "

tags, cant see whats wrong when its all messed up.
__________________
Eric Kraft
  #3  
Old 07-06-2001, 08:47 AM
Er1c Er1c is offline
Registered User
Er1c's Avatar
Join Date: Mar 2001
Location: Chicago, IL
Posts: 791
Er1c is on a distinguished road
Ok, quotes didn't work... use the [ code ] and [/ code ] tags without the spaces.
__________________
Eric Kraft
  #4  
Old 07-06-2001, 10:30 AM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
NPC Code:
 if (strequals(#a,Torankusu)) {set leet;} 

__________________
Quote:
Originally posted by Spark910
Think befreo you type.
  #5  
Old 07-06-2001, 03:04 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
I don't see a setshape 1,width,height; command in that script, and since it's on the NPC Server you'll need that.
__________________

  #6  
Old 07-07-2001, 04:28 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
yes toweapons works, just playertouchsme sucks on npc server. Setshape doesnt matter with this script its just not working for some reason =\
__________________
Farewell graalians...
  #7  
Old 07-07-2001, 04:53 AM
Er1c Er1c is offline
Registered User
Er1c's Avatar
Join Date: Mar 2001
Location: Chicago, IL
Posts: 791
Er1c is on a distinguished road
Quote:
Originally posted by Kaimetsu
But is it a database NPC? And, does toweapons even work on the NPC Server? Either way, addweapons would be preferable.
Thats not the kind of thing you use addweapon with... addweapon adds a weapon thats already in the weapons database, which got there from a separate NPC that used toweapons.
__________________
Eric Kraft
  #8  
Old 07-07-2001, 12:38 PM
Brady2 Brady2 is offline
Registered User
Brady2's Avatar
Join Date: Mar 2001
Location: Phoenix, AZ and Wichita Falls, TX
Posts: 924
Brady2 is on a distinguished road
I do not remember if it matters or not
but put == instead of = to check values

if (this.key0==1) ;
__________________
  #9  
Old 07-07-2001, 01:32 PM
Brady2 Brady2 is offline
Registered User
Brady2's Avatar
Join Date: Mar 2001
Location: Phoenix, AZ and Wichita Falls, TX
Posts: 924
Brady2 is on a distinguished road
-Posted by Jadis

Don't keydowns have to be under //#CLIENTSIDE ?

Last edited by Brady2; 07-07-2001 at 01:38 PM..
  #10  
Old 07-07-2001, 03:46 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Quote:
Originally posted by Brady2
-Posted by Jadis

Don't keydowns have to be under //#CLIENTSIDE ?
It's a weapon, weapons are always clientside.
__________________

  #11  
Old 07-07-2001, 10:19 PM
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
This weapon works fine offline....Im trying to figure out why it dont work online. I've tried putting //#CLIENTSIDE and it said the server got illegal data from my connection and disconnected me =\
__________________
Farewell graalians...
  #12  
Old 07-08-2001, 02:52 AM
BocoC BocoC is offline
Registered User
BocoC's Avatar
Join Date: Jun 2001
Location: Washington State, USA
Posts: 980
BocoC is on a distinguished road
Send a message via AIM to BocoC Send a message via Yahoo to BocoC
That is because toweapons MUST be server side.
__________________
-Boco

FLKJH$TRFG*$(&%>FMG >REN<>F ;.kjsd
  #13  
Old 07-08-2001, 04:08 AM
kyle0654 kyle0654 is offline
-. .`
kyle0654's Avatar
Join Date: Mar 2001
Posts: 1,000
kyle0654 will become famous soon enough
NPC Code:

setstring carfuel,#v(this.fuel);
set caron;


try
NPC Code:
setstring client.carfuel,#v(this.fuel);


and instead of set caron;, try:
NPC Code:
this.caron = true;


(do this.caron=false when you're done, and check with this.caron==true to see if it's on)

You can only set client.strings and flags from a clientside script, and I think a variable would do better for a temporary thing anyway (this.caron)

also, yah, these are all wrong:
NPC Code:

if (playerdir=0) {


they need to be
NPC Code:

if (playerdir==0) {

 


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 07:29 AM.


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