Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::LUA

Quests::LUA Section regarding LUA scripts, help, questions, answers

Reply
 
Thread Tools Display Modes
  #1  
Old 01-30-2015, 03:38 PM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default event_case - LUA

How do I get the id or the name of the spell being cast?

This is in my global_player.lua

Code:
function event_cast(e)
	e.self:Message(1, "Casting spell " ..  e.other.Name());
end
I have tried e.spell and e.other. The Lua wiki is not really helping me, I normally have to guess a lot of incorrect times before I finally figure it out.
Reply With Quote
  #2  
Old 01-30-2015, 04:15 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default

Here's what the Lua Parser reference says.
Code:
event_cast
Client self;
Spell spell;
Reply With Quote
  #3  
Old 02-02-2015, 09:26 PM
silvergrin46
Fire Beetle
 
Join Date: Jan 2015
Posts: 9
Default

This is what i am using in my global_player.lua

Just a snippet from a rather long set of spell checks, can post more of the code if need be.


Code:
function event_cast(e) 

	local PLVL = e.self:GetLevel();
	
	local Mana = e.self:GetMana();
	local ManaCost = (PLVL*5);
	local NewMana = (Mana - ManaCost);
	
	
	local Spell_ID = e.spell:ID();
	local Spell_Name = e.spell:Name();
	
	local Target = e.self:GetTarget();
	local Target_ID = Target:GetNPCTypeID();
	
			
	

	if(Spell_ID == 12000) then --spell id check ------------------------------------------------
	
		e.self:Message(5, "I CASTED SPELL: " ..Spell_ID);
                e.self:Message(5, "I CASTED SPELL: " ..Spell_Name);

    end
end
Reply With Quote
  #4  
Old 02-02-2015, 09:36 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,165
Default

You guys realize there is a spell quest system? "<zone>/spells/<spellid>.ext" and "global/spells/<spellid>.ext"
Reply With Quote
  #5  
Old 02-02-2015, 10:59 PM
silvergrin46
Fire Beetle
 
Join Date: Jan 2015
Posts: 9
Default

I tried until my eyes bled to get the global/spells/spellid to do what I wanted but could not get it to work right. See my post in this section if you haven't yet. I am using global_player until I can figure it out.
Reply With Quote
  #6  
Old 02-02-2015, 11:26 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

Here is an example quest I use... the invis 100 is custom though..

SpellID.lua
11.lua
Code:
function event_spell_effect(e)
	if(e.target) then
		eq.get_entity_list():RemoveFromTargets(e.target, true);
		e.target:SetInvisible(100);
		e.target:Emote("vanishes into thin air."); 
	end
end
I just noticed you are using global_player.. so ya this would only work in... global /spells / spellid.lua

Much easier to keep track of spells this way though :p
Reply With Quote
  #7  
Old 02-02-2015, 11:30 PM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default

I had a typo was my problem....

. instead of a :
Reply With Quote
  #8  
Old 02-02-2015, 11:46 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

This might help in the future for finding the correct variable names.

http://wiki.eqemulator.org/p?spell_Events
http://wiki.eqemulator.org/p?NPC_Events
http://wiki.eqemulator.org/p?player_Events

When using the global / spells / spellID.lua

Code:
function event_spell_effect(e)
	e.target:Shout("Buff name is " .. e.self:Name() .. " Buff ID is " .. e.self:ID());
end
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:27 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3