Graal Forums

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

[email protected] 05-15-2009 11:20 PM

using 'move()'
 
I know the params, but what are the options to the flags (8+16) etc, I can't find them on the wiki....... thanks

napo_p2p 05-15-2009 11:37 PM

Options: cachetype(0,1,2) + blockcheck(4) + eventwhendone(8) + applydir(16)

Quote:

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)
I'll add something about it to the wiki when I get the chance.

cbk1994 05-16-2009 01:52 AM

Quote:

Originally Posted by /scripthelp move
Script help for 'move':
TServerNPC.move(float, float, float, int) - moves the npc smoothly, parameters are delta x, delta y, time and options: cache type (0, 1-cache, 2-append) + blockcheck(4) + eventwhendone(8) + applydir(16)

This might make it a bit more clear.

Loriel 05-16-2009 02:53 AM

An API reference that does not have a separate section for each function explaining the exact semantics of each parameter and the return value and whatever is a lousy API reference.

[email protected] 05-16-2009 07:30 AM

Thanks guys- just what I needed :)


Once an object has moved and is triggering to the server
has anyone else had any problems with using triggeraction?

It only seems to detect the object once it's finished moving and on a wall, if
it's on a non-blocking tile it's as though the trigger action isn't sent, any ideas?

Admins 05-16-2009 07:44 PM

The object itself is blocking? If it's using a gani then make sure it's using showcharacter or setshape.

[email protected] 05-18-2009 06:10 PM

HTML Code:

//Serverside
function onCreated() {
  this.showcharacter();
  this.ani = "gani";
    //Auto destroy in 15
  setTimer(15);
}

function onTimeout() {
  this.destroy();
}
function onActionTakeDart() {
  this.destroy();
}
//#CLIENTSIDE
function onCreated() {
  this.showcharacter();
}
function onPlayerTouchsMe() {
  triggeraction(this.x, this.y, "TakeDart", "");
}

no reason..

fowlplay4 05-18-2009 08:11 PM

On your serverside onCreated() put a setshape(1,32,32);

Then on your clientside triggeraction make it hit, this.x + 1 and this.y + 1.

Pelikano 05-19-2009 11:55 AM

Quote:

Originally Posted by fowlplay4 (Post 1492210)
On your serverside onCreated() put a setshape(1,32,32);

Then on your clientside triggeraction make it hit, this.x + 1 and this.y + 1.

Depends how big your object is of course...

[email protected] 05-19-2009 06:24 PM

Quote:

Originally Posted by fowlplay4 (Post 1492210)
On your serverside onCreated() put a setshape(1,32,32);

Then on your clientside triggeraction make it hit, this.x + 1 and this.y + 1.

Still doesn't work :(

salesman 05-19-2009 08:45 PM

Quote:

Originally Posted by [email protected] (Post 1492381)
Still doesn't work :(

The object is moving, right?

fowlplay4 05-19-2009 08:53 PM

Quote:

Originally Posted by [email protected] (Post 1492381)
Still doesn't work :(

Well why don't you just put onPlayerTouchsMe() on the serverside.

[email protected] 05-20-2009 04:25 PM

Quote:

Originally Posted by fowlplay4 (Post 1492418)
Well why don't you just put onPlayerTouchsMe() on the serverside.

Various reasons- already tried lol


It's stopped moving once the trigger is sent


All times are GMT +2. The time now is 01:46 PM.

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