• 🏆 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!

How to create a loot table for a destructible?

Status
Not open for further replies.
Level 2
Joined
Sep 20, 2015
Messages
13
Hi everyone, :ogre_hurrhurr:

I'm on a kind of survival project and i was wondering if it's possible to create a loot table for a destructible using only the GUI? I explain myself:

I want to create different loot tables which are assigned by a number, and then associate these ones to chests.

Example : I have 11 chests and i want to create 11 loot tables. Each one of them will be associed with a chest and then, each one of these chests will contain different items. :ogre_haosis:

Here it is, thank you in advance for your help. :thumbs_up:
 
simple chest system
  • Chest smart
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Unit-type of (Target unit of issued order)) Equal to Chest
      • ((Target unit of issued order) is in ClosedChests) Equal to True
      • (Issued order) Equal to (Order(smart))
    • Actions
      • Set TempUnit = (Target unit of issued order)
      • Set temploc = (Position of unit)
      • Set temploc2 = (Position of TempUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between temploc and temploc2) Less than or equal to 150.00
        • Then - Actions
          • Animation - Change TempUnit's animation speed to 50.00% of its original speed
          • Custom script: call SetUnitAnimationByIndex( udg_TempUnit , 3 )
          • Custom script: call RemoveLocation(udg_temploc2)
          • Wait 0.05 seconds
          • Set temploc2 = (Position of TempUnit)
          • Animation - Change TempUnit's animation speed to 0.00% of its original speed
          • Unit Group - Remove TempUnit from ClosedChests
          • Set Rndm_Intgr = (Random integer number between 1 and 100)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Rndm_Intgr Less than 50
            • Then - Actions
              • Item - Create Potion of Healing at temploc2
              • Item - Set the custom value of (Last created item) to 10
              • Item - Create Gold Coins 5 at temploc2
              • Item - Create Gold Coins 5 at temploc2
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Rndm_Intgr Greater than 50
                  • Rndm_Intgr Less than 90
                • Then - Actions
                  • Item - Create (Random level 7 Miscellaneous item-type) at temploc2
                  • Item - Set the custom value of (Last created item) to Weapon
                • Else - Actions
        • Else - Actions
      • Custom script: call RemoveLocation(udg_temploc2)
      • Custom script: call RemoveLocation(udg_temploc)
The object can be a destructible or a unit. When clicked it will play it's open animation. You can set the chances to get different items by using random numbers. I used custom values to set additional classes of items. So where you see the word "Weapon" that is actually an integer. I use it in a equipment system to check for a unit using two of the same type of item. So for example a unit cannot have 2 weapons. I have more systems like this if you need them. They are a lot more simple than one's in the spell forum.
 
Level 2
Joined
Sep 20, 2015
Messages
13
FlexFellovic : Thank you but I'm really ill with hachtables :s
I tried to understand those but I.. I just can't xD.

Legal Ease :

Unit - A unit Is issued an order targeting an object --> Does it work on a destructible?

((Target unit of issued order) is in ClosedChests) Equal to True --> Does it refer to a region?

I want to thank you guys because thanks to you I have a better idea about how I can create a loot table, because yesterday I was stuck on this.

You gave me an idea about how to use custom value of an object, this is smart!

So if I understand you trigger, you just have to right click on the chest and it will give you random objects? (if it's x<50 you have Gold coins and a heal pot and if it's 50<x<90 you obtain a lv 7 misc item, and you get nothing if it's x>90 right?)

Because in the game i'm creating a system where you can interact with destructible, units and doodads with a competence (or skill if you prefer) which is named "action".

And there is a chest room where each player can only open 1 chest per game. I created a trigger yesterday but I don't know if i'm doing right. There are 10 players and I did only for two players, but I find my trigger too heavy for two players, so imagine for 10 :eek:. See by yourself ^^ (sorry my GUI is in french, but it's understandable :ogre_haosis:)

  • Activate coffre (chest) 1
    • Evénements
      • Unit - A unit Initie l'effet d'une compétence (uses a competence/skill)
    • Conditions
      • (Ability being cast) Egal à Action
      • (Coffre Blinde 1 <gen> contains (Triggering unit)) Egal à TRUE
    • Actions
      • Set FirstOpener = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • YouCanOpen Egal à TRUE
        • Alors - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • (Unit-type of FirstOpener) Egal à* Prisonnier
              • (Owner of FirstOpener) Egal à* Joueur 1 (Rouge)
            • Alors - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • Si - Conditions
                  • RedChestAlreadyOpened Egal à* FALSE
                  • FirstChestAlreadyOpened Egal à* FALSE
                • Alors - Actions
                  • Trigger - Turn off (This trigger)
                  • Set RedChestAlreadyOpened = TRUE
                  • Set FirstChestAlreadyOpened = TRUE
                  • Destructible - Kill Coffre blindé (the chest) 1029 <gen>
                  • Animation - Play Coffre blindé (the chest) 1029 <gen>'s morph animation
                  • Destructible - Kill Levier spécial 1030 <gen>
                  • Animation - Play Levier spécial <gen>'s morph animation
                • Sinon - Actions
                  • Do nothing
            • Sinon - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • Si - Conditions
                  • (Unit-type of FirstOpener) Egal à* Prisonnier
                  • (Owner of FirstOpener) Egal à* Joueur 2 (Bleu)
                • Alors - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • Si - Conditions
                      • BlueChestAlreadyOpened Egal à* FALSE
                      • FirstChestAlreadyOpened Egal à* FALSE
                    • Alors - Actions
                      • Trigger - Turn off (This trigger)
                      • Set BlueChestAlreadyOpened = TRUE
                      • Set FirstChestAlreadyOpened = TRUE
                      • Destructible - Kill Coffre blindé (the chest) 1029 <gen>
                      • Animation - Play Coffre blindé (the chest) 1029 <gen>'s morph animation
                      • Destructible - Kill Levier spécial 1030 <gen>
                      • Animation - Play Levier spécial 1030 <gen>'s morph animation
                    • Sinon - Actions
                      • Do nothing
                • Sinon - Actions
                  • Do nothing
        • Sinon - Actions
          • Do nothing
Do not mind about the variable "YouCanOpen", because before opening the chests, you have to do something before (a kind of enigma ^^)

"FirstChestAlreadyOpened" refers to the first chest of the room chest, there are a total of 11 chests.
"RedChestAlreadyOpened" and "BlueChestAlreadyOpened" will check if you have already opened a chest before, if it's true, you can't open any chest anymore. If it's false, you can. :thumbs_up:
 
Last edited:
Legal Ease :

Unit - A unit Is issued an order targeting an object --> Does it work on a destructible?

((Target unit of issued order) is in ClosedChests) Equal to True --> Does it refer to a region?

I want to thank you guys because thanks to you I have a better idea about how I can create a loot table, because yesterday I was stuck on this.

You gave me an idea about how to use custom value of an object, this is smart!

So if I understand you trigger, you just have to right click on the chest and it will give you random objects? (if it's x<50 you have Gold coins and a heal pot and if it's 50<x<90 you obtain a lv 7 misc item, and you get nothing if it's x>90 right?)
:

Yes, a destructible is an object but a doodad is not.

Sorry, I didn't explain. ClosedChest is a unit group. I used units as chests. In the initialization trigger I pick all units of type Chest and put them in a group called closed chest. Then when they are opened, I remove them from the group so you can no longer open them and nothing happens when you click on it.

Yes, you understand the rest perfectly. You can also use levels and classes to set random items. For example and random (level 8) (power up) item can be given 10% of the time and a different item 20% of the time and no item 70% of the time.
 
Level 2
Joined
Sep 20, 2015
Messages
13
Ok guys thank you for your help, i really appreciated it :)

PS : And sorry to answer soooo lately, but i'm on exam period so it's complicate :s
 
Status
Not open for further replies.
Top