Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Documentation on move() (https://forums.graalonline.com/forums/showthread.php?t=134267878)

Vatec 02-11-2013 05:08 AM

Documentation on move()
 
Hi everyone, I have searched around and have been unable to find valid documentation on move(); such as what the parameters do, if someone would be kind to link me to modems documentation or just post it here it would be much appreciated.

DustyPorViva 02-11-2013 05:16 AM

PHP Code:

- New script command: move dx,dy,time,options;
  
dx - delta x
  dy 
- delta y
  time 
- time in seconds
  options 
- cachingmode (0,1 or 2) + blockcheck (4 or 0) +
    
informmewhendone (8 or 0) + applydirection (16 or 0)
  
This moves the npc without needing you to update the
  position of the npc 
'manually' by changing x and y.
  
To move an npc 10 tiles to the right, then 10 tiles to
  the left 
and again, just do following:
  if (
created) {
    while (
true) {
      
move 10,0,4,0;
      
sleep 4;
      
move -10,0,4,0;
      
sleep 4;
    }
  }
  
This moves the npc 10 tiles to the right, then waits 4
  seconds
, then moves it 10 tiles to the left, then waits
  4 seconds
, and repeats this endlessly.
  
The good thing is that this also works with server-side
  npcs 
and makes them look like they are moved on client-side.
  
There are also nice options to makes things very simple:
  - 
cachingmode:
    - 
0: previous movements will be finished immediatelly
    
- 1: movements will be cached, the previous movements
         will only be finished when the cache is too large
         
(distance to go >5);
         
this caching can be used on server-side npcs to
         make the movement look like non
-laggy even when
         there are little delays sometimes
    
- 2: the movement will just be appended to the movement
         
list; you can add up to 100 movements
  
- blockcheck: add 4 to the options when you want the
    npc to stop when there is a wall blocking the npc
  
- informmewhendone: if you add 8 to the options then the
    script will be called with a 
'movementfinished' flag
    when the the npc has stopped walking
; catch this event
    with
    
if (movementfinished) {...}
    if 
you want to do something when the npc has stopped
    
(e.g. walking in a different direction)
  - 
applydirection: add 16 to the options if you want the
    game to automatically set the direction of the npc
    depending on the movement direction 
(can be good
    when using movement caching
) 


Vatec 02-11-2013 05:34 AM

Thanks Dusty.


All times are GMT +2. The time now is 01:16 AM.

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