[Request] Lua Event: Used(NPC, Spawn)

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
bolly
Retired
Posts: 389
Joined: Mon Sep 21, 2009 3:03 pm
Location: Leeds, UK

[Request] Lua Event: Used(NPC, Spawn)

Post by bolly » Wed Dec 09, 2009 12:48 am

I was taking a look at command_use and saw it was just widgets supported at the moment. Any chance we can get something in like lua_interface->RunSpawnScript(script, "used", npc, spawn)?

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: [Request] Lua Event: Used(NPC, Spawn)

Post by Scatman » Wed Dec 09, 2009 12:50 am

In their spawnscript:

Code: Select all

function casted_on(NPC, Spawn, SpellName)
   if SpellName == "use" then
      --do something
   end
end
Note: Both spells and entity commands trigger this.

bolly
Retired
Posts: 389
Joined: Mon Sep 21, 2009 3:03 pm
Location: Leeds, UK

Re: [Request] Lua Event: Used(NPC, Spawn)

Post by bolly » Wed Dec 09, 2009 12:55 am

(7:32:01 AM) bolly: i was just wondering if it's possible to entity 'use' objects?
(7:48:40 AM) Scatman: whatcha mean?
(7:48:59 AM) bolly: http://www.eq2emulator.net/phpBB3/viewt ... =14&t=2020
(7:49:33 AM) Scatman: so you have an entity_command called 'use'?
(7:49:49 AM) bolly: yep
(7:50:00 AM) Scatman: use the function casted_on(NPC, Spawn, SpellName)
(7:50:14 AM) bolly: great, can i omit the spellname?
(7:50:44 AM) Scatman: sure
(7:51:11 AM) bolly: works :D
(7:51:15 AM) Scatman: but if they cast any spell it's going trigger it
(7:51:27 AM) bolly: ok
(7:51:36 AM) Scatman: i included spellname so you could determine which spell/entity_command was being cast
(7:51:41 AM) Scatman: http://www.eq2emulator.net/phpBB3/viewt ... 420#p16420
(7:52:02 AM) bolly: ok so would spellname == 21? (21 being use entity command)
(7:52:18 AM) Scatman: no
(7:52:20 AM) Scatman: the name of it 'use'
(7:52:25 AM) bolly: jsut Say()'d it now
(7:52:27 AM) bolly: yep perfect!
(7:52:32 AM) Scatman: since entity_command AND spells can trigger it
(7:53:09 AM) bolly: perfect!!

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: [Request] Lua Event: Used(NPC, Spawn)

Post by Scatman » Wed Dec 09, 2009 12:58 am

BTW, this is John's FAVORITE function. You should mention it to him whenever you see him ;)

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: [Request] Lua Event: Used(NPC, Spawn)

Post by John Adams » Wed Dec 09, 2009 11:02 am

I love being casted on.


:twisted:

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests