Zone scripts enter_location leave_location

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

Moderator: Team Members

Post Reply
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Zone scripts enter_location leave_location

Post by Ememjr » Wed Mar 27, 2019 6:36 am

Jab pointed out to me about the locations tabe, and location details table the works for map locations for POI things etc

https://www.eq2emulator.net/phpBB3/view ... ity#p17718

the current enter_location and leave_location lua scripting in zone script really only deals with enter and leaving a grid ID

as seen in a zone script

Code: Select all

function enter_location(zone, spawn, grid)

end

function leave_location(zone, spawn, grid)
end
and in code here

Code: Select all

if(appearance.pos.grid_id != grid_id)
	{
		LogWrite(PLAYER__DEBUG, 0, "Player", "%s left grid %u and entered grid %u", appearance.name, appearance.pos.grid_id, grid_id);
		const char* zone_script = world.GetZoneScript(GetZone()->GetZoneID());

		if (zone_script && lua_interface) 
		{
			lua_interface->RunZoneScript(zone_script, "enter_location", GetZone(), this, grid_id);
			lua_interface->RunZoneScript(zone_script, "leave_location", GetZone(), this, appearance.pos.grid_id);
		}

		appearance.pos.grid_id = grid_id;
	}
I would like to add the Following functions
enter_poi_location(zone, spawn, location)
leave_poi_location((zone, spawn, location)

where location would be the location_id from the locations table

thoughts and or concerns before i try and implement

1. i have is we could just use the grid in enter_location as a grid but i think too many people might get confused and we dont want the posibility of grid and location_id getting mixed up

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: Zone scripts enter_location leave_location

Post by Gangrenous » Wed Mar 27, 2019 9:20 am

I figured it was already in there :)
Resident Dirty Hippy

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: Zone scripts enter_location leave_location

Post by Ememjr » Wed Mar 27, 2019 9:30 am

nope only for changeing grid id, the code is there for the location and location_details, to create the opups from POI notifications, but that is hard coded, and the section (to be added) for traking achiements is in the same are just needs coding, but sometimes we need to update a quest that says go to crator pond for instance, the pond is large and not a perfect circle so the location part is good, just right now we cannot script for the quest updates them selfs

oh and it appears antonica is one big grid lol, ran around all morning checking grid id and it never changed

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: Zone scripts enter_location leave_location

Post by Gangrenous » Wed Mar 27, 2019 10:53 am

Wah???? I do not think that is true. I seem to remember there being multiple.
Resident Dirty Hippy

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: Zone scripts enter_location leave_location

Post by Ememjr » Wed Mar 27, 2019 12:02 pm

maybe off the mainland i ran from docks to TS griifon tower through coven, over be oracle tower and back to North qeynos gate, and it was all same grid id

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: Zone scripts enter_location leave_location

Post by Gangrenous » Wed Mar 27, 2019 12:34 pm

Well I have a while before I hit world building, but I will keep it in mind to check.
Resident Dirty Hippy

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Zone scripts enter_location leave_location

Post by Jabantiz » Wed Mar 27, 2019 2:34 pm

If i remember right enter/leave location was an early attempt to handle POI locations but as it went by grid it was not accurate, and grid ids can change across clients so if it did work on some clients it wouldn't work on others.

I do not think these functions are used anywhere so I would be fine with repurposing them for locations, just remove the code that sends the grid id and change the parameter from grid to location id.

As for antonica yea the outside is mostly one grid id now, in older clients it was several. Usually inside buildings/caves it will still be a different grid id. No clue why they did that but I gave up trying to understand SoE/DBG a long time ago.

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: Zone scripts enter_location leave_location

Post by Ememjr » Wed Mar 27, 2019 3:58 pm

i already added the function aslocation_poi_enter for testing
but maybe i could look into changing the code for using location and location details, to just use zone id instead of gridid

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: Zone scripts enter_location leave_location

Post by Ememjr » Wed Mar 27, 2019 5:33 pm

interesting find,
so i logged in with DOV as as always JAB was correct that grid id's have infact changed,but the good news so far, that even though grid id is in the locations table, apparently it was not used because the location details i put in for crator pond on my server still worked even though it was a different grid id
i am going at add a couple more location for other areas and see how well they work
but so far so good, with the changes i have made

basically using grid id alone would be out the door

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Zone scripts enter_location leave_location

Post by Jabantiz » Wed Mar 27, 2019 6:54 pm

Ah yea I removed the grid id check from locations because a location (POI) could span multiple grids and that caused all sorts of problems.

I do know the check does have issues in some cases, for example kylong plains will give the location for the path up the mountain over by that castle zone. It does do a good job most of the time but it is not 100% accurate.

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: Zone scripts enter_location leave_location

Post by Ememjr » Thu Mar 28, 2019 3:09 am

yup paths will still be a problem like qeynos highway etc
and the path to the castle
and other just do the smaller proximity checks or even better
have an option in locations to tell it its a line and do a small proximty check anywhere on that line

but for now ill work with what we have

and as I always tell me customers when i find something that could be better , this is an Opportunity for Improvement

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests