Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 04-12-2008, 04:58 PM
fault
Hill Giant
 
Join Date: Sep 2005
Posts: 114
Default Random with percentages

I am looking for randoms with percentages. IE you turn in an item to an npc and he randomly gives you items where som elesser items are a greator chance then major items.


Source quest I am trying to write up: http://everquest.allakhazam.com/db/quest.html?quest=604

He randomly gives you 3 items, one is very common, the second is medium-rare the 3rd is a rareity.
Reply With Quote
  #2  
Old 04-12-2008, 06:06 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

To change rarity, just add in multiples of the more common ones. So, if you want the chances to be 60% for common, 30% for uncommon and 10% for rare, just do:

(item1, item1, item1, item1, item1, item1, item2, item2, item2, item3)

Should be simple enough to do any percentage of chance you want.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 04-12-2008, 08:40 PM
fault
Hill Giant
 
Join Date: Sep 2005
Posts: 114
Default

Quote:
Originally Posted by trevius View Post
To change rarity, just add in multiples of the more common ones. So, if you want the chances to be 60% for common, 30% for uncommon and 10% for rare, just do:

(item1, item1, item1, item1, item1, item1, item2, item2, item2, item3)

Should be simple enough to do any percentage of chance you want.

So there is no True percentage/randomizing currently for quests?

Something like.

Code:
$san =  math.random(1,100);
if ($san < 60) then
 quest::summonitem(common item);
else if (($san > 60) and ($san < 90)) then
 quest::summonitem(medium rare item);
else if ($san > 90) then
 quest::summonitem(rare item);

use some lua expressions there I really wouldn't know how perl would define math.random, but it gives you the exact idea.

Does perl allow Us to add functions for quests on the fly? To much lua in my head lua was easy to add function to.
Reply With Quote
  #4  
Old 04-12-2008, 09:59 PM
ChaosSlayer
Demi-God
 
Join Date: May 2007
Posts: 1,032
Default

you can do a random % in the way you decribed.

this is a sample of my own quest code:

Code:
	$deal=int(rand(100)+1);

		if ($deal<76)
		{
		quest::summonitem(5001);
		}

		if (($deal>75) && ($deal<88))
		{
		quest::summonitem(5002);
		}


		if (($deal>87) && ($deal<95))
		{
		quest::summonitem(5003);
		}


		if (($deal>94) && ($deal<98))
		{
		quest::summonitem(5004);
		}

		if (($deal>97) && ($deal<100))
		{
		quest::summonitem(5005);
		}


		if ($deal==100)
		{
		quest::summonitem(5006);
		}
Reply With Quote
Reply


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 08:07 PM.


 

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