• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Item drop problem

Status
Not open for further replies.
Level 6
Joined
Dec 6, 2009
Messages
168
Hi guys! it is me again. I found a new trigger problem that I don't know how to face in an easy way.

I got Centaurs on my map, they got 1% chance to drop items. And when they die it respawns new one. but the new one doesn't have a 1% chance of dropping an item, so there is one way that ´can work but not all to sure.
and that is if you do a condition that makes a random number between 1 and 100 ever time a unit dies. and if for example it becomes nr 15 then an item drop. tho this doesn't work properly so plz help me to get a easy way to do this.:goblin_yeah:

Sry for spell writing... I wrote frop insted of drop:)
 
  • Tr
  • Events
    • Unit - A unit dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Centaur //Unit-type Comparison
    • (Triggering player) Equal to Neutral Hostile //Player comparison
    • (Random integer number between 1 and 100) Equal to 1
  • Actions
    • Set Point1 = (Position of (Triggering unit))
    • Item - Create 1 Item at Point1
    • Custom script: call RemoveLocation (udg_Point1)
1% chance is extremely low, I'd use this chance instead:
  • (Random integer number from 1 to 100) Less than or Equal to 10
Which is a 10% chance to spawn the item.
 
Level 6
Joined
Dec 6, 2009
Messages
168
hmm, I found another problem...

this is my trigger:

  • Fruit Drop
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Triggering player) Equal to Neutral Hostile
      • (Random integer number between 1 and 100) Less than or equal to 100
    • Actions
      • Set Frui_drop_place = (Position of (Triggering unit))
      • Set Random_Number = (Random integer number between 1 and 9)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_Number Equal to 1
        • Then - Actions
          • Trigger - Turn on Copy fruit <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_Number Equal to 2
        • Then - Actions
          • Trigger - Turn on Fire fruit drop <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_Number Equal to 3
        • Then - Actions
          • Trigger - Turn on Gold fruit drop <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_Number Equal to 4
        • Then - Actions
          • Trigger - Turn on ice fruit <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_Number Equal to 5
        • Then - Actions
          • Trigger - Turn on invisibillity fruit <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_Number Equal to 6
        • Then - Actions
          • Trigger - Turn on leader of the dead fruit <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_Number Equal to 7
        • Then - Actions
          • Trigger - Turn on Raw power fruit <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_Number Equal to 8
        • Then - Actions
          • Trigger - Turn on shadow step fruit <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_Number Equal to 9
        • Then - Actions
          • Trigger - Turn on vampire fruit <gen>
        • Else - Actions
This is the main trigger. then the other triggers all look like this but with different items:

  • Copy fruit
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_Number Equal to 1
        • Then - Actions
          • Item - Create Copy Cat Fruit at Frui_drop_place
        • Else - Actions
      • Trigger - Turn off (This trigger)
this works fine, it is 100% of item drop. tho I don't want the same item of theese to drop more than one time each. so if the integer number becomes 1 then I want it to drop the copy fruit item, but is shall not be able to drop it again and whould like to make the integer number not be able to be 1 again.
Cause if the integer number can be one the drop chance becomes much lower.
:ogre_datass:
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
instead of turn on, try RUN TRIGGER...and remove the 0.01 periodical time...

or better...

  • Set Frui_drop_place = (Position of (Triggering unit))
  • Set Random_Number = (Random integer number between 1 and 9)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • Random_Number Equal to 1
    • Item - Create Copy Cat Fruit at Frui_drop_place
 
You shouldn't use seperate and periodic triggers for each item, it's totally redundant. What is more, [(Random integer number between 1 and 100) Less than or equal to 100] is 100% chance. You can remove that from the conditions, it will still perform the specified actions without it.
Example:
  • Fruit Drop
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Triggering player) Equal to Neutral Hostile
    • (Random integer number between 1 and 100) Less than or equal to 100
  • Actions
    • Set Frui_drop_place = (Position of (Triggering unit))
    • Set Random_Number = (Random integer number between 1 and 9)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Random_Number Equal to 1
      • Then - Actions
        • Item - Create Copy Cat Fruit at Frui_drop_place
      • Else - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • Random_Number Equal to 2
          • Then - Actions
            • Item - Create Fire Fruit at Frui_drop_place
          • Else - Actions
    • Custom script: call RemoveLocation (udg_Frui_drop_place)
 
Then set a list of booleans. Create a boolean variable, called "Dropped" with Array ticked. Then do this:
  • Fruit Drop
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Triggering player) Equal to Neutral Hostile
    • (Random integer number between 1 and 100) Less than or equal to 100
  • Actions
    • Set Frui_drop_place = (Position of (Triggering unit))
    • Set Random_Number = (Random integer number between 1 and 9)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Dropped[1] Equal False
        • Random_Number Equal to 1
      • Then - Actions
        • Set Dropped[1] = True
        • Item - Create Copy Cat Fruit at Frui_drop_place
      • Else - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • Dropped[2] Equal to False
            • Random_Number Equal to 2
          • Then - Actions
            • Set Dropped[2] = True
            • Item - Create Fire Fruit at Frui_drop_place
          • Else - Actions
    • Custom script: call RemoveLocation (udg_Frui_drop_place)
This will prevent items from being dropped again.
 
Level 6
Joined
Dec 6, 2009
Messages
168
thx, tho if a item is dropped once it will reduce the chace of item drop. cause the random ineger number will stillbe between 1 and 9. so if I got like I realy want 3% chance of dropping then is will be even less if 3 items already have been dropped.
And I hope you might know how to fix that to, between the other thing worked:D thx!
 
Item pools are native functions...

my ItemDropSystem can support this, but you should be using NewGenWE and could at least follow instructions...

the basic idea is to index every item drop, and then recycle that index once that item is dropped, so it won't be dropped again...

If you do it yourself, you would need, knowledge on recycling indexes...
 
Status
Not open for further replies.
Top