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

Forsakener's Loot System v.4

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
A random loot dropping system in GUI. Able to have 6 differen't types of loot that you want.
The system is made so that if you kill a creep and their level is higher, then you get more chance on drops, but if the level of the creep is lower you have a less chance. The chances are fully customizable.

Enjoy!


How to add Items to the System!


  • Custom script: call lootint('I001', 1, 3)
Code:
call lootint(Item ID, Region, Level)


Requires Newgen
Uses ItemUserData

Credits to Guardian for the Bag model.



Code:

Code:
library LootLib
    
    //public function
    function lootint takes integer whichitem, integer whichregion, integer whatlevel returns nothing
        call CreateItem(whichitem, GetRectCenterX(udg_LsRegion[whichregion]), GetRectCenterY(udg_LsRegion[whichregion]))
        call SetItemUserData(GetLastCreatedItem(), whatlevel)
    endfunction

endlibrary

The Initialization

  • Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set LsRegion[1] = Common <gen>
      • Set LsRegion[2] = Uncommon <gen>
      • Set LsRegion[3] = Unique <gen>
      • Set LsRegion[4] = Set <gen>
      • Set LsRegion[5] = Rare <gen>
      • Set LsRegion[6] = Epic <gen>
      • -------- Configurables --------
      • -------- The number is the %chance --------
      • Set Chance[1] = 35
      • Set Chance[2] = 10
      • Set Chance[3] = 6
      • Set Chance[4] = 2
      • Set Chance[5] = 0
      • Set Chance[6] = -1
      • Set Bonus = 1.00
      • Set Percent = 100
      • Set HeroPlusLevel = 8
      • Set HeroNegLevel = 5
      • -------- ENDConfigurables --------
      • -------- StartItemCatalog --------
      • -------- Common --------
      • -------- ===== --------
      • Custom script: call lootint('I001', 1, 3)
      • Custom script: call lootint('I002', 1, 3)
      • Custom script: call lootint('I000', 1, 3)
      • Custom script: call lootint('I007', 2, 3)
The System Code

  • System
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set Temp_Point2 = (Position of (Triggering unit))
      • Unit - Create 1 Loot for (Owner of (Killing unit)) at Temp_Point2 facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_Temp_Point2)
      • Unit - Add a 60.00 second Generic expiration timer to (Last created unit)
      • Set Loot[(Player number of (Owner of (Killing unit)))] = (Last created unit)
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set Formula = ((Real(Chance[(Integer A)])) + (Bonus x ((Real((Level of (Triggering unit)))) - (Real((Hero level of (Killing unit)))))))
          • Set Random[(Integer A)] = (Random integer number between 1 and Percent)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Random[(Integer A)] Less than or equal to (Integer(Formula))
            • Then - Actions
              • Hero - Create (Item-type of (Random item in LsRegion[(Integer A)] matching (((Custom value of (Matching item)) Greater than or equal to ((Hero level of (Killing unit)) - HeroNegLevel)) and ((Custom value of (Matching item)) Less than or equal to ((Hero level of (Killing un and give it to Loot[(Player number of (Owner of (Killing unit)))]
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of items carried by Loot[(Player number of (Owner of (Killing unit)))]) Equal to 0
        • Then - Actions
          • Unit - Remove Loot[(Player number of (Owner of (Killing unit)))] from the game
        • Else - Actions

v1
- Uploaded spell to Hive
v2
- cleaned up some leaks
v3
- Optimize the system to run in a loop
- New Preview picture
- Cleaned Leaks in System code where the Loot unit is created

v4
- Optimized using a library to create items easier
[/hidden]

Keywords:
Loot, System, Rpg, Orpg, Items
Contents

Loot System By Forsakener (Map)

Reviews
18:13, 7th Dec 2009 TriggerHappy: Review for Spell I don't get why you are creating items on Init, why can't you just create them when the unit dies? Also please don't use ItemUserData for this, use a hashtable or something...

Moderator

M

Moderator

18:13, 7th Dec 2009
TriggerHappy:


Review for Spell

I don't get why you are creating items on Init, why can't you just
create them when the unit dies? Also please don't use ItemUserData
for this, use a hashtable or something.

Status

Feel free to message me here if you have any issues with
my review or if you have updated your resource and want it reviewed again.

Rejected
 
Level 12
Joined
May 21, 2009
Messages
994
wuhu first comment + download.. anyway post code plz :) gotta test it out..
You could also add trigger tags like this:
  • -------- ===== --------
  • Set Integer = (Integer + 1)
  • Set Item_Type[Integer] = |cffFDC689Scroll of Mana|r
  • Set Temp_Point2 = (Center of Common <gen>)
  • Item - Create Item_Type[Integer] at Temp_Point2
  • Custom script: call RemoveLocation (udg_Temp_Point2)
  • Set Item[Integer] = (Last created item)
  • Item - Set the custom value of Item[Integer] to 3
  • -------- ===== --------
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
Leaks a location:
  • Unit - Create 1 Loot for (Owner of (Killing unit)) at (Position of (Triggering unit)) facing Default building facing degrees
Fix:

  • Set Temp_Loc = Position of (Triggering unit)
  • Unit - Create 1 Loot for (Owner of (Killing unit)) at Temp_Loc facing Default building facing degrees
  • Custom script: call RemoveLocation(udg_Temp_Loc)
 
Level 12
Joined
Nov 20, 2007
Messages
660
What you mean? There are a few ideas that I could add to this system to be able to do more. If you request it I will add it :D

Anyway leak is cleaned and waiting for Approval :D

Well ... i was looking for somethink like that:

Unit Type [1] - Forest Troll
Max_Drops = 2
Drop [1] - Mana Portion
Drop_Chance [1] - 90
Drop [2] - Ranged Bow
Drop_Chance - 50

Unit Type [2] - Grunt
Max Drops = 10
Drop [1] - War Axe
Drop_Chance [2] - 10
..........................


but i've done that system already :wink:
 
Top