Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 08-05-2008, 11:13 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default $npc->castSpell(ID,Spell); not working

I don't know why, but I can't seem to get this command working. I have also tried quest::castspell(ID,Spell); but that doesn't seem to work in this quest either. I'm not quite sure what is wrong. This is an NPC that is supposed to be spawned during an event and then switch textures a few times and then depop and cause a really nasty AE if it isn't killed before the last timer finishes. It goes through all of the timers, but stops working on the last one. Though, if I remove "$npc->castSpell($client,6536);" the script completes as it should.

I have it set the variable $client to equal userid so that I am sure it is passing that info into the command. I am testing this with my GM char, but I have tried with invuln on or invuln off and with or without attacking the NPC. I can't get it to work no matter what I have tried.

Code:
#Explosive Storm

my $client;

sub EVENT_SPAWN {
  
quest::npctexture(3);
quest::settimer("start_storm",1);

}

sub EVENT_COMBAT {

  if ($combat_state == 1) {
$client = $userid; 
}
  
}

sub EVENT_TIMER {

  if ($timer eq "start_storm") {
    quest::stoptimer("start_storm");
    quest::npctexture(3);
    quest::settimer("change_storm1",5); }

  if ($timer eq "change_storm1") {
    quest::stoptimer("change_storm1");
    quest::npctexture(2);
    quest::emote("gains more energy and becomes less stable.");
    quest::settimer("change_storm2",5); }

  if ($timer eq "change_storm2") {
    quest::stoptimer("change_storm2");
    quest::npctexture(1);
    quest::emote("gains even more energy and looks extremely dangerous.");
    quest::settimer("change_storm3",5); }
    
  if ($timer eq "change_storm3") {
    quest::stoptimer("change_storm3");
$npc->castSpell($client,6536);
    quest::emote("explodes and disperses.");
    quest::depop(); }

}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 08-06-2008, 09:26 AM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default

i think you have the args swapped.

$npc->CastSpell(1948, $charid, 10, -1, -1);
args are spellid, targetid

is working in one of my scripts... maybe $charid instead of $userid? not sure if case sensitive castSpell vs CastSpell
Reply With Quote
  #3  
Old 08-06-2008, 04:21 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Ya, I am just going off of the wiki here:

http://www.eqemulator.net/wiki/wikka...=QuestTutorial

Which says to do it this way:

Code:
quest::castspell(id,spellid) - Casts "spell" on entity with "id". This is buggy, if it does not work try $npc->CastSpell(id,spellid);
Though, I have tried swapping ID and Spell ID around and it didn't make any difference.

The Quest Object Wiki says to do it the way you mentioned:

http://www.eqemulator.net/wiki/wikka...a=QuestObjects

Code:
$npc->CastSpell(spellid,userid); (I found some strange bugs with quest::castspell() and all of these where resolved by using the object...)

**And later on it shows the actual format of: **

CastSpell(spell_id, target_id, slot= 10, casttime= -1, mana_cost= -1)
Once I get it working, I will update the wiki with the correct format. Do you know if the 10, -1, -1 arguments in your example are required? I will try them out and see what happens. Thanks, I think with this info I can hopefully get this working finally lol. That is what I get for fully trusting a wiki page :P
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #4  
Old 08-07-2008, 05:10 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Oh, it is the case sensitive issue lol. I am using GoergeS' Quest Editor Tool and it is changing this:

Code:
$npc->CastSpell(6536, $userid);
to this:

Code:
$npc->castSpell(6536, $userid);
I edited the quest manually and it started working right away lol. I am going to post that issue in his tools section so he can get it resolved.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #5  
Old 08-07-2008, 06:48 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

This works on TGC:

Code:
$npc->CastSpell(17,$userid); #Light Healing
Reply With Quote
  #6  
Old 08-07-2008, 07:42 AM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

It could have been related to that space in between '(6536,' and '$userid)' ; (6536, $userid).
or any other invisible character that got caught up in the script ( if you copy-pasted it). I've wasted days on scripts only to find out they were always good, just had unknown, invisible characters (usually when I copy-paste stuff).
This program;
Perl Editor by EngInSite
is for windows (although i can run it with Wine too), is free and has an option to show all hidden characters in the script.
Reply With Quote
  #7  
Old 08-08-2008, 03:03 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

No, it was the case sensitive issue that I already posted about 2 posts up :P It has been resolved and GeorgeS already fixed it in his quest editor. His tool was changing the case of the letter C to lowercase, which is why it wasn't working. Resolved now, thanks!
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
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 04:20 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3