Item Drops

PurgeandFire

zxcvmkgdfg
Reaction score
508
I think you can do it with triggers or double-click a unit and give a % chance to drop an item... :)
 
Z

Zell

Guest
Random items as in loot from kills? Or just random items placed randomly on the map?
 
Z

Zell

Guest
Item Tables can cause a unit to drop more than one item. You just need multiple sets, each with 100% chance (I think, never really used Item Tables). If you are going to have units spawned via triggers, there's a better (and actually doable, Item Tables only work on pre-sets) way. Just detect a unit dying, and If it is a Wolf, roll a random number between 1 and 100. If it's like 10 and less, drop gold, etc.
 
T

Thekal

Guest
hmm ....how to roll random number....where is that in scripts ?
 

Tinki3

Special Member
Reaction score
418
>hmm ....how to roll random number....where is that in scripts ?

You would have to use integer comparisons:

Code:
    Actions
        Set Temp_Int = (Random integer number between 1 and 20)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Temp_Int Less than or equal to 10
            Then - Actions
                 //Do further actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Temp_Int Greater than 10
                    Then - Actions
                         //Do further actions
                    Else - Actions
Those conditions would isolate the stored number in the variable, giving both a 50% chance to be true.

You don't need to use a variable to refer to the number though, that can easily be done without, but, I use one because it makes things a little easier to read.

Here's an example of a random number isolation, that doesn't use an integer variable:

Code:
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Random integer number between 1 and 20) Less than or equal to 10
            Then - Actions
                 //Do further actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Random integer number between 1 and 20) Greater than 10
                    Then - Actions
                         //Do further actions
                    Else - Actions
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top