PDA

View Full Version : quest:selfcast in LUA


Rabuk
07-30-2015, 01:49 AM
heya,
i trying to get this command to run in LUA to setup an buff npc.

But i cant get this working with LUA.


function event_say(e)
local myid = e.other:GetID();
if(e.message:findi("hail")) then
e.self:Say("Welcome, do you want some [" .. eq.say_link("buffs",false,"buffs") .. "]?");
elseif (e.message:findi("buffs")) then
e.self:CastToClient(18323, myid);
end
end


The npc starts always to cast on him self. I tried all kind of combinations but i dont get the npc to cast a spell on me. I checked the return id from the function GetID and it looks ok.

I was not able to find any examples on the forum / web. And the LUA reference doesnt have any command for selfcast or something.

Thanks in advance for any hints. :)

Edit: Oh i see there is a quest:lua forum. Maybe someone can move this. Sorry for that.

Kingly_Krab
07-30-2015, 02:00 AM
Haven't really messed with our Lua that much, but try this: function event_say(e)
local myid = e.other:GetID();
if(e.message:findi("hail")) then
e.self:Say("Welcome, do you want some [" .. eq.say_link("buffs",false,"buffs") .. "]?");
elseif (e.message:findi("buffs")) then
e.self:CastSpell(18323, myid);
end
end

Rabuk
07-30-2015, 04:14 AM
Hello,
will check it out later when iam back home from work.

I wonder why i did use CastToClient instead of CastSpell.
Ofcourse it was to later yesterday. haha :)

Kingly_Krab
07-30-2015, 04:24 AM
Yeah, haha, no problem, not sure if my code will work or not, but probably worth trying at least.

Rabuk
07-30-2015, 11:53 AM
The only way i got this running now is by using "other" instead of "self".


e.other:CastSpell(18323, myid, 0, 0, 0);


So this will come close to the selfcast function in perl.

Thank you ! :)

NatedogEZ
07-30-2015, 12:30 PM
You can use..


eq.SelfCast(18323);



It makes the initiator of the quest self cast :)

If you are wonder where that is from its from the folder "lua_modules\general_ext.lua"

Rabuk
07-30-2015, 01:13 PM
You can use..


eq.SelfCast(18323);



It makes the initiator of the quest self cast :)

If you are wonder where that is from its from the folder "lua_modules\general_ext.lua"

Oh cool didnt know it.
I was reading the lua reference but didnt see this function.

Cool thank you. :)