|  |  | 
 
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  | 
	
		
   
   
      | Quests::Q&A This is the quest support section |  
	
	
		
	
	
	| 
			
			 
			
				09-30-2008, 01:37 AM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Oct 2005 Location: michigain 
						Posts: 260
					      |  |  
	| 
				 variables not reseting? 
 im making a quest and its not the only one i have had this happen in and it eventually breaks all my quest that use them. 
if i use a $var then it does not reset without a reload quest.
 
example.
 
	Code: my $Random = quest::ChooseRandom(Warrior,Cleric,Paladin,Ranger,Shadowknight,Druid,Monk,Bard,Rogue,Shaman,Necromancer,Wizard,Magician,Enchanter,Beastlord,Berserker);
sub EVENT_SPAWN 
{ 
quest::setnexthpevent(99);
}
sub EVENT_HP 
{ 	
if($hpevent == 99)
{ 
quest::shout("Only The powers of a $Random can defeat me!");
}
} this quest should say every time it gets to 99% that whatever class can kill him.. but i hit it it says wiz then i repop it it still says wiz and will continue to say wiz until i reload quest then it will redo the random and say something else.
 
is there something i can put in here to clear the variables like a #reloadquest |  
	
		
	
	
	| 
			
			 
			
				09-30-2008, 02:29 AM
			
			
			
		 |  
	| 
		
			|  | Developer |  | 
					Join Date: Mar 2003 
						Posts: 1,500
					      |  |  
	| 
 That's because it only executes that location once. 
You can move your random into the HP event, or somewhere that it will be executed more than once. Another option is to set a timer and have your random execute again.
 
For example:
 
	Code: my $Random;
sub EVENT_SPAWN 
{ 
quest::setnexthpevent(99);
}
sub EVENT_HP 
{ 	
if($hpevent == 99)
{ 
$Random = quest::ChooseRandom(Warrior,Cleric,Paladin,Ranger,Shadowknight,Druid,Monk,Bard,Rogue,Shaman,Necromancer,Wizard,Magician,Enchanter,Beastlord,Berserker);
quest::shout("Only The powers of a $Random can defeat me!");
}
} |  
	
		
	
	
 
  |  |  |  |  
	| 
			
			 
			
				09-30-2008, 02:38 AM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Oct 2005 Location: michigain 
						Posts: 260
					      |  |  
	| 
 ok this is the quest i got now 
	Code: my $Random;
sub EVENT_SPAWN 
{ 
quest::setnexthpevent(99);
}
sub EVENT_HP 
{ 	
if($hpevent == 99)
{ 
$Random = quest::ChooseRandom(Warrior,Cleric,Paladin,Ranger,Shadowknight,Druid,Monk,Bard,Rogue,Shaman,Necromancer,Wizard,Magician,Enchanter,Beastlord,Berserker);
quest::shout("Only The powers of a $Random can defeat me!");
}
}
sub EVENT_ATTACK
{
if($class eq $Random)
{
quest::say("You are the right one to kill me");
}
else
{
quest::say("You can not kill me you are a $class and you need to be a $Random");
}
} this is all with no #reloadquest
 
first time it shouts only the powers of a rouge can defeat me. then it says You can not kill me you are a warrior and you need to be a BLANK
 
repop hit again it shout only the powers of a wiz can defeat me and then it says You can not kill me you are a warrior and you need to be a rouge 
and so on
 
what its doing is first time its blank then every time after it its what it said the previous time its not clearing it right. |  
 
  |  |  |  |  
	
		
	
	
	| 
			
			 
			
				09-30-2008, 03:22 AM
			
			
			
		 |  
	| 
		
			|  | Developer |  | 
					Join Date: Mar 2003 
						Posts: 1,500
					      |  |  
	| 
 Correct. I was only giving you an example of what to do with it. It will not choose the random until he is actually at 99% health. EVENT_ATTACK executes before he gets to 99%. 
Maybe if I know a little more how you want it to work, I can give you better code. Looking from what you have, try this:
 
	Code: my $Random;
sub EVENT_SPAWN {
  quest::setnexthpevent(99);
  $Random = quest::ChooseRandom(Warrior,Cleric,Paladin,Ranger,Shadowknight,Druid,Monk,Bard,Rogue,Shaman,Necromancer,Wizard,Magician,Enchanter,Beastlord,Berserker);
}
sub EVENT_HP {	
  if($hpevent == 99) {
    quest::shout("Only The powers of a $Random can defeat me!");
  }
}
sub EVENT_ATTACK {
  if($class eq $Random) {
    quest::say("You are the right one to kill me");
  }
  else {
    quest::say("You can not kill me you are a $class and you need to be a $Random");
  }
} |  
	
		
	
	
	| 
			
			 
			
				09-30-2008, 04:05 AM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Oct 2005 Location: michigain 
						Posts: 260
					      |  |  
	| 
 ok i think i get it by calling it in the spawn im calling it before anything else calls is so then it knows what to do with it from that point on until he is repoped then it reads it again because if the spawn. |  
	
		
	
	
	
	
	| 
	|  Posting Rules |  
	| 
		
		You may not post new threads You may not post replies You may not post attachments You may not edit your posts 
 HTML code is Off 
 |  |  |  All times are GMT -4. The time now is 07:58 AM.
 
 |  |  
    |  |  |  |  
    |  |  |  |  
     |  |  |  |  
 |  |