• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Question about % chance to get items

Status
Not open for further replies.
Level 6
Joined
Oct 26, 2005
Messages
190
I have a doubt regarding percentage chance to get items. I was wondering if I have for example 3 items, each with a chance to be obtained, should have a certain "hierarchy" or order so it works properly. If you don't understand what I mean I'll post a trigger example:

  • Chance to get items
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random percentage) Less than or equal to 10.00
        • Then - Actions
          • Hero - Create Item A and give it to Hero
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random percentage) Less than or equal to 35.00
            • Then - Actions
              • Hero - Create Item B and give it to Hero
            • Else - Actions
              • Hero - Create Item C and give it to Hero
So that's how I do my % to get items: from the lowest to highest chance. Is this a good and reliable way? Does the order matter?
 
Level 22
Joined
Feb 4, 2005
Messages
3,971
I think you should make the ranges more clearly

By choosing =< 35 that also covers from 0 to 35 while your first and second also cover that range. say from 0 to 10 they overlap as this range for both. It should be either =<10 for the first, =<35 and >10 for the second condition /less than 35 greater than 10/. This would create the 2 items if your % gets from 1 to 10 as it meets both conditions
 
Level 22
Joined
Jan 10, 2005
Messages
3,426
Why don't you use Item Tables (Advanced)?

I think you should make the ranges more clearly

By choosing =< 35 that also covers from 0 to 35 while your first and second also cover that range. say from 0 to 10 they overlap as this range for both. It's either from 1-10 from 11-35

No, no. Look at the ''If, Then, Else'' actions. The 35% is from the 90% that is left from the first ''If, Then, Else'' action.

Now you've got a 10% change to get item A, 31.5% chance to get item B, and 58.5% chance to get item C.
 
Last edited:
Level 6
Joined
Oct 26, 2005
Messages
190
I never used item tables but as far as I know they're used to assign them when killing creeps right? That's not the use want, It's kind of a spell which has chance to create certain items.

Now you say my second item has 21.5% chance, why exactly? The whole percentage you said sums up to 60% but I want it to be 100% ... a little more clarification please?
 
Level 22
Joined
Jan 10, 2005
Messages
3,426
Well, the first item has a 10% chance to drop.

If - (Random percentage) Less than or equal to 10.00
Then - Give Item A
Else - Here you set a new ''If, Then Else''. So if the random number is between 11-100, it will pick this action.

Item B has a 35% chance to drop, of the 90% it's got left from the first ''If, Then, Else'' action. So, 0.90 * 35 = 31.5 (made a typo in my last post).

Item C: 100 - 10 - 31.5 = 58.5% chance to drop.
 
Last edited:
Level 22
Joined
Jan 10, 2005
Messages
3,426
This, for example:

  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 100) Less than or equal to 30
      • Then - Actions
        • Hero - Create Item A and give it to Hero
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Random integer number between 1 and 100) Less than or equal to 50
          • Then - Actions
            • Hero - Create Item B and give it to Hero
          • Else - Actions
            • Hero - Create Item C and give it to Hero
Now both item B and C have a 35% chance to drop.

If you set the first integer condition to 33 instead of 30, all 3 items have 1/3 chance to drop.
 
Level 6
Joined
Oct 26, 2005
Messages
190
I got lost again :S What difference does it make the 'Less than' removed? And 1% of what? I don't want to predict the chance, I want the item to be exactly 35% chance to be obtained.

Sorry for making such trouble u.u

EDIT:

I suppose the problem you mentioned comes with the (Random percentage) so your suggestion makes it 30, 50 and 20% chance respectively, right?
 
Level 22
Joined
Jan 10, 2005
Messages
3,426
I got lost again :S What difference does it make the 'Less than' removed? And 1% of what? I don't want to predict the chance, I want the item to be exactly 35% chance to be obtained.

Sorry for making such trouble u.u

EDIT:

I suppose the problem you mentioned comes with the (Random percentage) so your suggestion makes it 30, 50 and 20% chance respectively, right?

With that trigger, it's 30%, 35%, and 35%. You take the 50% of the 70% that's left from the first action. Do you see what I mean?

So, 50% of 70 is 35 for item B and C.

It's not 100 - 30 - 50. It's 100 - 30 - (0.5*70).
 
Level 18
Joined
Mar 7, 2005
Messages
824
Just don't put the itemdrop stuff in other if-then-else cases.. When you're putting your if-then-else into another if-then-else then the chances are influenced by the other if-then-else order.. so put them next to each other in a row, not within each other..

  • action:
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 100) Less than or equal to 30
        • Then - Actions
          • Hero - Create Item A and give it to Hero
        • Else - Actions
          • Do Nothing
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 100) Less than or equal to 50
      • Then - Actions
        • Hero - Create Item B and give it to Hero
        • Else - Actions
          • Do Nothing
This way all items have real % chances to drop. With real I mean from 100, so when you enter a number of 50 then u'll have a drop chance of 50%,
and not 31,5% or whatever, due to complex if-then-else orders.. For a smaller chance than 1% you have to use such boxed if-then-else orders..
like 1% from the first and 50% from the next, and you'll have 0,5% item drop chance.

Oh, but you have to use the above mentioned drop methods for items that should only be dropped when a certain other item should not get dropped.
Like: Item A get's dropped, so don't drop Item B or C, and the other way round.. while Item A was not dropped, Item B or C have a chance to get dropped.
 
Level 6
Joined
Oct 26, 2005
Messages
190
I get it now. Thanks a lot, I'm good to go :D

EDIT:

Just don't put the itemdrop stuff in other if-then-else cases.. When you're putting your if-then-else into another if-then-else then the chances are influenced by the other if-then-else order.. so put them next to each other in a row, not within each other..

action:
  • Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Random integer number between 1 and 100) Less than or equal to 30
  • Then - Actions
  • Hero - Create Item A and give it to Hero
  • Else - Actions
  • Do Nothing
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Random integer number between 1 and 100) Less than or equal to 50
  • Then - Actions
  • Hero - Create Item B and give it to Hero
  • Else - Actions
  • Do Nothing
This way all items have real % chances to drop. With real I mean from 100, so when you enter a number of 50 then u'll have a drop chance of 50%,
and not 31,5% or whatever, due to complex if-then-else orders.. For a smaller chance than 1% you have to use such boxed if-then-else orders..
like 1% from the first and 50% from the next, and you'll have 0,5% item drop chance.

I'm not making an item-drop system. And that way, both chances may trigger at the same time (unless I add Skip Remaining Actions for each 'Then'), but Ramza already explained what I need already, thanks for the help though
 
Status
Not open for further replies.
Top