Log in

View Full Version : How to identify Spell id?


egg
05-19-2008, 03:55 AM
I have been playing with the Event_Cast_On since 1108 release and it works out very nicely. Sadly, I don't know how to get the spell id the player cast, This is needed so I can set NPCs to react to a specific spell, not just any spell. I have tried may different quest objects, but will no results. Any ideas would be helpful?

Bulle
05-19-2008, 01:48 PM
I have not upgraded my 1104 to 1108 yet, but if the code has been integrated as-is you should access the spell ID by the $spell_id variable when you are in the event handler function. Here is how I do it on my own version, where I wrote the CAST_ON thingie originally :

sub EVENT_CAST_ON
{
if($spell_id == 202) # Courage
{
quest::say("Bzzzzt !");
quest::setglobal("A_Bit_of_Clericing", "Guard Buffed", 5, "F");
}
}

egg
05-19-2008, 10:43 PM
Many thanks for the reply, But I have searched high and low on the forums, and found that as well.
http://www.eqemulator.net/forums/showthread.php?t=25006&highlight=event+cast

it seems that $spell_id was not added to the current 1108 version, but EVENT_CAST_ON was. sadly, since I don't have a complier, I have to rely on the releases available. Unless you know of a free compiler that can compile the source files under windows xp for windows machine, I will be stuck to this.
but thanks for your reply :grin:

egg
05-20-2008, 01:02 AM
Nevermind, I found a very helpful wikki that points to a free compiler for windows that is not a gcc or cgywin.
http://www.eqemulator.net/wiki/wikka.php?wakka=DevVSExpress

I will add and compile to get $spell_id working :grin:

AndMetal
05-20-2008, 01:31 AM
I will add and compile to get $spell_id working :grin:

Not sure if you've already started on this, but the variables are exported in zone/embparser.cpp (http://eqemulator.cvs.sourceforge.net/eqemulator/EQEmuCVS/Source/zone/embparser.cpp?revision=1.22&view=markup#l_509):
509 case EVENT_CAST_ON:

It should be as simple as changing it to this:

case EVENT_CAST_ON:
ExportVar(packagename.c_str(), "spell_id", function);


However, I'm not sure what exactly function will have to be, since I wasn't able to find any useful functions (http://www.eqemulator.net/wiki/wikka.php?wakka=QuestObjects) to do it.

In any case, I hope this helps :-)

Bulle
05-20-2008, 04:16 PM
What is in my embparser.cpp file :

case EVENT_ZONE:{
ExportVar(packagename.c_str(), "target_zone_id", data);
break;
}

case EVENT_CAST_ON:{
ExportVar(packagename.c_str(), "spell_id", data);
break;
}

Indeed the lines for EVENT_CAST_ON are not in the 1108 source code. This part must have been forgotten when the event was added to the Emu code.
I will open a bug for that so the job can be completed for a future release.

Bulle
05-20-2008, 04:22 PM
You also need to remove the already present "case EVENT_CAST_ON:", as it would not be very clean to keep both (it could even warrant you a warning from the compiler). Only the first one will be taken into account anyway.

egg
05-22-2008, 05:40 PM
Many thanks for the info, I have it working now. Btw, I was not sure if can compile on the new 2008 express , so found the 2005 express on ms web site. http://msdn.microsoft.com/en-us/express/aa975050.aspx

Andrew80k
05-23-2008, 10:57 AM
Yep, 2008 does work.