Bounty System

farold

New Member
Reaction score
3
I have never seen something like that nor in Hive or TheHelper and Wc3campaigns isn't working for me. So, I request a bounty system which give gold to player depending on how much they damaged the unit let say... A soldier gives 40-48 gold. A player damaged him for 50% of his life, another damaged him for 20% and creeps damaged him for 30%. So, the first player will get 50% of 43 (random number rolled betwenn min. and max. bounty) the second 20% of it while the A.I team (that own the creeps) will get 30%.
I also want to improves that with abilities/items that can increases bounty as well creeps don't give bounty if denied (Killed by enemies)
 

mapguy

New Member
Reaction score
46
When a unit takes damage you store that damage in a real that is attached to that unit.
each unit has to have 6 reals attached (1 for each player (6 players))
when the unit dies you split gold based on:
(gold) / (damage dealed by unit / total damage dealed to unit)
also create a trigger that reduces this reals values by 10% every 1.00 second.

unit takes damage

IF owner of damage source equal to player 1
set realdamage1[custom value of triggering unit] = damage taken + realdamage1[custom value of triggering unit]
IF owner of damage source euqla to player 2
set realdamage2[custom value of triggering unit] = damage taken + realdamage2[custom value of triggering unit]
and so on
important, each unit in your map have to have an unique custom value that never changes.
 

Ayanami

칼리
Reaction score
288
When a unit takes damage you store that damage in a real that is attached to that unit.
each unit has to have 6 reals attached (1 for each player (6 players))
when the unit dies you split gold based on:
(gold) / (damage dealed by unit / total damage dealed to unit)
also create a trigger that reduces this reals values by 10% every 1.00 second.


important, each unit in your map have to have an unique custom value that never changes.

Why use custom value when you can use hashtables? Custom values are limited and you have to set a unique number of each unit. However, hashtable makes use of the unit handle, which is a unique integer that every unit has, which is of course different for every single unit. First of all, you'll need to give bounty by triggers, and not default Warcraft 3 Bounty system. Here's the basic bounty giving action.

Trigger:
  • Actions
    • Player - Add 500 to Player 1 (Red) Current gold


You can add floating text to display the golden +xx if you want. So that's the basics of the basics. Moving on, now you need to detect the damage dealt. You can use Weep's GUI Friendly Damage Snippet (GDD) for damage detection. It's simple, efficient, GUI-Friendly and it really works. So get it. Now you'll need hashtable, so create a variable called "Hashtable" and set it in map initialization.

Trigger:
  • Initialize
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)


Now, you need to set the bounty to each specific unit types. You'll have to specifically check which unit-type it is and set the bounty in this trigger.

Trigger:
  • Set Bounty
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Footman
        • Then - Actions
          • Set TempInt = (Random integer number between 40 and 50) <-- Set bounty here
          • Custom script: call SaveInteger(udg_Hashtable, GetHandleId(GetTriggerUnit()), StringHash("bounty"), udg_TempInt)
        • Else - Actions


After that's done, use this trigger. You'll need a real variable called TempReal, integer variable called TempInt, unit variable called TempUnit and a boolean variable called TempBoolean. Note that I'm using custom script for hashtables as my GUI version of it is bugged.

Trigger:
  • Damage Detection Bounty
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamagedUnit belongs to an enemy of (Owner of GDD_DamageSource)) Equal to True
    • Actions
      • Custom script: local integer i = 0
      • Set TempBoolean = False
      • Custom script: set udg_TempInt = LoadInteger(udg_Hashtable, GetHandleId(udg_GDD_DamagedUnit), StringHash("integer"))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempInt Greater than 0
        • Then - Actions
          • Custom script: loop
          • Custom script: exitwhen i == udg_TempInt or udg_TempBoolean == true
          • Custom script: set i = i + 1
          • Custom script: set udg_TempUnit = LoadUnitHandle(udg_Hashtable, GetHandleId(udg_GDD_DamagedUnit), i)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempUnit Equal to GDD_DamageSource
            • Then - Actions
              • Set TempBoolean = True
              • Custom script: set udg_TempInt = i
            • Else - Actions
          • Custom script: endloop
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempBoolean Equal to False
        • Then - Actions
          • Set TempInt = (TempInt + 1)
          • Custom script: call SaveUnitHandle(udg_Hashtable, GetHandleId(udg_GDD_DamagedUnit), udg_TempInt, udg_GDD_DamageSource)
          • Custom script: call SaveInteger(udg_Hashtable, GetHandleId(udg_GDD_DamagedUnit), StringHash("integer"), udg_TempInt)
          • Else - Actions
      • Custom script: call SaveReal(udg_Hashtable, GetHandleId(udg_GDD_DamagedUnit), GetHandleId(udg_GDD_DamageSource), LoadReal(udg_Hashtable, GetHandleId(udg_GDD_DamagedUnit), GetHandleId(udg_GDD_DamageSource)) + udg_GDD_Damage)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • GDD_Damage Greater than (Life of GDD_DamagedUnit)
          • Then - Actions
            • Custom script: call SaveReal(udg_Hashtable, GetHandleId(udg_GDD_DamagedUnit), StringHash("totaldamage"), LoadReal(udg_Hashtable, GetHandleId(udg_GDD_DamagedUnit), StringHash("totaldamage")) + GetUnitState(udg_GDD_DamagedUnit, UNIT_STATE_LIFE))
          • Else - Actions
            • Custom script: call SaveReal(udg_Hashtable, GetHandleId(udg_GDD_DamagedUnit), StringHash("totaldamage"), LoadReal(udg_Hashtable, GetHandleId(udg_GDD_DamagedUnit), StringHash("totaldamage")) + udg_GDD_Damage)


The above trigger is to check the damage taken and store the damage dealt by individual units. And now comes the bounty giving part. You need another real variable, but a real array and another integer variable.. I'll name the arrayed real variable as PlayerReal and the integer variable as BountyCount.

Trigger:
  • Give Bounty
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: local integer i = 0
      • Custom script: set udg_BountyCount = LoadInteger(udg_Hashtable, GetHandleId(u), StringHash("bounty"))
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set PlayerReal[(Integer A)] = 0.00
      • Custom script: set udg_TempInt = LoadInteger(udg_Hashtable, GetHandleId(u), StringHash("integer"))
      • Custom script: loop
      • Custom script: exitwhen i == udg_TempInt
      • Custom script: set i = i + 1
      • Custom script: set udg_TempUnit = LoadUnitHandle(udg_Hashtable, GetHandleId(u), i)
      • Custom script: set udg_TempReal = LoadReal(udg_Hashtable, GetHandleId(u), GetHandleId(udg_TempUnit))
      • Set PlayerReal[(Player number of (Owner of TempUnit))] = (PlayerReal[(Player number of (Owner of TempUnit))] + TempReal)
      • Custom script: endloop
      • Custom script: set udg_TempReal = LoadReal(udg_Hashtable, GetHandleId(u), StringHash("totaldamage"))
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PlayerReal[(Integer A)] Greater than 0.00
            • Then - Actions
              • Player - Add (Integer(((Real(BountyCount)) x (PlayerReal[(Integer A)] / TempReal)))) to (Player((Integer A))) Current gold
              • <Add Floating text here if you want>
            • Else - Actions
      • Custom script: set u = null


And there, you have your bounty system based on damage dealt. I'm not sure if this works, so you might want to test it out.
 

mapguy

New Member
Reaction score
46
I will ask in another thread how the hell I use hashtables.
you can PM me glen, so I dont need to create a thread.
 

tommerbob

Minecraft. :D
Reaction score
110
I didn't read through all of Glenphir's system, but did you take into account whether or not the unit heals after being dealt damage? Does it take into account a scenario example where a hero almost kills a unit, but the unit escapes, goes to heal, and then returns, and is killed by a different hero than the first? Will the first hero receive any bounty for that kill?
 

Ayanami

칼리
Reaction score
288
I didn't read through all of Glenphir's system, but did you take into account whether or not the unit heals after being dealt damage? Does it take into account a scenario example where a hero almost kills a unit, but the unit escapes, goes to heal, and then returns, and is killed by a different hero than the first? Will the first hero receive any bounty for that kill?

Hmm, actually I didn't take that in account. Well this actually depends. Most "bounty by damage" would have a sort of timer that resets damage taken by a damage source if the damage source doesn't deal any damage within x seconds. But not sure what farold wants as of now.
 

Bogrim

y hello thar
Reaction score
154
There isn't a proper way to detect healing done. However, if you save all the damage done to a creep then split the gold by a percentage of the total damage done, you could easily achieve an accurate effect.

Glenphir, it would be much simpler to just add the damaging units to a unit group, then save the real value of the damage caused to the damaging unit using the damaged unit's ID, and add the damage amount to the damaged unit's current "damage taken" amount. When the unit then dies, load the total damage amount from the hashtable amount and run through all the units in your group variable, granting them a percentage of gold using the percentage difference in the total damage done and the unit's damage caused. Then furthermore, use point value for bounty than creating it a system of its own.
 

farold

New Member
Reaction score
3
Strange... But I have nothing related to Hashtable in my WE, even if I have Jass Newgen :/
No Hashtable Variable's type... No trigger etc... :confused:

Bogrim : I think your's can give an accurate effect like u said, but I unfortunately have no Idea how to do that.
 

Ayanami

칼리
Reaction score
288
There isn't a proper way to detect healing done. However, if you save all the damage done to a creep then split the gold by a percentage of the total damage done, you could easily achieve an accurate effect.

Glenphir, it would be much simpler to just add the damaging units to a unit group, then save the real value of the damage caused to the damaging unit using the damaged unit's ID, and add the damage amount to the damaged unit's current "damage taken" amount. When the unit then dies, load the total damage amount from the hashtable amount and run through all the units in your group variable, granting them a percentage of gold using the percentage difference in the total damage done and the unit's damage caused. Then furthermore, use point value for bounty than creating it a system of its own.

Well yeah, a unit group would be simpler. However, if you use point-value, you wouldn't be able to create a range right? Like 40-50 gold.

Strange... But I have nothing related to Hashtable in my WE, even if I have Jass Newgen :/
No Hashtable Variable's type... No trigger etc... :confused:

Bogrim : I think your's can give an accurate effect like u said, but I unfortunately have no Idea how to do that.

What is your Warcraft version?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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