Mouvement function add

Discussions on development of both the EQ2Emulator LUA Script Engine and Script specifications

Moderator: Team Members

Post Reply
User avatar
alfa
Team Member
Posts: 550
Joined: Fri Jul 27, 2007 6:24 pm
Location: France
Contact:

Mouvement function add

Post by alfa » Thu Jan 22, 2009 4:53 pm

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 ?
Fight with me... Or die, like the rest.
J.A. say: "I think Xinux tried to tell me this, but I ignore most things he suggests."

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Mouvement function add

Post by Scatman » Thu Jan 22, 2009 5:01 pm

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.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Mouvement function add

Post by John Adams » Thu Jan 22, 2009 5:27 pm

Scatman is fookin brilliant. I tell ya.

User avatar
alfa
Team Member
Posts: 550
Joined: Fri Jul 27, 2007 6:24 pm
Location: France
Contact:

Re: Mouvement function add

Post by alfa » Fri Jan 23, 2009 5:34 am

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 ?
Fight with me... Or die, like the rest.
J.A. say: "I think Xinux tried to tell me this, but I ignore most things he suggests."

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Mouvement function add

Post by Scatman » Fri Jan 23, 2009 8:51 am

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

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Mouvement function add

Post by John Adams » Fri Jan 23, 2009 11:42 am

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! ;)

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Mouvement function add

Post by Scatman » Fri Jan 23, 2009 11:55 am

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.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: Mouvement function add

Post by LethalEncounter » Fri Jan 23, 2009 12:22 pm

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.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Mouvement function add

Post by Scatman » Fri Jan 23, 2009 1:17 pm

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.

User avatar
alfa
Team Member
Posts: 550
Joined: Fri Jul 27, 2007 6:24 pm
Location: France
Contact:

Re: Mouvement function add

Post by alfa » Sat Jan 24, 2009 3:18 pm

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.
Fight with me... Or die, like the rest.
J.A. say: "I think Xinux tried to tell me this, but I ignore most things he suggests."

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Mouvement function add

Post by John Adams » Sat Jan 24, 2009 3:53 pm

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. :/

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Mouvement function add

Post by Scatman » Sat Jan 24, 2009 4:05 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests