View Single Post
  #1  
Old 08-04-2008, 04:56 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default Using Variables in Quest Objects

For some reason, I can't seem to get this working. It seems like variables don't work in quest objects. I have tried many different combinations to get this working, but none seem to do what I want. Basically, I want the NPC to gate to one of the 8 possible locations when they are attacked.

This first code doesn't work at all, even though it seems to me like it should:

Code:
sub EVENT_ATTACK {

my $warp1 = "212.9, 2628.3, 67.2";
my $warp2 = "220.8, 2708.3, 67.1";
my $warp3 = "258.9, 2712.3, 67.1";
my $warp4 = "243.3, 2658.4, 67.1";
my $warp5 = "223.8, 2658.4, 67.1";
my $warp6 = "271.9, 2604.8, 67.1";
my $warp7 = "318.4, 2678.8, 67.1";
my $warp8 = "370.4, 2677.7, 76.1";

my $gate = quest::ChooseRandom($warp1,$warp2,$warp3,$warp4,$warp5,$warp6,$warp7,$warp8);

$npc->SendTo($gate);

}

This second version doesn't work right either, but at least it does something. Basically, it always teleports the NPC to the $warp8 location. I am guessing it is just executing all of the 8 locations and ends up on the last one. I don't know why it is executing these even though I am only trying to define them as a variable at that point. It definitely doesn't seem to want to use the random command properly to work for quest objects. I guess they don't mix well?
Code:
sub EVENT_ATTACK {

my $warp1 = $npc->SendTo(212.9, 2628.3, 67.2);
my $warp2 = $npc->SendTo(220.8, 2708.3, 67.1);
my $warp3 = $npc->SendTo(258.9, 2712.3, 67.1);
my $warp4 = $npc->SendTo(243.3, 2658.4, 67.1);
my $warp5 = $npc->SendTo(223.8, 2658.4, 67.1);
my $warp6 = $npc->SendTo(271.9, 2604.8, 67.1);
my $warp7 = $npc->SendTo(318.4, 2678.8, 67.1);
my $warp8 = $npc->SendTo(370.4, 2677.7, 76.1);

quest::ChooseRandom($warp1,$warp2,$warp3,$warp4,$warp5,$warp6,$warp7,$warp8);

}
I know the random part it working for locations, cause I have pulled out what it is selecting by adding this into the script:

Code:
quest::say("Trying to move to loc, $gate");
This isn't the full encounter I am planning to make, but until I can get this part working, I can't complete the rest of it.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 08-04-2008 at 12:58 PM..
Reply With Quote