Project 1999

Go Back   Project 1999 > Server Issues > Resolved Issues

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 10-29-2011, 12:20 PM
nilbog nilbog is offline
Project Manager

nilbog's Avatar

Join Date: Oct 2009
Posts: 14,645
Default

Quote:
Originally Posted by mwatt [You must be logged in to view images. Log in or Register.]
Seems to me that if initial $random_result value were always garuanteed to be between 1 and 100 inclusive, and if that value really was random with that 1 to 100 range over time, then yeah, you'd get a pop 10% of the time.

However, the code simply checks for greater to or equal to 90 and less than or equal to 100. Are you certain that the pre-check value of $random_result always falls between 1 and 100 inclusive? Because if not, you aren't getting 10% out of this. Also if the distribution is not really random, you aren't getting 10% out of this.
Locs and names have been classified to protect the identity of the npcs involved.

Code:
#nilbog
#forager cycle

sub EVENT_SPAWN {
quest::settimer("forage",5);
}

my $forager = classified;
my @aRareID = (classified);

sub EVENT_TIMER 
{

my $randomrare = quest::ChooseRandom(@aRareID);
my $random_result = 0;
my $random_area = 0;
my $random_x = 0;
my $random_y = 0;

if($timer eq "forage") {
$random_result = int(rand(100));
$random_area = int(rand(classified));
$random_x = int(rand(classified));
$random_y = int(rand(classified));

    quest::stoptimer("forage");
if (($random_area >=0) && ($random_area<=60)) {
    if(($random_result>=0) && ($random_result<90)){
    quest::spawn2($forager,classified);
    }elsif(($random_result>=90) && ($random_result<=100)){
    quest::spawn2($randomrare,classified);
    }
    }
elsif (($random_area >60) && ($random_area<=100)) {
    if(($random_result>=0) && ($random_result<90)){
    quest::spawn2($forager,classified);
    }elsif(($random_result>=90) && ($random_result<=100)){
    quest::spawn2($randomrare,classified);
    }
}
}
}

sub EVENT_SIGNAL {

if ($entity_list->GetMobByNpcTypeID($forager)) {
    return 1;
}
foreach $rareID (@aRareID) 
{
    if ($entity_list->GetMobByNpcTypeID($rareID)) {
        return 1;
    }
}
quest::settimer("forage", 1);
}
10%
 


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 06:54 PM.


Everquest is a registered trademark of Daybreak Game Company LLC.
Project 1999 is not associated or affiliated in any way with Daybreak Game Company LLC.
Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.