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 11-07-2012, 05:24 AM
deaddraqear
Sarnak
 
Join Date: May 2008
Location: california
Posts: 45
Default reset issue?

Alright, after a year or so absence, I try to dive into scripting and I realize I forgot way too much.. and didn't know a whole lot before I quit! =P
After a few hours of VARIOUS testing, I'm stumped.. A little help would be awesome!

Basic idea of event
1 - spawn mob
2 - 1 add spawns on aggro, and more every 25%
3 - if he or one of the adds kills a player, an add will spawn
4 - once main guy dies, everything else despawns, if still around

I have found 2 problems so far.. play testing on a monk, if I spawn the adds, and FD, the "$npc->SetHP(2500);" will heal him back to full, but it won't reset the hp event - no more adds until the next hpevent(x) is met.. is there a way to reset this maybe?

Also, for the life of me, I can't get timers to work.. I would like for him to despawn after so many minutes of no aggro..

This is the base code now, took the timers out obviously because I can't remember for the life of me how to get these to work properly.. =\

Code:
sub EVENT_SPAWN
	{
	quest::shout("Foolish mortals! You should not have awoken me from my slumber!");
	quest::setnexthpevent(100);
	}

	
sub EVENT_COMBAT 
	{
	if ($combat_state = 1) 
		{
		$npc->SetHP(2500);
		}
	}
	
sub EVENT_HP
	{
	if($hpevent == 100)
		{
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::setnexthpevent(75);
		}
	if($hpevent == 75)
		{
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::setnexthpevent(50);
		}
	if($hpevent == 50)
		{
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::spawn2(111255,0,0,"202.1","357","-24.2","128");
		quest::setnexthpevent(25);
		}
	if($hpevent == 25)
		{
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::spawn2(111255,0,0,"202.1","357","-24.2","128");
		quest::spawn2(111255,0,0,"202.1","357","-24.2","128");
		quest::setnexthpevent(0);
		}
	if($hpevent ==0)
		{
		quest::shout("Impossible!");
		quest::depopall(111253);
		quest::depopall(111254);
		quest::depopall(111255);
		}
	}	
	
sub EVENT_SLAY
	{
	quest::shout("Soandso will be pleased with your death! I shall feast on your corpse!");
	quest::spawn2(111253,0,0,"202.1","357","-24.2","128");
	}

sub EVENT_DEATH
	{
	quest::shout("Impossible!");
	quest::depopall(111253);
	quest::depopall(111254);
	quest::depopall(111255);
	}
Reply With Quote
  #2  
Old 11-07-2012, 07:45 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

First, I am not sure if your HP event 100 would do anything, though I would need to test to verify that. I think you would need to start at 99 or so for it to trigger. Next, when you reset the event and set the HPs, you also need to set the HP event back to the one you want to trigger first again with "quest::setnexthpevent(xxx)". Also, it looks like you are checking if "$combat_state = 1", which is wrong for 2 reasons. To do a comparison, you need to use == not =, and you should be checking for combat state 0, not 1, as 1 is for when combat is started and 0 is for ended. Last, timers are pretty simple, you just need to set the timer in your EVENT_COMBAT where you set the HPs back to 100%. Then, check the timer in EVENT_TIMER and do a depop. There are lots of timer examples on the forums, and explanations in the wiki if you need help with that. Otherwise, post what you have for timers so far and we can tell you what you are doing wrong.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 11-07-2012 at 07:56 AM..
Reply With Quote
  #3  
Old 11-07-2012, 12:40 PM
deaddraqear
Sarnak
 
Join Date: May 2008
Location: california
Posts: 45
Default

Well, as it was up, it was working fine at hpevent(100), but I changed it anyway to 95.

As for the 2 mistakes.. yeah, I really don't know how I got turned around in there.. I had changed that portion of the code about 20 times using timers, I must have missed them both (rest of code uses == like it should =P )

I read a few examples, as well as the wiki regarding timers.. And I know I had them figured out and working last time I was messing around with scripting, but it seems I've drank too much in the past year maybe? =P But, after using a few examples here on the forums, I threw this together real quick (and yet, I don't really see any mistakes), but it doesn't work.. (short timer for easy testing)

Code:
sub EVENT_SPAWN
	{
	quest::shout("Foolish mortals! You should not have awoken me from my slumber!");
	quest::settimer("depop",10);
	quest::setnexthpevent(95);
	}
	
sub EVENT_COMBAT 
	{
	if ($combat_state == 0) 
		{
		quest::settimer("depop",10);
		$npc->SetHP(4500);
		}
        if ($combat_state == 1)
		{
		quest::stoptimer("depop");
		}
	}
	
sub EVENT_TIMER
	{
	if ($timer eq "depop")
		{
		quest::depopall(11253);
		quest::depopall(11254);
		quest::depopall(11255);
		quest::depopall(11210);
		}
	}	
	
sub EVENT_HP
	{
	if($hpevent == 95)
		{
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::setnexthpevent(75);
		}
	if($hpevent == 75)
		{
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		$npc->SetHP(4275);
		quest::setnexthpevent(50);
		}
	if($hpevent == 50)
		{
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::spawn2(111255,0,0,"202.1","357","-24.2","128");
		$npc->SetHP(3375);
		quest::setnexthpevent(25);
		}
	if($hpevent == 25)
		{
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::spawn2(111254,0,0,"202.1","357","-24.2","128");
		quest::spawn2(111255,0,0,"202.1","357","-24.2","128");
		quest::spawn2(111255,0,0,"202.1","357","-24.2","128");
		$npc->SetHP(2250);
		quest::setnexthpevent(0);
		}
	if($hpevent == 0)
		{
		quest::shout("Impossible!");
		quest::depopall(111253);
		quest::depopall(111254);
		quest::depopall(111255);
		}
	}	
	
sub EVENT_SLAY
	{
	quest::shout("Soandso will be pleased with your death! I shall feast on your corpse!");
	quest::spawn2(111253,0,0,"202.1","357","-24.2","128");
	}

sub EVENT_DEATH
	{
	quest::shout("Impossible!");
	quest::depopall(111253);
	quest::depopall(111254);
	quest::depopall(111255);
	}
Reply With Quote
  #4  
Old 11-07-2012, 01:50 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
3 - if he or one of the adds kills a player, an add will spawn
Still far from a scripting expert myself. Wouldn't the above stipulations of the overall encounter require for a script to exist for the adds? Of which would need to send a signal to the "boss" with an EVENT_DEATH defined in that script of the add(s)?

The EVENT_SLAY I would think is confined to the boss itself, since the script is the boss's script, no?

Don't know for sure, I'm here for injection in case it may help, but, definitely here to learn as well (and since I'd like to know the exact solution to the OP's question as well there is no point in me making a new thread). IOW's please don't see this as a hijack what-so-ever, as that is far from my intent.

*Edited - Yes, I read OP's #3 if a spawn was killed it would spawn another. Not quite sure how I did, but I did. Going back to my safe little cubby now, I'm apparently in no mental status to try to comprehend at the moment. <grin> Sorry OP.
Reply With Quote
  #5  
Old 11-07-2012, 01:58 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by ghanja View Post
Still far from a scripting expert myself. Wouldn't the above stipulations of the overall encounter require for a script to exist for the adds? Of which would need to send a signal to the "boss" with an EVENT_DEATH defined in that script of the add(s)?

The EVENT_SLAY I would think is confined to the boss itself, since the script is the boss's script, no?

Don't know for sure, I'm here for injection in case it may help, but, definitely here to learn as well (and since I'd like to know the exact solution to the OP's question as well there is no point in me making a new thread). IOW's please don't see this as a hijack what-so-ever, as that is far from my intent.
I misread OP's #3 entirely. Keeping this here though incase someone is in the middle of replying thus quoting me. (i.e. so I don't appear to ninja edit like a coward)
Reply With Quote
  #6  
Old 11-07-2012, 06:17 PM
deaddraqear
Sarnak
 
Join Date: May 2008
Location: california
Posts: 45
Default

Lol, no worries man.. I think my mental state is a little fubared as well - this script should be an easy one but it's kickin my ass =\
Reply With Quote
  #7  
Old 11-07-2012, 07:38 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default

Quote:
it won't reset the hp event
Since you set the first HP event when it spawns, it won't reset it. If you instead set the first HP event in the agro(combat state == 1) and then every time it is agro'd, it will re-set the hp event to 95.

Also the final HP event is redundant as it will be caught by the death event.

You should also consider using $npc->GetX(), etc(or $npc->GetX() -5, if you want them to not spawn directly on top on the main mob) for the location of the spawned mobs or leash the main mob or the player can just pull the mob away from that loc and the adds won't agro.
Reply With Quote
  #8  
Old 11-07-2012, 09:57 PM
deaddraqear
Sarnak
 
Join Date: May 2008
Location: california
Posts: 45
Default

Yeah, I wasn't sure about the final hpevent, but read somewhere it was required.. hadn't actually tested it, but I know without the sub EVENT_DEATH part, he wont despawn the adds or do his shout.. I'll throw the final hp event out and see how it goes..

I have the mob perma rooted, and summons.. adds aren't permarooted though..

Since the subject came up, anyone know how you would go about summoning the adds that pop on kills, on the killed player's corpse loc?
Reply With Quote
  #9  
Old 11-07-2012, 10:05 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default

Keep the death event, lose the final hp event.

source:
Code:
parse->EventNPC(EVENT_SLAY, killerMob->CastToNPC(), this, "", 0);
"this" is the client being killed, so you could do like $client->GetX()...etc... to get the coordinates of the killed player.
Reply With Quote
  #10  
Old 11-08-2012, 06:54 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

The timer looks fine as far as I can tell from a quick review. Maybe add in a shout before the depopalls for debugging purposes so you can see if the script is making it to that point or not. Adding debugs throughout a script that is giving you trouble is a good way to tell if anything is wrong with it. You can add a shout (or whatever message) before and after any section of the script so you can see exactly what is happening at each step. It is also good to put the variables you are using or expecting into the debug messages so you can make sure they are being set as you expect (such as $timer).
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #11  
Old 11-08-2012, 10:13 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

If you're still using the code in post #3, it looks like you have your combat states reversed.
Reply With Quote
  #12  
Old 11-08-2012, 07:23 PM
deaddraqear
Sarnak
 
Join Date: May 2008
Location: california
Posts: 45
Default

Sigh, work sucks..

I'll try your debugging Trev - and I feel much better knowing that the code "looks fine" cuz I couldn't see any problems with it either haha..

Also, thx Caryatis! Once I get the rest of this crap fixed, I'll add in the killed player code.. =)

Will let ya guys know if I get it all figured out
Reply With Quote
  #13  
Old 11-08-2012, 09:15 PM
deaddraqear
Sarnak
 
Join Date: May 2008
Location: california
Posts: 45
Default

Thanks Trev for the debug input =D Got it figured out.. and to be honest, I don't really know what it was =P

Now, to tackle the pc-dying-spawning-mob part =)

Thanks guys! I'll post here if I have any issues or questions

*Edit - was gonna post code but not gonna =P
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 07:24 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