Grid ID LUA requests

EQ2Emulator Development forum.

Moderator: Team Members

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:

Grid ID LUA requests

Post by John Adams » Mon Feb 15, 2010 11:17 am

Scat,

Can we add 2 LUA functions: EnterLocation(id) and ExitLocation(id)

Scenario -
I'd like to set up zone scripts so when a player enters a specific grid (location_id), it triggers the EnterLocation(id) function, which we can then use to display some text in a popup message.

For example, when a player enters Sunset Meadow in Queen's Colony from their spawn point, they leave grid 924281492 and enter grid 771354606 as they pass through the archway. At this point, we will display the popup "Sunset Meadow". Opposite of that, the other 2 entrances to Sunset Meadow also change grid IDs as the player moves into Sunset Meadow.

The reason for the ExitLocation(ID) is in case someone wants to program some message as a player leaves a grid. Example, when a player runs from Sunset Meadow through the arch into the Tainted Forest, we could popup "Leaving Sunset Meadow" when the grid changes from 771354606 to 3146737430 at the top of the stairs.


Let me know if this makes sense. It could replace the "SetLocationProximityFunction()" for this usage anyway. I'd like to keep SetLocationProximityFunction() of course for other needs.
John Adams
EQ2Emulator - Project Ghost
"Everything should work now, except the stuff that doesn't" ~Xinux

User avatar
ZexisStryfe
Posts: 1026
Joined: Thu Jul 26, 2007 6:39 am
EQ2Emu Server: Sytherian Legends
Location: Connecticut
Contact:

Re: Grid ID LUA requests

Post by ZexisStryfe » Mon Feb 15, 2010 12:58 pm

Just a wacky question... where ar eyou getting these grid numbers? Data collector?

I am just trying to figure out what I am going to do with discovery locations.
~ EQ2 Emulator Project Manager

Image
Image
Image
"Zexis, from this day forth, you shall be known as... '3 of 6'" - John Adams

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: Grid ID LUA requests

Post by John Adams » Mon Feb 15, 2010 1:31 pm

Save your efforts, Mr Z. That functionality is not yet implemented ;) We still have to divine how to save when a player has already discovered something, and we're a ways off on that feature.

location_id is in the `spawn_location_placement` table when you create/save a spawn. You can also see it flashing by when you move through the game, in the console.

Code: Select all

Left Grid 924281492 and Entered Grid 819993724

User avatar
ZexisStryfe
Posts: 1026
Joined: Thu Jul 26, 2007 6:39 am
EQ2Emu Server: Sytherian Legends
Location: Connecticut
Contact:

Re: Grid ID LUA requests

Post by ZexisStryfe » Mon Feb 15, 2010 2:19 pm

Cool. I was just brainstorming anyway.. 8)
~ EQ2 Emulator Project Manager

Image
Image
Image
"Zexis, from this day forth, you shall be known as... '3 of 6'" - John Adams

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: Grid ID LUA requests

Post by Scatman » Mon Feb 15, 2010 3:46 pm

Implemented. But we still need to figure out how to handle the unsigned int issue in LUA. =/ I've been reading something about a patch to apply to the LUA core to represent integers differently. We could also pass the ID in as a string. I'm not sure how that would effect comparisons though. You might have to do if GridID == "2525238942982" as opposed to without the quotes if it were an integer. I'll have to test it out.

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: Grid ID LUA requests

Post by John Adams » Tue Feb 16, 2010 2:44 pm

Not to doubt you, but it seems very unreasonable that LUA would not support unsigned ints. Why would LUA make everyone so excited if it had this extremely limiting lack of features?

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: Grid ID LUA requests

Post by John Adams » Sat Feb 20, 2010 9:21 pm

Well yeah. LUA is not interpreting my 2656047938 grid ID at all. I refuse to believe LUA is limited to signed ints tho, that would render it useless imo.


Edit: I had about 2 pages of in-depth analysis here, and discovered after wasting hours in Live mapping out location logic, that we already have a similar function in SetLocationProximityFunction(); with the In_range and Leave_range parameters.

[center]DUH.[/center][/color][/b]

However, I do still want to discuss what you think of SOE's Popup-in-a-box theory, taken right from our collected data.

One example of this "box" theory... below is a table of parsed data for one location in the Outpost. Take these coordinates, and do a /move x,y,z on each one, one at a time, and see where the coordinates put you. It is clearly an outline.

Code: Select all

/move 41.5655 -8.27655 235.755
/move 51.8611 -2.82785 160.631
/move 81.3082 10.5917 141.676
/move 147.426 -0.969987 121.907
/move 178.442 5.76008 120.069
/move 208.393 -1.13326 133.268
/move 213.025 -3.29739 142.865
/move 197.712 -2.46771 180.195
/move 194.769 -2.27147 208.871
/move 156.604 -3.05645 218.507
This is just one area, which our parser currently cannot tell us what area it is via data, but we know the game well enough to know this is "Seaside Glade".


Thoughts?

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: Grid ID LUA requests

Post by John Adams » Sat Feb 20, 2010 11:15 pm

Well crap. I pre-maturely removed all that nice analysis when it turns out we're going to need a different way to handle grids/locations afterall.

Case in point: Without re-writing everything ;), every entrance into Seaside Glade (Outpost zone) fires the same message... so the enter_location(grid id) function works fine.

However, the area known as Cliffdiver Canyon is the same grid ID all the way through Wildbear Vale, Valley of Discipline and Falconer Hill. The Vale and Hill are easily setup using SetLocationProximityFunction(), with the enter/leave params. However I cannot figure out how to make entering the grid say "Valley of Discipline" at one end, and "Cliffdiver Canyon" at the other, on the same grid ID.


This could probably be solved by either adding 3 more params (x,y,z) to the function, or creating a specific function to handle enter/leave grid @ specific x,y,z coordinates.

User avatar
Arremis
Retired
Posts: 388
Joined: Sun Sep 02, 2007 10:11 am
Location: Memphis, TN

Re: Grid ID LUA requests

Post by Arremis » Sun Feb 21, 2010 6:36 am

The reason is: SoE f****d up again and tried putting a band-aid "over" the boo-boo. A good find :)
I am the UI Master...there is no charge for my awesomeness.

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: Grid ID LUA requests

Post by John Adams » Sun Feb 21, 2010 9:20 am

Here's a quick, ugly map of why we need additional functionality (not that I have to sell it, Scatman LOVES this shit!)
OO_map.jpg
1. Grid line between grids 2656047938 (Fisher Falls) and 1246288135 (The Valley of Discipline).

2. My "hack" bubble that encompasses the entire area that is The Valley of Discipline.

3. A sub-bubble that encompasses Falconer Hill.

4. The boundary where Valley of Discipline becomes Cliffdiver Canyon.

5. A bubble for Wildbear Vale.

6. Grid line between grids 1246288135 (now Cliffdiver Canyon) and 771354606 (Seaside Glade).

Problems:
  • Bad: When you leave Fisher Falls (1) and enter Valley of Discipline (2), because I have the enter_location() for grid_id 1246288135 set for Cliffdiver Canyon, you see that message first, then you see the message from the bubble 2. No good!

    Good: The sub-bubble (3) works pretty good in this design, because this way anywhere you leave Falconer Hill, you are back in Valley of Discipline.

    Good: Crossing the boundary at (4) is also ok, because you leave the Valley and enter the Canyon locations.

    Good: Also ok is entering and exiting Wildbear Vale (5). This bubble works fine.

    Good: And lastly in this config, the grid enter_location() does it's job just fine at Cliffdiver Canyon (6).

    Bad: If you setup only SetLocationProximityFunction()'s, as you run towards Fisher Falls (1) you will trigger the entrance to the Valley as well as the exit into Fisher Falls - so that solution won't work, unless we do not popup if we're already inside a location, which we do not know that we are without boundaries :)

    Very Bad: Using the above concept, and since our proximity code is spherical in nature, my Valley of Discipline bubble blows out over into the Wilderwood, so while I am running down the next valley over, I get told I entered the Valley of Discipline. That definitely won't do.
So you can see, most of this works just fine, but in order to emulate Live a little better, we need to know at what point on grid 1246288135 (Cliffdiver Canyon) the player "entered" or "exited".


Solutions:
  • We add additional, optional parameters to enter_location(Zone, Player, GridID, X, Y, Z), and same for exit_location(). These will be optional floats, and without them, the function can assume you mean ANY enter/exit of this grid is fine.

    Another solution is to figure out how to pass variables, per player, to the enter/exit functions, and then setup SetLocationProximityFunction()'s for where we want to set the variable. Example, set up a proximity bubble at the Fisher Falls end of grid 1246288135 that sets a var that the enter_location (from fisher falls) can use to determine the player is at >that end< of the grid.
~takes breath~

The options are endless, we'll just pick the one that makes the most sense. There might also be a need to draw "boxes" like SOE seems to do... so let's not discount that concept, but consider adding it anyway even if we don't use it right away.
You do not have the required permissions to view the files attached to this post.

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: Grid ID LUA requests

Post by John Adams » Wed Feb 24, 2010 4:33 pm

Alrighty folks, here's the latest magic from da Scatman. He heard my cries, and came up with a perfect solution.

You can now "draw a line" around where you want a specific location to pop a message. Example:

Take a look at this new table `locations` in our DB:
locations.jpg
You can see the list of known POI's we get from our (current) raw data - as you run through Live and discover points of interest, a message pops up telling you where you are. Above, you see the "grid_id" where that location lives, and the name of the location.

Now, in the new table `location_details`, you tell what boundaries you want that location to fire off what message. In this example, we're causing the Seaside Glade (location_id 1) to pop a message:
location_details.jpg
These different coordinate entries (and you can have an unlimited number of them if you want to be that precise) basically draw a line across the zone, and anytime a player crosses INTO that area from outside of it, a message pops.
location.jpg

Try it out yourself, with the attached SQL queries. This is for Zone ID 278 - Outpost of the Overlord.
You do not have the required permissions to view the files attached to this post.

User avatar
ZexisStryfe
Posts: 1026
Joined: Thu Jul 26, 2007 6:39 am
EQ2Emu Server: Sytherian Legends
Location: Connecticut
Contact:

Re: Grid ID LUA requests

Post by ZexisStryfe » Wed Feb 24, 2010 4:51 pm

Just so I get this straight- This draws a line from id 1 to id 2, id 2 to id 3 ... id 9 to id 10 and then from id 10 back to id 1, correct?
~ EQ2 Emulator Project Manager

Image
Image
Image
"Zexis, from this day forth, you shall be known as... '3 of 6'" - John Adams

User avatar
ZexisStryfe
Posts: 1026
Joined: Thu Jul 26, 2007 6:39 am
EQ2Emu Server: Sytherian Legends
Location: Connecticut
Contact:

Re: Grid ID LUA requests

Post by ZexisStryfe » Wed Feb 24, 2010 4:54 pm

Also, buy any chance is there a command to echo the grid id in the chat window for those who aren't local?

You know, like /grid_id with a result of "You are currently in grid id 771354606."

If not, can there be? :twisted:
~ EQ2 Emulator Project Manager

Image
Image
Image
"Zexis, from this day forth, you shall be known as... '3 of 6'" - John Adams

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: Grid ID LUA requests

Post by Scatman » Wed Feb 24, 2010 5:02 pm

ZexisStryfe wrote:Just so I get this straight- This draws a line from id 1 to id 2, id 2 to id 3 ... id 9 to id 10 and then from id 10 back to id 1, correct?
No, it's a little more intelligent than that :P You can put the points in any order, just make sure the area is not some W shapped figure. It needs to be some sort of convex structure (square, circle, diamond, triangle, whatever).

ZexisStryfe wrote:Also, buy any chance is there a command to echo the grid id in the chat window for those who aren't local?

You know, like /grid_id with a result of "You are currently in grid id 771354606."

If not, can there be? :twisted:
Sure. Also how about a command like /location add [location id]? It will add your current x,y,z to the location_details table, so you can run around using that command to draw the area.

User avatar
ZexisStryfe
Posts: 1026
Joined: Thu Jul 26, 2007 6:39 am
EQ2Emu Server: Sytherian Legends
Location: Connecticut
Contact:

Re: Grid ID LUA requests

Post by ZexisStryfe » Wed Feb 24, 2010 5:58 pm

Scatman wrote:Sure. Also how about a command like /location add [location id]? It will add your current x,y,z to the location_details table, so you can run around using that command to draw the area.
This would be awesome! :mrgreen:
~ EQ2 Emulator Project Manager

Image
Image
Image
"Zexis, from this day forth, you shall be known as... '3 of 6'" - John Adams

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests