Page 1 of 1

Mouvement function add

Posted: Thu Jan 22, 2009 4:53 pm
by alfa
I have spend 2 hours for try to do it with the original function but this is a nightmare :P

This is possible to add something to the original function for force NPC to do a circle ?
I mean can we set a central point and force mob to turning arround on a certain distance ?
And in addition can we set just a part of the circle ?

Re: Mouvement function add

Posted: Thu Jan 22, 2009 5:01 pm
by Scatman
The MovementLoopAddLocation function is used really for what its named for, to make a loop. Go to point A, then to point B, then to point C, there are no more points so begin at part A and repeat. What I did to make a generic circle script was before the loop was started, get the spawn's initial x, y, z and make a loop of their spawn location, so it can be applied to any spawn without any hardcoded numbers besides the offsets, and even those can be randomly generated if you wish to have larger or smaller circles.

Re: Mouvement function add

Posted: Thu Jan 22, 2009 5:27 pm
by John Adams
Scatman is fookin brilliant. I tell ya.

Re: Mouvement function add

Posted: Fri Jan 23, 2009 5:34 am
by alfa
Scatman wrote:The MovementLoopAddLocation function is used really for what its named for, to make a loop. Go to point A, then to point B, then to point C, there are no more points so begin at part A and repeat. What I did to make a generic circle script was before the loop was started, get the spawn's initial x, y, z and make a loop of their spawn location, so it can be applied to any spawn without any hardcoded numbers besides the offsets, and even those can be randomly generated if you wish to have larger or smaller circles.
Can you provide me a little example please ?

Re: Mouvement function add

Posted: Fri Jan 23, 2009 8:51 am
by Scatman

Code: Select all

function spawn(NPC)
   x = GetX(NPC)
   y = GetY(NPC)
   z = GetZ(NPC)
   MovementLoopAddLocation(NPC, x + 7 , y, z - 8 , 2, math.random(5, 15))
   MovementLoopAddLocation(NPC, x - 5 , y, z - 10, 2, math.random(5, 15))
   MovementLoopAddLocation(NPC, x - 10, y, z + 9 , 2, math.random(5, 15))
   MovementLoopAddLocation(NPC, x + 5 , y, z + 8 , 2, math.random(5, 15))
end

Re: Mouvement function add

Posted: Fri Jan 23, 2009 11:42 am
by John Adams
alfa, as a member of the DB team, you have access to the DB editor, which shows you any script we have in development.

You should try using it to see what work has already been done. It may answer many questions! ;)

Re: Mouvement function add

Posted: Fri Jan 23, 2009 11:55 am
by Scatman
This is off topic but I hate how EQ2 uses Y as their verticle axis :( In a 3d world, isn't the Z axis the height? Throws me off sometimes.

Re: Mouvement function add

Posted: Fri Jan 23, 2009 12:22 pm
by LethalEncounter
Nope, Y is the height in a 3-d world:

http://www.uni-duesseldorf.de/URZ/hardw ... b_coor.htm

Although I agree it was confusing at first for me too.

Re: Mouvement function add

Posted: Fri Jan 23, 2009 1:17 pm
by Scatman
Ahh I am thinking of way back in my graph theory class we always drew the Z axis vertical haha. I guess the images were tilted in those drawings.

Re: Mouvement function add

Posted: Sat Jan 24, 2009 3:18 pm
by alfa
Humm after test not what I mean at all (but thx for this info too)

I mean the mob do a perfect circle. For example in VP Mylex turn around his enginer he do simply a circle, not random point or other just a circle and the central point is enginer.

Re: Mouvement function add

Posted: Sat Jan 24, 2009 3:53 pm
by John Adams
Hah, the sample was just to show you how to use Movement Loops. You have to get in game, stand where you want him to move and /loc, then enter a new movement loop for every "waypoint" you wish him to stop and turn.

No, there is no "perfect circle" lua command. :/

Re: Mouvement function add

Posted: Sat Jan 24, 2009 4:05 pm
by Scatman
It wouldn't be hard to make a perfect circle. My offsets I showed you are different so the circle won't be perfect, but if you tweek them you could very easily make a perfect circle.