Snippet Item Drops

S

SrH-Kush420

Guest
This is Pretty Simple But For Thos Of You Who Dont Know How To Do It Heres mine. Item Drops Are when You Kill a Unit and You Get Like #/# chance To Get That Item.


Step 1: Creating the variable

Name - DropNumber
Type - Integer Array

Step 2: Setting up the trigger
Usually the event for item drops is

Code:
.

Events
    Unit - A unit Dies
.
Now we must set up the variables and part of the conditions.
Code:
Iron Sword
    Events
        Unit - A unit Dies
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Dying unit)) Equal to Furblog Mini
                (Owner of (Dying unit)) Equal to Neutral Hostile
            Then - Actions
                Set DropNumber = (Random integer number between 1 and 10)
                
 
            Else - Actions
There we just setup the unit type of dying unit and the variables for the drop.

Step 3: Setting up the actions
Here we will check if the DropNumber Variable is = to the Number we Set it up as "(DropNumber = (Random integer number between 1 and 10)"
If it is then the item will drop if not then nothing happens.

Code:
Then - Actions
    Set DropNumber = (Random integer number between 1 and 10)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            DropNumber Equal to 1
        Then - Actions
            Item - Create Iron Sword at (Position of (Dying unit))
        Else - Actions

Heres the final trigger:
Code:
Iron Sword
    Events
        Unit - A unit Dies
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Dying unit)) Equal to Furblog Mini
                (Owner of (Dying unit)) Equal to Neutral Hostile
            Then - Actions
                Set DropNumber = (Random integer number between 1 and 10)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        DropNumber Equal to 1
                    Then - Actions
                        Item - Create Iron Sword at (Position of (Dying unit))
                    Else - Actions
            Else - Actions
 

Attachments

  • Item Drop Demo.w3x
    22.1 KB · Views: 215

Exide

I am amazingly focused right now!
Reaction score
448
You forgot to clean up the point leak;

Code:
Custom script call RemoveLocation(udg_TempPoint)

You don't need to capitalize every letter in every single word: 'Like This, This Is Really Annoying To Read.'

You don't really need the DropNumber variable.

Other than that, short and simple Tutorial. I like it. :p
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
In the other word...it is too short to form a tutorial..

+ Item drop do not need to be trigger...
It can be set at object editor...
 

Exide

I am amazingly focused right now!
Reaction score
448
>It can be set at object editor...
Oh, right. I knew I had forgotten something. :p
 
S

SrH-Kush420

Guest
Item Drops in Object editor only drop once dont they.
 

Sim

Forum Administrator
Staff member
Reaction score
534
Item Drops in Object editor only drop once dont they.

Exactly.

This would be a system, not a tutorial. Reformulate it, explain better, get rid of the capitalized letters, and give us some kind of a "final" product in form of a trigger.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top