EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Anyone see an issue..? (https://www.eqemulator.org/forums/showthread.php?t=35646)

Reynin89 08-13-2012 05:02 AM

Anyone see an issue..?
 
Just curious, its been a loooong while since ive scripted anything, and i was never like the BEST but i considered myself pretty decent. Anyway computer got fried lost all scripts trying to rebuild, anyone see why this wouldnt work? Please and thank u for responses.

Code:

        sub EVENT_SPAWN {
quest::setnexthpevent(99);       
quest::settimer(DT,1);       
quest::settimer(Slow,2);       
quest::settimer(Nuke,3);       
}


        sub EVENT_HP {
if ($hpevent == 99) {
quest::shout2("You dare face the might of Vishimtar, mortals?!?!!");
quest::setnexthpevent(75);}

if ($hpevent == 75) {
quest::shout2("The power of the dragon ancients grows inside of me!");
quest::setnexthpevent(50);}

if ($hpevent == 50) {
quest::shout2("I...am...the Destroyer!!!");
quest::setnexthpevent(25);}

if ($hpevent == 25) {
quest::shout2("Arrghh! You will not defeat me!");
quest::setnexthpevent(1);}

if ($hpevent == 1) {
quest::shout2("Ahh.. My power was not.... Strong enough...");
}

Sub EVENT_DEATH {
quest::stoptimer("DT");
quest::stoptimer("Slow");
quest::stoptimer("Nuke");
}

Sub EVENT_SLAY {
quest::shout("You cannot stand yourself against a dragon god $name!");
}

Sub EVENT_TIMER {
if ($timer == "DT") {
quest::selfcast(6646);
}
if ($timer == "Slow") {
quest::selfcast(15236);
}
if ($timer =="Nuke") {
quest::selfcast(9051);
}
}

Again, thanks in advance!

Uleat 08-13-2012 05:14 AM

Start with putting a closing bracket on your 'sub EVENT_HP' procedure.

Reynin89 08-13-2012 05:18 AM

Ok great :D now hes shouting properly, but not casting the spells now it looks like
Quote:

sub EVENT_SPAWN {
quest::setnexthpevent(99);
quest::settimer(DT,1);
quest::settimer(Slow,2);
quest::settimer(Nuke,3);
}


sub EVENT_HP {
if ($hpevent == 99) {
quest::shout2("You dare face the might of Vishimtar, mortals?!?!!");
quest::setnexthpevent(75);}

if ($hpevent == 75) {
quest::shout2("The power of the dragon ancients grows inside of me!");
quest::setnexthpevent(50);}

if ($hpevent == 50) {
quest::shout2("I...am...the Destroyer!!!");
quest::setnexthpevent(25);}

if ($hpevent == 25) {
quest::shout2("Arrghh! You will not defeat me!");
quest::setnexthpevent(1);}

if ($hpevent == 1) {
quest::shout2("Ahh.. My power was not.... Strong enough...");
}
}

Sub EVENT_DEATH {
quest::stoptimer("DT");
quest::stoptimer("Slow");
quest::stoptimer("Nuke");
}

Sub EVENT_SLAY {
quest::shout("You cannot stand yourself against a dragon god $name!");
}

Sub EVENT_TIMER {
if ($timer == "DT") {
quest::selfcast(6646);
}
if ($timer == "Slow") {
quest::selfcast(15236);
}
if ($timer == "Nuke") {
quest::selfcast(9051);
}
}
I didnt know u could do a double close bracket i thought that was for the end ^_^

Oh and its set for 1 2 and 3 sec just for testing, not sure if that will make a difference?

Uleat 08-13-2012 05:42 AM

It's just a matter of closing what you open :) (refrigerator doors, toilet seats, etc...)


I'm not 'real' familiar with timers in script..but are the settimer names suppose to be in quotes as well in EVENT_SPAWN?

You can always put a test message in your timer checks to verify script operation as well..even if the server isn't
processing every casting call.

c0ncrete 08-13-2012 05:49 AM

if i had to guess, i would say that you can't use quest::selfcast() in EVENT_TIMER because it should be looking for the client that initiated the event.

i'd suggest starting those timers only when the npc was engaged (as well as stopping them when it is disengaged instead of just dead) and then pulling the target for the spell from the npc's hate list, since there is no need for the timers to be running constantly.

Reynin89 08-13-2012 05:51 AM

How would i make the cast do it on a target rather then selfcast then if u dont mind? And ill just keep messing with it more and hopefully figure it out thx guys

c0ncrete 08-13-2012 05:52 AM

oh, yeah... it could be the syntax issue uleat just pointed out as well. :)

c0ncrete 08-13-2012 05:57 AM

$npc->CastSpell(spellid,targetid) should work to target an individual.

examples:
$npc->CastSpell(6646, $npc->GetHateRandom()); // DT random hated client
$npc->CastSpell(15236, $npc->GetHateDamageTop()); // slow client that has done the most damage
$npc->CastSpell(9051, $npc->GetHateTop()); // nuke most hated client

Uleat 08-13-2012 06:12 AM

I assume that you know about this:

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


You can always check the source definitions for any changes since this was made.

Reynin89 08-13-2012 06:13 AM

great thanks i appreciate it u guys!

Reynin89 08-13-2012 06:16 AM

Ah 1 last thing, if the spell is a PB aoe it shouldnt matter which GetHate blah blah i type in correct?

c0ncrete 08-13-2012 06:21 AM

i'm not sure if it checks for valid range to target and whatnot, but it should hit everyone in range of the AoE, if that's what you mean.

Reynin89 08-13-2012 06:21 AM

Ok thanks again!

Reynin89 08-13-2012 07:28 PM

been working on this all day again trying stuff i assume now its sumthing wrong with how the timers r set up cuz im trying to have him shout on a timer and thats not working either >_<

Quote:

sub EVENT_AGGRO {
quest::setnexthpevent(99);
quest::settimer(DT,1);
quest::settimer(Slow,2);
quest::settimer(Nuke,3);
}


sub EVENT_HP {
if($hpevent == 99) {
quest::shout2("You dare face the might of Vishimtar, mortals?!?!!");
quest::setnexthpevent(75);}

if($hpevent == 75) {
quest::shout2("The power of the dragon ancients grows inside of me!");
quest::setnexthpevent(50);}

if($hpevent == 50) {
quest::shout2("I...am...the Destroyer!!!");
quest::setnexthpevent(25);}

if($hpevent == 25) {
quest::shout2("Arrghh! You will not defeat me!");
quest::setnexthpevent(1);}

if($hpevent == 1) {
quest::shout2("Ahh.. My power was not.... Strong enough...");
}
}

Sub EVENT_DEATH {
quest::stoptimer(DT);
quest::stoptimer(Slow);
quest::stoptimer(Nuke);
}

Sub EVENT_SLAY {
quest::shout("You cannot stand yourself against a dragon god $name!");
}

Sub EVENT_TIMER {
if ($timer == DT) {
quest::shout("TEST");
if ($timer == Slow) {
quest::shout("TEST");
if ($timer == Nuke) {
quest::shout("TEST");
}
}
Any noticeable issues?

Reynin89 08-13-2012 07:33 PM

Also I used a perl script checker and got this

Quote:

syntax error at Script line 33, near "quest::stoptimer" syntax error at Script line 35, near "}" Script had compilation errors.
I cant seem to find whats goin on tho -.-

..I put it in GeorgeS Tools and it says im missng a right bracket } I just CANNOT figure out where

joligario 08-13-2012 08:17 PM

I didn't go through much, but just got some obvious things for you:

Code:

sub EVENT_AGGRO {
  quest::setnexthpevent(99);
  quest::settimer("DT",1);
  quest::settimer("Slow",2);
  quest::settimer("Nuke",3);
}

sub EVENT_HP {
  if($hpevent == 99) {
    quest::shout2("You dare face the might of Vishimtar, mortals?!?!!");
    quest::setnexthpevent(75);
  }
  if($hpevent == 75) {
    quest::shout2("The power of the dragon ancients grows inside of me!");
    quest::setnexthpevent(50);
  }
  if($hpevent == 50) {
    quest::shout2("I...am...the Destroyer!!!");
    quest::setnexthpevent(25);
  }
  if($hpevent == 25) {
    quest::shout2("Arrghh! You will not defeat me!");
    quest::setnexthpevent(1);
  }
  if($hpevent == 1) {
    quest::shout2("Ahh.. My power was not.... Strong enough...");
  }
}
 
sub EVENT_DEATH {
  quest::stoptimer("DT");
  quest::stoptimer("Slow");
  quest::stoptimer("Nuke");
}
 
sub EVENT_SLAY {
  quest::shout("You cannot stand yourself against a dragon god $name!");
}
 
sub EVENT_TIMER {
  if ($timer eq "DT") {
    quest::shout("DT TEST");
  }
  if ($timer eq "Slow") {
    quest::shout("SLOW TEST");
  }
  if ($timer eq "Nuke") {
    quest::shout("NUKE TEST");
  }
}


bad_captain 08-13-2012 08:44 PM

Code:

Sub EVENT_TIMER {
if ($timer == DT) {
quest::shout("TEST");
if ($timer == Slow) {
quest::shout("TEST");
if ($timer == Nuke) {
quest::shout("TEST");
}
}

Count your brackets... 4 starting brackets, 2 ending brackets.

Reynin89 08-13-2012 08:56 PM

Jolig that is working thanks a lot! What was wrong with it?

bad_captain, I see I had 4 starting brackets and 2 ending, but where would the other 2 brackets have gone?

lerxst2112 08-13-2012 09:41 PM

There's a reason people format code, because it is much more obvious when things are wrong. Compare your code to this:

Code:

Sub EVENT_TIMER
{
        if ($timer == DT)
        {
                quest::shout("TEST");
               
        if ($timer == Slow)
        {
                quest::shout("TEST");
               
        if ($timer == Nuke)
        {
                quest::shout("TEST");
        }
}

Much more obvious where the problem is isn't it? I don't know what you edit with, but there are a ton of editors out there that do things like brace highlighting and matching that help to avoid these simple mistakes.

Uleat 08-13-2012 10:45 PM

This part:

Code:

Sub EVENT_TIMER {
if ($timer == DT) {
quest::shout("TEST");
if ($timer == Slow) {
quest::shout("TEST");
if ($timer == Nuke) {
quest::shout("TEST");
}
}


You're original posting was correct..the second one is wrong.

Quote:

[event handler] { // this bracket opens event handler procedure

[condition 1] { // this bracket opens condition 1 procedure
do_work_1;
} // this bracket closes condition 1 procedure

[condition 2] { // this bracket opens condition 2 procedure
do_work_2;
} // this bracket closes condition 2 procedure

} // this bracket closes event handler procedure

There could still be other issues, but this is how procedures should be wrapped.

I don't know if perl let's you use single-line conditional statements. If it does, and that's what you're attempting to do,
then the con checks shouldn't have the opening bracket after it.

IF perl does let you, it should look like this. Otherwise you need both open and close brackets around any procedure or
sub-procedure.

Code:

Sub EVENT_TIMER {
        if ($timer == DT)
                quest::shout("TEST");
        if ($timer == Slow)
                quest::shout("TEST");
        if ($timer == Nuke)
                quest::shout("TEST");
}

EDIT: omg..did it really take almost 3 hours to post this?? I'm so dense that I must be warping the very fabric of space-time...

wolfwalkereci 08-14-2012 01:20 AM

Here try this.
Also look at this:
Quote:

void quest::settimer(const char *timer_name, int seconds) {
So you basically set it to check DT (death touch?) every 1 second, slow every 2 and nuke every 3 or am I just way tired and reading that wrong.
Code:

sub EVENT_COMBAT {
        if ($combat_state == 1) {
                quest::setnexthpevent(99);
                quest::settimer(DT,1);
                quest::settimer(Slow,2);
                quest::settimer(Nuke,3);
        } else {
                quest::stoptimer("DT");
                quest::stoptimer("Slow");
                quest::stoptimer("Nuke");
                quest::depop();
        }
}

sub EVENT_HP {
        if($hpevent <= 99 && $hpevent >= 98) {
                quest::shout2("You dare face the might of Vishimtar, mortals?!?!!");
                quest::setnexthpevent(75);
        }
        if($$hpevent <= 75 && $hpevent >= 74) {
                quest::shout2("The power of the dragon ancients grows inside of me!");
                quest::setnexthpevent(50);
        }
        if($hpevent <= 50 && $hpevent >= 49) {
                quest::shout2("I...am...the Destroyer!!!");
                quest::setnexthpevent(25);
        }
        if($hpevent <= 25 && $hpevent >= 24) {
                quest::shout2("Arrghh! You will not defeat me!");
        }
}

Sub EVENT_DEATH {
        quest::shout2("Ahh.. My power was not.... Strong enough...");
        quest::stoptimer(DT);
        quest::stoptimer(Slow);
        quest::stoptimer(Nuke);
}

Sub EVENT_SLAY {
        quest::shout("You cannot stand yourself against a dragon god $name!");
}

Sub EVENT_TIMER {
        if ($timer == DT) {
                quest::shout("TEST"); }
        if ($timer == Slow) {
                quest::shout("TEST"); }
        if ($timer == Nuke) {
                quest::shout("TEST"); }
}


Maze_EQ 08-14-2012 08:55 AM

If you need additional help you can contact me at akaishigpg@gmail.com

c0ncrete 08-14-2012 01:15 PM

as for your timer checks, when you are using a string, you should enclose it in quotations and use the eq operator (if the name of your timer is an integer, you don't need the quotations and you use == instead). it's also better practice to use elsif for when you only expect a single condition to be met, otherwise the script will continue to evaluate the rest of the conditions instead of stopping at the first one it sees. here's an example:

Code:

Sub EVENT_TIMER
{
        if ($timer eq "DT")
        {
                quest::shout("DT timer triggered");
        }
        elsif ($timer eq "Slow")
        {
                quest::shout("Slow timer triggered");
        }
        elsif ($timer eq "Nuke")
        {
                quest::shout("Nuke timer triggered");
        }
}

additionally, i don't think it's necessary to explicitly stop timers on NPC death.

sorvani 08-14-2012 03:52 PM

Quote:

Originally Posted by c0ncrete (Post 211693)
additionally, i don't think it's necessary to explicitly stop timers on NPC death.

You generally do not have to. there have been a few rare oddities (MB in PoI) on PEQ where timers and such seem to not stop correctly on zone shutdown, but never noticed anything hang up past NPC death.

chrsschb 08-14-2012 11:47 PM

Quote:

Originally Posted by sorvani (Post 211695)
You generally do not have to. there have been a few rare oddities (MB in PoI) on PEQ where timers and such seem to not stop correctly on zone shutdown, but never noticed anything hang up past NPC death.

combatstate == 0 covers both avenues (raid wipe/agro drop and death)


All times are GMT -4. The time now is 03:13 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.