SphereCommunity
Probability - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Probability (/Thread-Probability)



Probability - larmc20 - 12-22-2013 08:02 AM

Hello Guys.

I'd like to know how to add a probability for an iten to appear on a loot.

For Example:

I've got Balron Loot

PHP Code:
[TEMPLATE loot_BALRON]
CATEGORY=Item Templates
SUBSECTION
=Monster Loot Templates
DESCRIPTION
=Balron
CONTAINER
=i_backpack
ITEM
=random_potion,{ 2 3 }
ITEM=random_potion,{ 2 3 }
ITEM=ttm_lvl5,R99
ITEM
=random_scroll,{ 2 3 }
ITEM=random_reagent,{ 4 6 }
ITEM=random_reagent,{ 4 6 }
ITEM=random_magic_wands
ITEM
=random_magic_wands
ITEM
=i_scroll_blank,{ 1 2 }
ITEM=random_magic_sword
ITEM
=i_gold,{800 1200

If I want to add an iten with 10% of chance to appear I know it making an spawn with 9 normal balrons and 1 with the iten. So in the game I make a respawn with this spawn spanwing one balron at time...

Is there a Easier way to do that working on the loot script?


RE: Probability - Crusader - 12-22-2013 08:35 AM

ITEM=id_of_the_item,R90 // as far as i know should mean that 10% of time it will drop id_of_the_item


RE: Probability - amonvangrell - 12-22-2013 08:43 AM

You should read the tutorial it has what you are asking well explained.
http://wiki.sphere.torfo.org/index.php/Chapter_1

Code:
There are two types of random selectors: weighted random and ranged random. Weighted random makes a statement like this: "Ok, 1 out of 10 times pick Number A, 3 out of 10 times pick Number B, and 6 out of 10 times pick number C". Ranged random makes a statement like this: "Pick any number between the two numbers I give you".

then
Code:
{ random_food 1 0 3} - This tells SPHERE, "Ok, 1 out of four times, I want you to pick random_food, and 3 out of four times, I want you to pick zero." You can even have random sets within random sets.

or
Code:
ITEM=i_sword_long,R11 - R11 means "one out of 11 chance of finding this item

better read the tutorial.

cya


RE: Probability - larmc20 - 12-23-2013 01:12 AM

Thank so much