Thread: reset issue?
View Single Post
  #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