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 01-07-2004, 11:28 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
move

This is most likely a bug but I thought I would just post it here first.

NPC Code:

if ( created ){
this.speed = 0.5;
message Ask me to "Come Here".;
}

if ( playerchats ){
if ( strequals( #c , Come Here ) ){
this.movex = playerx + vecx( playerdir ) * 2;
this.movey = playery + vecy( playerdir ) * 2;
move();
message Coming sir.;
}
}

function move(){
this.dx = this.movex - x;
this.dy = this.movey - y;
this.dis = ( this.dx ^ 2 + this.dy ^ 2 ) ^ 0.5;
this.time = this.dis * this.speed;
setcharani walk,;
move this.dx , this.dy , this.time , 1 + 4 + 8 + 16;
}

if ( movementfinished ){
if ( x != this.movex || y != this.movey ){
message A wall is in the way.;
}else{
message Here.;
}
setcharani idle,;
}

//#CLIENTSIDE

if ( created ) {
// Initialize the attributes
showcharacter;
setcharprop #3 , head212.png;
setcharprop #C0 , orange;
setcharprop #C1 , black;
setcharprop #C2 , black;
setcharprop #C3 , black;
setcharprop #C4 , black;
setcharprop #2 , no-shield.png;
setcharprop #n , Bob;
shieldpower = 1;
dir = 2;
}



This is a basic npc, it uses the move command to come to you when you ask it too. It is serverside.

It works fine offline. But online it will stop moving, but continue to walk at a standstill. And when called to move again it will warp to the spot it was trying to get to and continue from there.

I really want the move command to work here. :-/ Suggestions? Common ailments? Have you encountered the same?
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #2  
Old 01-07-2004, 11:46 PM
Hevaricubed Hevaricubed is offline
Registered User
Join Date: Aug 2003
Posts: 262
Hevaricubed is on a distinguished road
Send a message via AIM to Hevaricubed Send a message via Yahoo to Hevaricubed
ew. whitespace.

I always have trouble with move, i just assumed its buggy, i never move more than one tile distance at a time.
__________________
Reply With Quote
  #3  
Old 01-07-2004, 11:47 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
I have been informed by a few people that it is move.

Move must be fixed! It has a lot of potential if the serverside can work like the clientside. :-/
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #4  
Old 01-07-2004, 11:54 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
NPC Code:

if (created){
message Ask me to "Come Here".;
}

if (playerchats){
if (strequals(#c,Come Here)){
move();
message Coming sir.;
}
}

function move(){
this.dx = playerx-x;
this.dy = playery-y;
this.dis = (this.dx^2 + this.dy^2)^0.5;
this.angle = getangle(this.dx,this.dy);
i = 0;
gox = x;
goy = y;
while (i<this.dis){
newx = gox + cos(this.angle);
newy = goy - sin(this.angle);
if (onwall(newx+1.5,newy+2) || onwater(newx+1.5,newy+2))
break;
gox = newx;
goy = newy;
i++;
}
if (i > 0) {
setcharani walk,;
move gox-x,goy-y,2,1+4+8+16;
}
}

if (movementfinished){
message Here.;
setcharani idle,;
}

Reply With Quote
  #5  
Old 01-08-2004, 01:54 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
A temporary solution at best, Half the point of move is so I can do all that without having to run extensive wall checks servside.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #6  
Old 01-08-2004, 03:10 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally posted by adam
A temporary solution at best, Half the point of move is so I can do all that without having to run extensive wall checks servside.
How does move imply that you don't have to do wall checks?
__________________
Reply With Quote
  #7  
Old 01-08-2004, 03:33 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by adam
A temporary solution at best, Half the point of move is so I can do all that without having to run extensive wall checks servside.
The move wall check isn't even that good clientside, if I remember correctly
Reply With Quote
  #8  
Old 01-08-2004, 04:37 AM
Hevaricubed Hevaricubed is offline
Registered User
Join Date: Aug 2003
Posts: 262
Hevaricubed is on a distinguished road
Send a message via AIM to Hevaricubed Send a message via Yahoo to Hevaricubed
move checks onwall after movement has finnished x.x
__________________
Reply With Quote
  #9  
Old 01-08-2004, 04:46 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by Python523


The move wall check isn't even that good clientside, if I remember correctly
Neither was the temporary solution you gave me. And trying to do it any better would use far too much of the server's resources for my taste. I do plan on having lot's of things all over the server move. And having the move function work correctly would help.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #10  
Old 01-08-2004, 04:54 AM
Hevaricubed Hevaricubed is offline
Registered User
Join Date: Aug 2003
Posts: 262
Hevaricubed is on a distinguished road
Send a message via AIM to Hevaricubed Send a message via Yahoo to Hevaricubed
jagens move thing works fine

offline + running in a timeout of 0.05, according to my debugger it uses 0.0234215 or something of my cpu usage, and i have a very crappy machine.
__________________
Reply With Quote
  #11  
Old 01-08-2004, 06:46 AM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
Quote:
Originally posted by adam
Neither was the temporary solution you gave me. And trying to do it any better would use far too much of the server's resources for my taste. I do plan on having lot's of things all over the server move. And having the move function work correctly would help.
That's the EXACT same problem I have. Doing extensive checking to make sure things don't hit a wall (ACCURATELY) is very resource intensive... compared to other scripts at least.
__________________
Kat
Reply With Quote
  #12  
Old 01-08-2004, 05:41 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Jagen's script edit.

NPC Code:

if (created){
showcharacter;
setcharprop #3,bomy_golg0.png;
setcharani g2k2bomy_idle,;
setstring this.name,Bomy;
message Ask me to "Come Here".;
timeout = 0.05;
}
if (playerchats){
if (strequals(#c,Come Here)){
move();
message Coming sir.;
}
}

function move(){
this.dx = playerx-x;
this.dy = playery-y;
this.dis = (this.dx^2 + this.dy^2)^0.5;
this.angle = getangle(this.dx,this.dy);
i = 0;
gox = x;
goy = y;
while (i<this.dis){
newx = gox + cos(this.angle);
newy = goy - sin(this.angle);
if (onwall(newx+1.5,newy+2) || onwater(newx+1.5,newy+2))
break;
gox = newx;
goy = newy;
i++;
}
if (i > 0) {
setcharani g2k2bomy_walk,;
move gox-x,goy-y,2,1+4+8+16;
}
}
if (movementfinished){
message Here.;
setcharani g2k2bomy_idle,;
}

if(timeout){
showtext 0,x+0.3,y+2.5,,,#s(this.name);
changeimgzoom 0,0.8;
changeimgvis 0,1;
timeout = 0.05;
}

__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #13  
Old 01-09-2004, 01:51 PM
D1ce2 D1ce2 is offline
Registered User
Join Date: Dec 2003
Location: United Kingdom
Posts: 446
D1ce2 is on a distinguished road
Send a message via AIM to D1ce2 Send a message via Yahoo to D1ce2
I could make it worse but I'm not up to the challenge
__________________

The time is coming
Reply With Quote
  #14  
Old 01-09-2004, 03:20 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by osrs
Jagen's script edit.

NPC Code:

stuff

Why didn't you just do setcharprop #n eludes me...
Reply With Quote
  #15  
Old 01-09-2004, 04:05 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Quote:
Originally posted by Python523
Why didn't you just do setcharprop #n eludes me...
Because it looks better
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
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 06:53 AM.


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