New Lua Function: UseWidget(Spawn)

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

Moderator: Team Members

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

New Lua Function: UseWidget(Spawn)

Post by Jabantiz » Tue Jul 31, 2012 5:11 pm

I added this to help me test the acorn lift and realised it could be used to make the lifts work on their own. This is the spawn script I used and it works great, if the widget is set up properly.

Code: Select all

function spawn(NPC)
	AddTimer(NPC, 15, "LiftUse")
end

function respawn(NPC)
	spawn(NPC)
end

function LiftUse(NPC, Spawn)
	UseWidget(NPC)
	AddTimer(NPC, 15, "LiftUse")
end
It is set to 15 secs right now but should probably be bumped up, it worked great for me though. Just assign this script to the lift and watch it go.

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: New Lua Function: UseWidget(Spawn)

Post by John Adams » Wed Aug 01, 2012 9:27 pm

That's cool, Jab. Always wanted lifts to actually... lift :)

Consider this for long-term design, since Lifts/elevators have previously been considered "doors" of one type or another (levers, buttons, widgets, etc), think about how to design a parameter maybe in spawn_widgets to tie the LUA Script to that widget entry, and either use open/close timers or create a new field "delay" or something to push to the LUA. This way, we're not having to hard-code timers in a LUA file, it can be a parameter.

No hurry, just think about it.

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

Re: New Lua Function: UseWidget(Spawn)

Post by Jabantiz » Fri Jul 10, 2015 10:36 pm

UseWidget() will now also trigger a linked widget, just like if you clicked on it.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests