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 03-13-2007, 11:36 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Object Movement

HTML Code:
function beginMovement()
  {
  this.getPosition();
  temp.movePosition = {
    (this.currentLocation[1] - this.x), 
    (this.currentLocation[2] - this.y)
  };
  this.dir = getdir(temp.movePosition[0], temp.movePosition[1]);
  this.ani = "walk";
  temp.moveDirs = {
    {1, {1.7, 1}}, {0, {-1.7, 1}}, {2, {1.7, -1.7}}, {3, {-1.7, -1.7}}
  };
  this.chat = "Moving towards" SPC this.currentLocation[0] @"!";
  
  for (temp.currentDirection: temp.moveDirs)
    if (this.dir == temp.currentDirection[0])
      for (temp.newAmount: temp.currentDirection[1])
        temp.moveAmount.add(temp.newAmount);   
  move((temp.movePosition[0] + temp.moveAmount[0]), (temp.movePosition[1] + temp.moveAmount[1]), 1, 8+16);
  }
function getPosition()
  {
  temp.randomLocation = int(random(0, this.warpLocations.size()));
  temp.newLocation = this.warpLocations[temp.randomLocation];
  if (temp.newLocation[0] != this.currentLocation[0])
    this.currentLocation = temp.newLocation;
   else
    this.getPosition();
  }
function onMovementFinished()
  this.ani = "idle";
Well, it is supposed to run through levels. I've tried adding
PHP Code:
  this.canwarp();
  
this.canwarp2(); 
Neither seem to solve this! Any solutions?
Reply With Quote
  #2  
Old 03-14-2007, 02:24 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Is it serverside or clientside?
And "canWarp();" should make it able to follow links.
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #3  
Old 03-14-2007, 08:40 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Serverside, doesn't seem to work I'm afraid :[
Reply With Quote
  #4  
Old 03-14-2007, 09:45 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Is it a level NPC, or a DB/putnpc2?
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #5  
Old 03-14-2007, 09:59 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Database
Reply With Quote
  #6  
Old 03-14-2007, 10:34 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
It should work if you do canwarp() and eventually also setshape() or showcharacter() so that the npc has a size and it can correctly check if the npc covers a link area
Reply With Quote
  #7  
Old 03-15-2007, 12:02 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Still nothing.
Era:
The script of NPC c_airShop has been updated by Chandler
Reply With Quote
  #8  
Old 03-18-2007, 05:29 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Anyone? Thanks
Reply With Quote
  #9  
Old 03-18-2007, 08:12 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
I'm not sure, but maybe make it join a class that handles the movement, tho I don't think it will make any difference, it's just how we done it on 2k1.
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #10  
Old 03-19-2007, 08:05 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Make the movement in a class?
Reply With Quote
  #11  
Old 03-19-2007, 08:44 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
It looks like it should work to me as long as it's a DB-NPC and you've set a shape and have the gmap in serveroptions and the level list. (Keep canwarp() in there too). The only problems I have ever had with something like this is that sometimes the npc takes a while to update its position for the client.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #12  
Old 03-19-2007, 08:58 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by napo_p2p View Post
It looks like it should work to me as long as it's a DB-NPC and you've set a shape and have the gmap in serveroptions and the level list. (Keep canwarp() in there too). The only problems I have ever had with something like this is that sometimes the npc takes a while to update its position for the client.
Even though move is being controlled over levels? [If you get this]
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 05:13 AM.


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