Zone scritping question

Discussions of the design and development of in-game content.

Moderator: Team Members

Post Reply
samsarat2209
Posts: 3
Joined: Wed Nov 18, 2009 2:48 am

Zone scritping question

Post by samsarat2209 » Mon Feb 15, 2010 12:05 am

Hi every body

Is there a way to link a lua script to a zone loading?
In partical for the begining zone, i need some configuration scripting.
I was unable to find this information.

Thanks for help.

Thank for EQ2Emu :)
Great fantasm that come real :)

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: Zone scritping question

Post by Scatman » Mon Feb 15, 2010 1:00 am

You mean when a zone first initially loads or when a player enters the zone?

samsarat2209
Posts: 3
Joined: Wed Nov 18, 2009 2:48 am

Re: Zone scritping question

Post by samsarat2209 » Mon Feb 15, 2010 1:49 am

At least when the player enter the zone.

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: Zone scritping question

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

It would help if we had an exact example of what you are trying to accomplish. Ie, here is a sample Zone Script from our server, that displays text when you enter a specific area:

Code: Select all

--[[
	Script Name	: ZoneScripts/QueensColony.lua
	Script Purpose	: Location Pop-ups
	Script Author	: John Adams
	Script Date	: 2009.05.07
	Script Notes	: Sample ZoneScript
--]]

function init_zone_script(Zone)
	SetLocationProximityFunction(Zone, 70, -4.25, 168.5, 30, "SunsetMeadow")
	SetLocationProximityFunction(Zone, 175, -3, 135, 30, "SunsetMeadow")
	SetLocationProximityFunction(Zone, 203, -3.3, 144.5, 30, "SunsetMeadow")
end

function SunsetMeadow(Zone, Player)
	SendPopUpMessage(Player, "Sunset Meadow", 255, 255, 0)
end
Basically, in the Sunset Meadow area, if a player crosses the threshhold of any of the 3 entrances, the text "Sunset Meadow" will appear on their screen in Yellow.

Put the file into a folder under EQ2World.exe (ie., ./ZoneScripts/Test.lua)

Then go to the `zones` table and add "ZoneScripts/Test.lua" to the zone record's `lua_script` field.

There are five (5) places to add scripts: Items, Spawns, Spells, Quests and Zones. More to come.

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: Zone scritping question

Post by Scatman » Mon Feb 15, 2010 9:07 am

There is also a function in a zone's zonescript called player_entry(Zone, Player). It gets called whenever a player enters a zone.
Example:

Code: Select all

function player_entry(Zone, Player)
   SendMessage(Player, "Welcome to the zone " .. GetName(Player) .. "!")
end

samsarat2209
Posts: 3
Joined: Wed Nov 18, 2009 2:48 am

Re: Zone scritping question

Post by samsarat2209 » Tue Feb 16, 2010 3:39 am

Yes !!
Thats enough for me. :)
In fact, iwas'nt know where and how to place zone scripts.
Thanks :)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests