Page 1 of 1

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

Posted: Wed Dec 09, 2009 12:48 am
by bolly
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)?

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

Posted: Wed Dec 09, 2009 12:50 am
by Scatman
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.

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

Posted: Wed Dec 09, 2009 12:55 am
by bolly
(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!!

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

Posted: Wed Dec 09, 2009 12:58 am
by Scatman
BTW, this is John's FAVORITE function. You should mention it to him whenever you see him ;)

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

Posted: Wed Dec 09, 2009 11:02 am
by John Adams
I love being casted on.


:twisted: