The best way to solve a quest issue is to copy your entire quest into notepad so you don't lose it and then start with just 1 very small section at a time to make sure they work. Eventually you will get to a point where it doesn't work at all and you will know that the last thing you added is what caused it.
Try just using this from your code as the entire quest: Code:
sub EVENT_ITEM { |
Moving the plugins is what worked, thank you =)
|
Trev, can't
$class == 'Warrior' be replaced with $class == 1 ? |
Since that quest, I have refined our armor scripts that use Arrays a bit to make them cleaner and a bit easier to manage. If done properly, I don't think the whole "if $class" stuff needs to be checked at all. Here is an example of the new format we use on Storm Haven for a bit more advanced Arrays for armor quests:
Code:
#Rough Defiant Armor Quests |
looks interetsing, but you not answering my question though =P
I have looked at the quest wiki, and it doesn't say anywhere if numbers instead of class names can be used for the IF check - you know like 1 (warrior), 7 (monk) etc |
Technically, it should have been "$class eq 'Warrior'", not "$class == 'Warrior'", but I could never get it to work that way for some reason. My best guess is that it is automatically replacing the class name with the number. If so, then I don't see any reason why using the numbers wouldn't work. It might be a bit harder to reference what is going on in your scripts though if you do.
The reason I mentioned the new code I am using is because checking for which class it is should not have to be done with an array, since $class already does that. You just have to do things in the right order for them to work properly. It can make scripts much easier to manage. I am probably going to try to work up some more similar variations to the script above that I just posted. I will try to get one up that also has arrays for turn ins. It should make dealing with armor quests or epic quests considerably cleaner and much less scripting. |
Actually, it should be $class eq "Warrior" with double quotes. Using single quotes is an array of char's, while double quotes is used for strings. Maybe why it didn't work. I like the way you do it now with the hashes. That's pretty slick. I love perl.
|
Quote:
|
If you really had a reason to use numbers for classes, it would be easy to make a hash to do it. But, it would just be extra work that isn't really needed unless you needed numbers to do a random or something. Here is an example:
Code:
%ClassConvert = ( #Convert each Class Name into a Number Then, to get that class number, you could just do this: Code:
my $classnum = $ClassConvert{$class}; Then, you can do: Code:
if ($classnum == 1) |
There might be a $client->GetClass() type of command also. I know when I was working on $client->GetBaseRace(), it gives an integer rather than "Erudite".
|
I'm just curious but can this code be used to summon more than one item for a specific class? For example if I need to summon 2 weapons for a class who dual wields. I've tried a few things but I couldn't get anything to work.
Code:
sub EVENT_ITEM { |
For classes that get more than 1 reward as their epic 1.0, I just had to make sections for each of them:
Code:
if (($class == 'Warrior') && ($class ne 'Shadowknight' && $class ne 'Paladin' && $class ne 'Ranger' && $class ne 'Bard' && $class ne 'Beastlord' && $class ne 'Cleric' && $class ne 'Druid' && $class ne 'Shaman' && $class ne 'Wizard' && $class ne 'Magician' && $class ne 'Enchanter' && $class ne 'Necromancer' && $class ne 'Rogue' && $class ne 'Monk' && $class ne 'Berserker')) |
Thanks, that got it. I was trying a few things to do it in one block but I'm not knowledgeable enough in perl to do so. Using if, elsif, statements worked flawlessly.
|
[QUOTE=Andrew80k;171254]Actually, it should be $class eq "Warrior" with double quotes. Using single quotes is an array of char's, while double quotes is used for strings.QUOTE]
This solved another problem of mine. Thanks Andrew80K. |
no idea how, but double post.. sry ><
|
All times are GMT -4. The time now is 05:29 AM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.