Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-14-2005, 08:08 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Plane

Back by request, the thread I deleted! XD Feel free to respond =D (still having trouble with signs and x y in level, but i decided to work on it alone, help wouldn't hurt though , especially with teh signs)
Quote:
Okay, I'm making a plane for playeruse, only problem is that while flying the player can read signs, and enter buildings(warp out of buildings isn't working right, only for x and y)here's my script, suggestions?
NPC Code:
if (actionserverside) {
if (strequals(#p(0),warp)) {
setlevel2 #s(client.planelevel),#s(client.planex),#s(client. planey);
}
}
//#CLIENTSIDE
// NPC made by Excaliber&&Shadox
if (keypressed&&strequals(#p(1),C)) {
if (this.inuse == 0) {
this.inuse=1;
enableweapons;
setstring client.planespeed,1.25;
timeout=.05
}
else {
timeout = 0;
enabledefmovement;
setstring client.planespeed,0;
this.inuse=0;
hideimg 747;
enableweapons;
}
}

if(timeout&&this.inuse==1&&!isonmap){
triggeraction 0,0,serverside,Plane,warp;
enabledefmovement;
hideimg 747;
this.inuse=0;
}
if (timeout && this.inuse == 1&&isonmap) {
setani idle,;
disabledefmovement;
this.planex=#v(playerx);
this.planey=#v(playery);
setstring client.planex,#v(playerx);
setstring client.planey,#v(playery);
setstring client.planelevel,#L;
if(playerdir==0){
showimg 747,dr-planeN.png,playerx-1,playery-1.5;
}
if(playerdir==2){
showimg 747,dr-planeS.png,playerx-1,playery-1.5;
}
if(playerdir==1){
showimg 747,dr-planeW.png,playerx-1,playery-1.5;
}
if(playerdir==3){
showimg 747,dr-planeE.png,playerx-1,playery-1.5;
}
hideplayer .05;
if (keydown(0)) {
hideimg 747;
showimg 747,dr-planeN.png,playerx-1,playery-1.5;
playerdir = 0;
playery-=strtofloat(#s(client.planespeed));
}
if (keydown(1)) {
hideimg 747;
showimg 747,dr-planeW.png,playerx-1,playery-1.5;
playerdir = 1;
playerx-=strtofloat(#s(client.planespeed));
}
if (keydown(2)) {
hideimg 747;
showimg 747,dr-planeS.png,playerx-1,playery-1.5;
playerdir = 2;
playery+=strtofloat(#s(client.planespeed));
}
if (keydown(3)) {
hideimg 747;
showimg 747,dr-planeE.png,playerx-1,playery-1.5;
playerdir = 3;
playerx+=strtofloat(#s(client.planespeed));
}
if (keydown(0)&&keydown(3)) {
hideimg 747;
showimg 747,dr-planeNE.png,playerx-1,playery-1.5;
}
if (keydown(0)&&keydown(1)) {
hideimg 747;
showimg 747,dr-planeNW.png,playerx-1,playery-1.5;
}
if (keydown(2)&&keydown(3)) {
hideimg 747;
showimg 747,dr-planeSE.png,playerx-1,playery-1.5;
}
if (keydown(2)&&keydown(1)) {
hideimg 747;
showimg 747,dr-planeSW.png,playerx-1,playery-1.5;
}
changeimgzoom 747,1.5;
changeimgvis 747,2;
timeout=.05;
}

if (weaponfired) {
say2 Plane:#b
Press C to take off#b
then, C to land.#b
}


Last edited by excaliber7388; 10-14-2005 at 08:39 PM.. Reason: formatted a wee bit better :)
Reply With Quote
  #2  
Old 10-14-2005, 08:28 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
I didn't request that you spam the forums with threads you already made, I was simply mentioning it for future reference.

A quick glance at that script and I have noticed very poor scripting habits, aswell as syntax errors (I see a few missing semi-colons.) Please do not try to distribute scripts for other people to use unless they are, by standards, scripted decently. Poorly written scripts can be very misleading to beginners.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #3  
Old 10-14-2005, 08:33 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Well, it wasn't formatted in anyway (I can already hear Skyld scolding me XD) but it does work, except for the reading thing and the x y in the warp, i know thats far off
Reply With Quote
  #4  
Old 10-14-2005, 08:35 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by excaliber7388
Well, it wasn't formatted in anyway (I can already hear Skyld scolding me XD) but it does work, except for the reading thing and the x y in the warp, i know thats far off
I wasn't referring to the formatting. But just out of curiosity, if you know Skyld is going to scold you for it, why do you continue to not format your scripts?
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #5  
Old 10-14-2005, 08:37 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
i scripted it quick, didn't feal like wasting time, ill format it now x_X anyway, suggestions for the reading and x y part of the warp?
Reply With Quote
  #6  
Old 10-14-2005, 08:46 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by excaliber7388
i scripted it quick, didn't feal like wasting time, ill format it now x_X anyway, suggestions for the reading and x y part of the warp?
Why would other people waste their time trying to help you, if you don't want to waste your time formatting it so they can read it?

anyway, for the x,y warping, you have to use strtofloat.

NPC Code:
setlevel2 #s(client.planelevel),strtofloat(#s(client.planex)  ),strtofloat(#s(client.planey));



Another thing, client. variables are very insecure, people will be able to abuse this script to make it warp them to wherever they want on your server.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #7  
Old 10-14-2005, 08:48 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
ill switch to clientr. :/
Reply With Quote
  #8  
Old 10-14-2005, 08:55 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by excaliber7388
(I can already hear Skyld scolding me XD)
Nice to know you are beginning to take what I say on board. Now you just need to do as other nice forum users say and actually format your scripting nicely.
Quote:
Originally Posted by ApothiX
NPC Code:
setlevel2 #s(client.planelevel),strtofloat(#s(client.planex)  ),strtofloat(#s(client.planey));



Another thing, client. variables are very insecure, people will be able to abuse this script to make it warp them to wherever they want on your server.
A string list may be better suited to your needs.

NPC Code:
setstring clientr.plane,<level>,<x>,<y>; // Set the level, x and y
replacestring clientr.plane,0,<newlevel>; // Want to replace just the level?
replacestring clientr.plane,1,<newx>; // Or just the x?
setlevel2 #I(clientr.plane,0),strtofloat(#I(clientr.plane,1) ),strtofloat(#I(clientr.plane,2)); // And warp the player

__________________
Skyld
Reply With Quote
  #9  
Old 10-14-2005, 09:08 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
like this? Because I'm having trouble getting this to work (other way was better, that warped me to the level, but not X+Y, this does nothing x_X)
NPC Code:
setlevel2 #I(clientr.plane,0),strtofloat(#I(clientr.plane,1)  ),strtofloat(#I(clientr.plane,2));
//#CLIENTSIDE
setstring clientr.plane,<#L>,<#v(playerx)>,<#v(playery)>;

Reply With Quote
  #10  
Old 10-14-2005, 09:12 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
You can't set clientr. strings clientside.
__________________
Skyld
Reply With Quote
  #11  
Old 10-14-2005, 09:14 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
i changed it to clientside, just for testing, but now it just says 'Failed' in the corner
Reply With Quote
  #12  
Old 10-14-2005, 09:15 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by excaliber7388
i changed it to clientside, just for testing, but now it just says 'Failed' in the corner
Sounds like a problem with the setlevel2. 'Failed' usually appears when a warp has, well, failed.

Still, you can not write to clientr. strings clientside. You'd have to play with this serverside.
__________________
Skyld
Reply With Quote
  #13  
Old 10-14-2005, 09:22 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
here's what I'm currently using (triggeraction under #CLIENTSIDE line)
NPC Code:
if (actionserverside) {
if (strequals(#p(0),fly)&&isonmap) {
setstring clientr.plane,#L,#v(playerx),#v(playery);
}
}
if (actionserverside) {
if (strequals(#p(0),warp)) {
setlevel2 #I(clientr.plane,0),strtofloat(#I(clientr.plane,1) ),strtofloat(#I(clientr.plane,2));
}
}

Reply With Quote
  #14  
Old 10-14-2005, 09:25 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
You should really put if(isonmap) before the triggeraction, helps filter out unnessesary lag.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #15  
Old 10-14-2005, 09:31 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
It is, but still wont warp ;(
Reply With Quote
Reply


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 02:30 PM.


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