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-27-2015, 11:42 AM
silvergrin46
Fire Beetle
 
Join Date: Jan 2015
Posts: 9
Default

Thanks for the response. In a sense it is much like a recourse effect.
However let's say in a recourse spell - The spell Id to be recoursed is added to the main spells recourse field. When you cast the main spell it then casts the spell from the recourse field onto the caster of the main spell.

What I am trying to do is have the main spell trigger the spell script and then only cast a specific spell or perform actions based on criteria in the script instead of only one spell.

As an example:

Main spell:
Summon Mage pet
Basically a blank spell it is self targeted and beneficial with only a positive charisma spell effect in it. This spell has no duration.

When summon Mage pet is cast the spell file is triggered with a script that does the following:

Get spell caster current level

If level is 1-50 then cast spell to summon lower level pet.

If level is 51-85 then cast spell to summon higher level pet

I apologize for the long post I'm just trying to explain this right.
I'd like to be able to identify who the exported integer caster_id is in the spell file. If I cannot perform the checks for level in the above example and then cast the spell directly, then I'd like to perform the level checks and send two different signals to the player file and then cast the appropriate spells.

If I need to I will use the player file and identify each spell in the function event_cast section, perform the checks and activate the spell I want to cast from there. But with many custom spells the global_player file can get crowded fast.
Reply With Quote
  #2  
Old 01-27-2015, 08:29 PM
silvergrin46
Fire Beetle
 
Join Date: Jan 2015
Posts: 9
Default Well I got it to work ... sort of ...

Below is the working script that corresponds to the example I posted about the spell that triggers the cast of either a
lower/higher rank pet summon spell depending upon the level of the caster.


Code:
function event_spell_effect(e)	

	local P_LVL = e.target:GetLevel();
	
		e.target:Message(15, "My CASTER_ID is: "..e.caster_id);		
		e.target:Message(15, "My LEVEL IS: "..P_LVL);
	
	if(P_LVL <=50) then		
		e.target:CastSpell(12001, e.caster_id); -- Summons lower level Pet
	
	elseif(P_LVL >50) then
		e.target:CastSpell(12002, e.caster_id); -- Summons higher level Pet
	
	end
end

This only works when casting the main spell via the #cast command.

From what I can figure out, when casting the main spell from a spell gem it must begin the cast and then process the script.

However, when using the #cast command it must process the script before the cast of the main spell actually takes place
because the appropriate second spell immediately begins its cast sequence when the command is activated.

I'm moving on to using the global_player.lua file for what I need until I can find another way, but I felt like sharing this information - maybe it will help someone.
Reply With Quote
Reply

Thread Tools
Display Modes

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 02:37 AM.


 

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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3