Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #19  
Old 11-15-2008, 06:11 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

I think there's 2 main issues:
  1. You're using = instead of == (defining instead of comparing, which will always return true)
  2. All of those nested if statements don't seem to be doing anything, except for the first one

I would highly recommend using tabs (vs spaces) to better visualize the opening & closing brackets:
Code:
sub EVENT_KILLED_MERIT {
	if (($ulevel <= 8)&&($mlevel + 3 >= $ulevel))  {
		if (($ulevel = 9)&&($mlevel + 4 >= $ulevel))   { 
			if (($ulevel = 10)&&($mlevel + 5 >= $ulevel))  {
				if (($ulevel = 11)&&($mlevel + 5 >= $ulevel))  {
					if (($ulevel = 12)&&($mlevel + 5 >= $ulevel))  {
						if (($ulevel = 13)&&($mlevel + 6 >= $ulevel))  {
							if (($ulevel = 14)&&($mlevel + 6 >= $ulevel))  {
								if (($ulevel = 15)&&($mlevel + 6 >= $ulevel))  {
									if (($ulevel = 16)&&($mlevel + 6 >= $ulevel))  {
										if (($ulevel = 17)&&($mlevel + 7 >= $ulevel))  {
											if (($ulevel = 18)&&($mlevel + 7 >= $ulevel))  {
												if (($ulevel = 19)&&($mlevel + 7 >= $ulevel))  {
													if (($ulevel = 20)&&($mlevel + 7 >= $ulevel))  {
														if (($ulevel = 21)&&($mlevel + 8 >= $ulevel))  {
															if (($ulevel = 22)&&($mlevel + 8 >= $ulevel))  {
																if (($ulevel = 23)&&($mlevel + 8 >= $ulevel))  {
																	if (($ulevel = 24)&&($mlevel + 8 >= $ulevel))  {
																		if (($ulevel = 25)&&($mlevel + 9 >= $ulevel))  {
																			if (($ulevel = 26)&&($mlevel + 9 >= $ulevel))  {
																				if (($ulevel = 27)&&($mlevel + 9 >= $ulevel))  {
																					if (($ulevel = 28)&&($mlevel + 10 >= $ulevel))  {
																						if (($ulevel = 29)&&($mlevel + 10 >= $ulevel))  {
																							if (($ulevel = 30)&&($mlevel + 10 >= $ulevel))  {
																								if (($ulevel = 31)&&($mlevel + 11 >= $ulevel))  {
																									if (($ulevel = 32)&&($mlevel + 11 >= $ulevel))  {
																										if (($ulevel = 33)&&($mlevel + 12 >= $ulevel))  {
																											if (($ulevel = 34)&&($mlevel + 12 >= $ulevel))  {
																												if (($ulevel = 35)&&($mlevel + 12 >= $ulevel))  {
																													if (($ulevel = 36)&&($mlevel + 12 >= $ulevel))  {
																														if (($ulevel = 37)&&($mlevel + 13 >= $ulevel))  {
																															if (($ulevel = 38)&&($mlevel + 13 >= $ulevel))  {
																																if (($ulevel = 39)&&($mlevel + 13 >= $ulevel))  {
																																	if (($ulevel = 40)&&($mlevel + 13 >= $ulevel))  {
																																		if (($ulevel = 41)&&($mlevel + 14 >= $ulevel))  {
																																			if (($ulevel = 42)&&($mlevel + 15 >= $ulevel))  {
																																				if (($ulevel = 43)&&($mlevel + 15 >= $ulevel))  {
																																					if (($ulevel = 44)&&($mlevel + 15 >= $ulevel))  {
																																						if (($ulevel = 45)&&($mlevel + 16 >= $ulevel))  {
																																							if (($ulevel = 46)&&($mlevel + 16 >= $ulevel))  {
																																								if (($ulevel = 47)&&($mlevel + 16 >= $ulevel))  {
																																									if (($ulevel = 48)&&($mlevel + 16 >= $ulevel))  {
																																										if (($ulevel = 49)&&($mlevel + 17 >= $ulevel))  {
																																											if (($ulevel = 50)&&($mlevel + 17 >= $ulevel))  {
																																											}
																																										}
																																									}
																																								}
																																							}
																																						}
																																					}
																																				}
																																			}
																																		}
																																	}
																																}
																															}
																														}
																													}
																												}
																											}
																										}
																									}
																								}
																							}
																						}
																					}
																				}
																			}
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}

		#Checking if the anti-AE global is defined to stop credits from being earned if it is
		if (!defined($qglobals{anti_ae})) {

			#Optional code to randomly spawn a named NPC when the target dies.
			my $x = $npc->GetX();
			my $y = $npc->GetY();
			my $z = $npc->GetZ();
			my $named = quest::ChooseRandom(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50);

			if ($named == 50) {
				quest::unique_spawn(quest::ChooseRandom(2700667,2700670,2700673,2700676,2700683,2700685),0,0,$x,$y,$z);
				$named = undef;
			}

			#Checking if the exp_credit global is defined for this character
			if (defined($qglobals{exp_credits})) {
			#Making sure the character is not already level 50+
				if ($ulevel <= 49) {
					#Adding 1 point/credit to the exp_credits global
					quest::setglobal("exp_credits", $qglobals{exp_credits}+1, 5, "F");

					#Checking the character's level range        
					if ($ulevel >= 1 && $ulevel <= 5) {
						#Variable to define how many exp_credits are needed to level in this level range.
						my $exp_req = 3;
						if ($qglobals{exp_credits} >= $exp_req) {
							quest::level($ulevel+1);
							#subtract the actual exp_credits global points. Note that this has to be 1 more than the exp_req global is set to.
							quest::setglobal("exp_credits", $qglobals{exp_credits}-4, 5, "F");
						}
						my $exp_needed = ($exp_req - $qglobals{exp_credits});
						$client->Message(5, "You currently need $exp_needed experience credits for your next level.");
					}
					#same thing as above, but for the next higher level range
					if ($ulevel >= 6 && $ulevel <= 15) {
						my $exp_req = 5;
							if ($qglobals{exp_credits} >= $exp_req) {
								quest::level($ulevel+1);
								quest::setglobal("exp_credits", $qglobals{exp_credits}-6, 5, "F");
							}
						my $exp_needed = ($exp_req - $qglobals{exp_credits});
						$client->Message(5, "You currently need $exp_needed experience credits for your next level.");
					}
					if ($ulevel >= 16 && $ulevel <= 30) {
						my $exp_req = 12;
							if ($qglobals{exp_credits} >= $exp_req) {
								quest::level($ulevel+1);
								quest::setglobal("exp_credits", $qglobals{exp_credits}-13, 5, "F");
							}
						my $exp_needed = ($exp_req - $qglobals{exp_credits});
						$client->Message(5, "You currently need $exp_needed experience credits for your next level.");
					}
					if ($ulevel >= 31 && $ulevel <= 50) {
						my $exp_req = 22;
							if ($qglobals{exp_credits} >= $exp_req) {
								quest::level($ulevel+1);
								quest::setglobal("exp_credits", $qglobals{exp_credits}-23, 5, "F");
							}
						my $exp_needed = ($exp_req - $qglobals{exp_credits});
						$client->Message(5, "You currently need $exp_needed experience credits for your next level.");
					}
				}
				#If the character is level 70+, delete the exp_credit global for them since it is no longer needed.
				if ($ulevel >= 50) {
					quest::delglobal("exp_credits"); 
				}      
			}

			#Checking if the new_credits global is defined for this character
			if (defined($qglobals{new_credits})) {
				#Adding 1 point/credit to the new_credits global
				quest::setglobal("new_credits", $qglobals{new_credits}+2, 5, "F");
				#Setting the anti_ae global after all credits are applied.
				quest::setglobal("anti_ae", 1, 5, "S5");
				my $total_credits = ($qglobals{new_credits} + 1);
				$client->Message(5, "You currently have $total_credits Credits.");
			}
	      
		}
	   
	}
}
Quote:
Originally Posted by paaco View Post
ok I lied, seems like the first if statement works, anyone over that level gets no xp...what did I do wrong?
What exactly are you trying to do?

There's a lot of things I can think of that would trim the script down a LOT, but I think it would be better to understand where we're trying to get first.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
 


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 05:09 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3