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

Treasure Hunter System! v1.1

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Description
This system allows a player to use the ability Dig to search for treasure! To use, click the dig button, and if you're lucky, a random item will be found!




-Implementation instructions included with downloaded map
-Can be configured to multiple terrain types, or simply ANY terrain type if you prefer
-Can be configured to give experience
-Configurable chance to find item
-Increase level of Ability increases chance to find item (if set in Config)
-Helpful messages to the player when digging
-Can be configured to find any random item in WarCraft 3, or user-defined item list



v1.0 - RELEASE
v1.1
-Added Update Log
-Optimized how floating text is displayed to user
-Removed wait
-Removed startup sound
-On the DigAbility Trigger, "UnitBeginsCastingAnAbility" is now "UnitStartsTheEffectsOfAnAbility"




  • Config
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) the text: This map is using M...
      • -------- **Recomended implementation of this trigger: Copy it to your map's initialization trigger, if it is of reasonable length. --------
      • -------- **If not, perhaps use Trigger - Run (Config) on your Init trigger, and remove the 0.01 event from this trigger. --------
      • -------- ------------------------------------ --------
      • -------- The following is the dummy ability used for digging --------
      • Set digsys_DummyAbility = Dig
      • -------- Set the following to true(RECOMENDED) if you want to recieve messages about the findings of your digs. Set to false to disable --------
      • Set digsys_DisplayMessages = True
      • -------- Set the following to true if you want XP to awarded to a hero for a succsessful dig --------
      • Set digsys_XpForDig = True
      • -------- If following is set to true, the Xp Gained from finding an item will be determined by the level of the found item. Also setting this to true will turn XpGained into a multiplier for the level of the item found. --------
      • Set digsys_dynamicXP = False
      • -------- The following is the amount of XP gained for a dig --------
      • Set digsys_XpGained = 5
      • -------- Set the following to true if you want to make a hero ability for your dig. Making it a hero ability will make it gain chance to find item on dig. --------
      • Set digsys_LeveledAbility = True
      • -------- The following is the increase in the chance to find item on dig upon ability level-up --------
      • Set digsys_WinChnceBonusONLevelUp = 1
      • -------- The following is the minimum number X (out of X to Y) that the randomizer uses for a succsesful dig --------
      • Set digsys_MinChance = 1
      • -------- The following is the winning number Z (out of X to Y) that the randomizer uses for a succsesful dig. If you want to be finding treasure 100% of the time, set this to the same value as digsys_MaxChance --------
      • For each (Integer A) from 0 to 11, do (Actions)
        • Loop - Actions
          • Set digsys_WinChance[(Integer A)] = 1
      • -------- The following is the winchance default (leave it set as is for best results) --------
      • Set digsys_WinChanceDefault = digsys_WinChance[0]
      • -------- The following is the max number Y (out of X to Y) that the randomizer uses for a succsesful dig --------
      • Set digsys_MaxChance = 3
      • -------- The following is how long the messages are displayed to the user --------
      • Set digsys_MessageLength = 1.00
      • -------- The following is the message the user sees when he/she finds nothing --------
      • Set digsys_FoundNothingString = Found Nothing
      • -------- The following is the message the user sees when he/she digs on an invalid terrain type --------
      • Set digsys_BadTerrainTypeString = Not a valid Terrain-Type. Dig somewhere else!
      • -------- If you want this to work on any terrain type, set the following true. NOTE: This uses Terrain1's Item types by default or if you have AnyItem= true, then it will just pick a random item from warcraft 3 --------
      • Set digsys_AnyTerrain = False
      • -------- Set the following to desired terrain types. --------
      • -------- If you want more than 6 types, you're going to have to modify the variable in the variables editor, and you may also have to manually reconfigure the whole trigger. --------
      • Set digsys_TerrainType[0] = Lordaeron Summer - Dirt
      • Set digsys_TerrainType[1] = Lordaeron Summer - Rough Dirt
      • Set digsys_TerrainType[2] = Lordaeron Summer - Grassy Dirt
      • Set digsys_TerrainType[3] = Lordaeron Summer - Rock
      • Set digsys_TerrainType[4] = Lordaeron Summer - Grass
      • Set digsys_TerrainType[5] = Lordaeron Summer - Dark Grass
      • -------- UsingThisTileYesorNo --------
      • Set digsys_TerrainIsUsed[0] = True
      • Set digsys_TerrainIsUsed[1] = True
      • Set digsys_TerrainIsUsed[2] = False
      • Set digsys_TerrainIsUsed[3] = False
      • Set digsys_TerrainIsUsed[4] = False
      • Set digsys_TerrainIsUsed[5] = False
      • -------- Automatically finds number of terrains used (Don't Touch!) --------
      • For each (Integer A) from 0 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • digsys_TerrainIsUsed[(Integer A)] Equal to True
            • Then - Actions
              • Set digsys_TerrainTypesUsed = (digsys_TerrainTypesUsed + 1)
            • Else - Actions
      • -------- Set the following to the size of each of your your Item Type Variables. This will save you massive time, trust me. --------
      • Set digsys_RandSize[0] = 10
      • Set digsys_RandSize[1] = 10
      • Set digsys_RandSize[2] = 0
      • Set digsys_RandSize[3] = 0
      • Set digsys_RandSize[4] = 0
      • Set digsys_RandSize[5] = 0
      • -------- If you just want to use any item from warcraft 3, set this to true --------
      • Set digsys_AnyItem = False
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • digsys_AnyItem Equal to False
        • Then - Actions
          • -------- If you want to use Terrain1ItemType[ ] As your global config, set following to true. --------
          • Set digsys_UseTerrain1ItemTypeGlob = False
          • -------- ------------------------------------ --------
          • -------- Item Type Config - If you want more than 10 item types, you're going to have to change it in the variable editor --------
          • -------- Infact, if you plan to use only a few items, please just set it to the number of item types you plan to use. Otherwise, its just wasted space --------
          • -------- ------------------------------------ --------
          • -------- Terrain1Config --------
          • Set digsys_Terrain1ItemType[0] = Claws of Attack +15
          • Set digsys_Terrain1ItemType[1] = Amulet of Recall
          • Set digsys_Terrain1ItemType[2] = Shield of Honor
          • Set digsys_Terrain1ItemType[3] = Staff of Sanctuary
          • Set digsys_Terrain1ItemType[4] = Phat Lewt
          • Set digsys_Terrain1ItemType[5] = Wirt's Leg
          • Set digsys_Terrain1ItemType[6] = Staff of Silence
          • Set digsys_Terrain1ItemType[7] = Keg of Ale
          • Set digsys_Terrain1ItemType[8] = Red Drake Egg
          • Set digsys_Terrain1ItemType[9] = Orb of Fire
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • digsys_UseTerrain1ItemTypeGlob Equal to False
            • Then - Actions
              • -------- Terrain2Config --------
              • Set digsys_Terrain2ItemType[0] = Scroll of Protection
              • Set digsys_Terrain2ItemType[1] = Scroll of Regeneration
              • Set digsys_Terrain2ItemType[2] = Scroll of Speed
              • Set digsys_Terrain2ItemType[3] = Scroll of Town Portal
              • Set digsys_Terrain2ItemType[4] = Spider Silk Broach
              • Set digsys_Terrain2ItemType[5] = Staff of Negation
              • Set digsys_Terrain2ItemType[6] = Staff of Sanctuary
              • Set digsys_Terrain2ItemType[7] = Tiny Castle
              • Set digsys_Terrain2ItemType[8] = Tiny Great Hall
              • Set digsys_Terrain2ItemType[9] = Tome of Retraining
            • Else - Actions
        • Else - Actions
  • DigAbility
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to digsys_DummyAbility
    • Actions
      • -------- WARNING: DO NOT EDIT THIS UNLESS YOU KNOW WHAT YOU'RE DOING -- IT MAY NOT WORK IF YOU MESS SOMETHING UP! --------
      • Set digsys_OnGoodTerrain = False
      • Set digsys_CastingUnit = (Triggering unit)
      • Set digsys_DiggingPlayer = (Triggering player)
      • Set digsys_Point = (Position of digsys_CastingUnit)
      • Set digsys_RAND = (Random integer number between digsys_MinChance and digsys_MaxChance)
      • For each (Integer A) from 0 to (digsys_TerrainTypesUsed - 1), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • digsys_TerrainIsUsed[(Integer A)] Equal to True
              • (Terrain type at digsys_Point) Equal to digsys_TerrainType[(Integer A)]
            • Then - Actions
              • Set digsys_OnGoodTerrain = True
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • digsys_RAND Less than or equal to digsys_WinChance[((Player number of digsys_DiggingPlayer) - 1)]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • digsys_AnyTerrain Equal to True
              • digsys_AnyItem Equal to False
            • Then - Actions
              • -------- If enabled, the system ignores terrain type (uses terrain1's item config) --------
              • Set digsys_RAND = (Random integer number between 0 and (digsys_RandSize[0] - 1))
              • Hero - Create digsys_Terrain1ItemType[digsys_RAND] and give it to digsys_CastingUnit
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • digsys_AnyTerrain Equal to True
                  • digsys_AnyItem Equal to True
                • Then - Actions
                  • -------- If enabled, will create a random item from all of warcraf 3 (ignores terrain type) --------
                  • Hero - Create (Random level -1 item-type) and give it to digsys_CastingUnit
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • digsys_OnGoodTerrain Equal to True
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • digsys_AnyItem Equal to True
                        • Then - Actions
                          • -------- If enabled, will create a random item from all of warcraft 3 (cares about terrain type) --------
                          • Hero - Create (Random level -1 item-type) and give it to digsys_CastingUnit
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • digsys_UseTerrain1ItemTypeGlob Equal to True
                            • Then - Actions
                              • -------- Use Terrain 1's Items as Global Configuration --------
                              • Set digsys_RAND = (Random integer number between 0 and (digsys_RandSize[0] - 1))
                              • Hero - Create digsys_Terrain1ItemType[digsys_RAND] and give it to digsys_CastingUnit
                            • Else - Actions
                              • -------- Individual Terrain Individual Item Configuration - Loops through each on, checking if its used --------
                              • For each (Integer A) from 0 to (digsys_TerrainTypesUsed - 1), do (Actions)
                                • Loop - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • digsys_TerrainIsUsed[(Integer A)] Equal to True
                                      • (Terrain type at digsys_Point) Equal to digsys_TerrainType[(Integer A)]
                                    • Then - Actions
                                      • Set digsys_RAND = (Random integer number between 0 and (digsys_RandSize[(Integer A)] - 1))
                                      • -------- The following branched if/else statements create the item accourding to terrain type --------
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Integer A) Equal to 0
                                        • Then - Actions
                                          • Hero - Create digsys_Terrain1ItemType[digsys_RAND] and give it to digsys_CastingUnit
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Integer A) Equal to 1
                                            • Then - Actions
                                              • Hero - Create digsys_Terrain2ItemType[digsys_RAND] and give it to digsys_CastingUnit
                                            • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • (Integer A) Equal to 2
                                                • Then - Actions
                                                  • Hero - Create digsys_Terrain3ItemType[digsys_RAND] and give it to digsys_CastingUnit
                                                • Else - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • (Integer A) Equal to 3
                                                    • Then - Actions
                                                      • Hero - Create digsys_Terrain4ItemType[digsys_RAND] and give it to digsys_CastingUnit
                                                    • Else - Actions
                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                        • If - Conditions
                                                          • (Integer A) Equal to 4
                                                        • Then - Actions
                                                          • Hero - Create digsys_Terrain5ItemType[digsys_RAND] and give it to digsys_CastingUnit
                                                        • Else - Actions
                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                            • If - Conditions
                                                              • (Integer A) Equal to 5
                                                            • Then - Actions
                                                              • Hero - Create digsys_Terrain6ItemType[digsys_RAND] and give it to digsys_CastingUnit
                                                            • Else - Actions
                                    • Else - Actions
                    • Else - Actions
                      • -------- Sets message bad terrain type --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • digsys_DisplayMessages Equal to True
                        • Then - Actions
                          • Set digsys_TMPSTRING = digsys_BadTerrainTypeString
                        • Else - Actions
          • Set digsys_CreatedItem = (Last created item)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • digsys_OnGoodTerrain Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • digsys_DisplayMessages Equal to True
                • Then - Actions
                  • Set digsys_TMPSTRING = (Found: + (Name of digsys_CreatedItem))
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • digsys_OnGoodTerrain Equal to True
              • digsys_XpForDig Equal to True
            • Then - Actions
              • -------- Give Xp on item Find (if enabled) --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • digsys_dynamicXP Equal to False
                • Then - Actions
                  • Set digsys_TMPXP = digsys_XpGained
                • Else - Actions
                  • Set digsys_TMPXP = (digsys_XpGained x (Item level of digsys_CreatedItem))
              • Hero - Add digsys_TMPXP experience to digsys_CastingUnit, Show level-up graphics
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • digsys_DisplayMessages Equal to True
                • Then - Actions
                  • Floating Text - Create floating text that reads (+|cff995500 + ((String(digsys_TMPXP)) + |r experience)) at digsys_Point with Z offset -50.00, using font size 7.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the fading age of (Last created floating text) to digsys_MessageLength seconds
                  • Floating Text - Change the lifespan of (Last created floating text) to (digsys_MessageLength + 1.00) seconds
                • Else - Actions
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • digsys_OnGoodTerrain Equal to True
            • Then - Actions
              • -------- Sets Message Nothing Found --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • digsys_DisplayMessages Equal to True
                • Then - Actions
                  • Set digsys_TMPSTRING = digsys_FoundNothingString
                • Else - Actions
            • Else - Actions
              • -------- Sets message bad terrain type --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • digsys_DisplayMessages Equal to True
                • Then - Actions
                  • Set digsys_TMPSTRING = digsys_BadTerrainTypeString
                • Else - Actions
      • -------- Prints Message --------
      • Floating Text - Create floating text that reads digsys_TMPSTRING at digsys_Point with Z offset 0.00, using font size 7.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the fading age of (Last created floating text) to digsys_MessageLength seconds
      • Floating Text - Change the lifespan of (Last created floating text) to (digsys_MessageLength + 1.00) seconds
      • -------- Cleanup Leaks --------
      • Custom script: call RemoveLocation (udg_digsys_Point)
  • LevelDigAbility
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • digsys_LeveledAbility Equal to True
    • Actions
      • -------- This increases the chance to find an item of dig after leveling the ability - if set in the Config --------
      • Set digsys_WinChance[((Player number of (Triggering player)) - 1)] = (digsys_WinChanceDefault + (((Level of digsys_DummyAbility for (Triggering unit)) - 1) x digsys_WinChnceBonusONLevelUp))



Keywords:
treasure, dig system, find items, hunting, spell
Contents

Treasure Hunt System (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 23:23, 7th Feb 2014 BPower: This will be an awesome resource, but for now the code is not good enough...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

23:23, 7th Feb 2014
BPower:
This will be an awesome resource, but for now the code is not good enough.
http://www.hiveworkshop.com/forums/spells-569/treasure-hunter-system-v1-1-a-247264/#post2483488
 
Do not use Integer A/B/C/D/E =.=!...do not use Wait.
  • Set digsys_CastingUnit = (Casting unit)
=>
  • Set digsys_CastingUnit = Set digsys_CastingUnit = (Triggering unit)
  • Set digsys_DiggingPlayer = (Owner of (Casting unit))
=>
  • Set digsys_DiggingPlayer = (Triggering player)
  • Set digsys_WinChance[((Player number of (Triggering player)) - 1)] = (digsys_WinChanceDefault + (((Level of digsys_DummyAbility for (Learning Hero)) - 1) x digsys_WinChnceBonusONLevelUp))
=>
  • Set digsys_WinChance[((Player number of (Triggering player)) - 1)] = (digsys_WinChanceDefault + (((Level of digsys_DummyAbility for (Triggering unit)) - 1) x digsys_WinChnceBonusONLevelUp))
You using random number to digging an item, i think it's not a good idea to do it.

Your floating text on the trigger: DigAbility can be optimize like this:

Example:

  • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • digsys_OnGoodTerrain Equal to True
      • Then - Actions
        • -------- Prints Nothing Found --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • digsys_DisplayMessages Equal to True
          • Then - Actions
            • Set SomeText = digsys_FoundNothingString
            • Floating Text - Create floating text that reads digsys_FoundNothingString at digsys_Point with Z offset 0.00, using font size 7.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
            • Floating Text - Change (Last created floating text): Disable permanence
            • Floating Text - Change the fading age of (Last created floating text) to digsys_MessageLength seconds
            • Floating Text - Change the lifespan of (Last created floating text) to (digsys_MessageLength + 1.00) seconds
          • Else - Actions
      • Else - Actions
        • -------- Prints bad terrain type --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • digsys_DisplayMessages Equal to True
          • Then - Actions
            • Floating Text - Create floating text that reads digsys_BadTerrainTypeString at digsys_Point with Z offset 0.00, using font size 7.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
            • Floating Text - Change (Last created floating text): Disable permanence
            • Floating Text - Change the fading age of (Last created floating text) to digsys_MessageLength seconds
            • Floating Text - Change the lifespan of (Last created floating text) to (digsys_MessageLength + 1.00) seconds
          • Else - Actions
=>
  • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • digsys_OnGoodTerrain Equal to True
      • Then - Actions
        • -------- Prints Nothing Found --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • digsys_DisplayMessages Equal to True
          • Then - Actions
            • Set SomeText = digsys_FoundNothingString
          • Else - Actions
      • Else - Actions
        • -------- Prints bad terrain type --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • digsys_DisplayMessages Equal to True
          • Then - Actions
            • Set SomeText = digsys_BadTerrainTypeString
          • Else - Actions
    • Floating Text - Create floating text that reads SomeText at digsys_Point with Z offset 0.00, using font size 7.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
    • Floating Text - Change (Last created floating text): Disable permanence
    • Floating Text - Change the fading age of (Last created floating text) to digsys_MessageLength seconds
    • Floating Text - Change the lifespan of (Last created floating text) to (digsys_MessageLength + 1.00) seconds
 
Last edited:
Level 4
Joined
Jan 13, 2014
Messages
9
@nhocklanhox6
a)No I'm not missing the import instruction; did you dl the map? Its in the map in a comment trigger.
b) Why can't I use integer A?
c) Why Set digsys_CastingUnit=digsysCastingUnit=triggeringunit? Why not just suggest digsys_CastingUnit=triggeringunit?
d) Why shouldn't I use a random number? Thats the whole point of this system
e) Good point, I should optimize the code for floating text

@Chaosy
1) Why? Some triggers don't even work at map init I have read
2) What is the advantage to starts effect event. I've had experience with some abilities where that func didn't work, but starts casting ability always works
3) Why? The comments tell the user important information. If you dislike the comments so much you are more than welcome to remove them yourself if/when you plan to implement my system
 
Level 10
Joined
Aug 21, 2010
Messages
316
Try this

JASS:
function CreateText takes unit u, string s, real size, real offset, real speed, real angle, integer red, integer blu, integer gre, integer trans, real life, real fade, boolean show, boolean permanent, boolean suspend returns texttag
    local texttag tt = CreateTextTag()
    local real vel=(speed*.071)/128
    local real xvel=vel*Cos( angle * bj_DEGTORAD )
    local real yvel=vel*Sin( angle * bj_DEGTORAD )

    call SetTextTagText(tt,s,(size*0.023)/10)
    call SetTextTagPos(tt,GetUnitX(u),GetUnitY(u),offset)
    call SetTextTagColor(tt,red,blu,gre,255-trans)
    call SetTextTagVisibility(tt,show)
    call SetTextTagPermanent(tt,permanent)
    call SetTextTagSuspended(tt,suspend)
    call SetTextTagVelocity(tt,xvel,yvel)
    if permanent!=true then
        call SetTextTagLifespan(tt,life)
        call SetTextTagFadepoint(tt,fade)
    endif
    return tt
endfunction
 
Level 4
Joined
Jan 13, 2014
Messages
9
@Megamax.

a: Oh sorry ^^
b: Because it's unsafe and slower than integer variables
c: It's a good habit :)
d: For example, at that point, you digging an items but you found nothing, and you continue to dig and "surprise", you have digged an items, so it strange, doesn't it?

@nhocklanhox6
b: I can understand maybe slow but why unsafe? Its only unsafe if youre using two (for loop int(a))s at same time
c: You said:
Do not use Integer
  • Set digsys_CastingUnit = (Casting unit)
=>
  • Set digsys_CastingUnit = Set digsys_CastingUnit = (Triggering unit)

Now I ask again, why is it a good habbit to set digsys_CastingUnit = digsys_CastingUnit? I get sortof where you're coming from with (Triggering Unit) but not self assignment.

d: well it could be possible to make a system where the items are stored at loc(x,y) then if you are within say 100 of loc(x,y) then you have found item.
My dig system is more meant for lets say idk you you have terrain A: Sand. Now you dig in Terrain A. You have a 1/4 chance to dig up something besides just sand. And you may ask why would you find something different next time? Here's why, with each dig its only 1 shovel full of sand. So, it could be viewed as you're digging deeper and deeper into the Earth. Of course I should probably add terrain deformation then, but there's no reason you cannot easily do that yourself. System's are meant to modded afteral.

@zv27
Are you suggesting I make a function for floating text, then call that function when I want to create floating text, rather than putting it at the end of my trigger?
 
I apologise if anybody else has pointed any of these things out before, just been reading the code and skimming over comments

Remove that game message in the intialisation trigger - it belongs in map specific triggers, not the system triggers itself.

You could also scrap a lot of those IF blocks if you put it into a loop, running the condition each time (Given how GUI handles IF blocks anyway, even if it runs the code a few more times, it'd still be roughly the same efficiency and just a lot more readable, you could also use custom script lines to put in your own loop/exitwhen lines if you wanted to make it particularly efficient) This applies specifically to the IF blocks after this line:
  • -------- The following branched if/else statements create the item accourding to terrain type --------
The floating text at the end is displayed even if messages are disabled
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
Take care of everything the Tank-Comamander said. Also don't use IntegerA.

Refreshing concept, I've created a few item drop systems by myself but in jass (thank god) :)
ItemDrop systems of any kind are fascinating tools. You should consider that items could have different drop chances. First of all you have an absolute drop chance for an item drop i.e 15%.
Then you access the drop pool, where items have a relative chance towards each other.
(uniques, magical, trash, ... shouldn't have the same drop chance value).
Even if they all have the same drop chance it should be configurable (i.e drop weight of 1)
It's not critical for approval, but the system will get a far better rating assumed the code is fine.
 
Top