• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Need Help Giving Bounty Via Dying Unit Point Value

Status
Not open for further replies.
Level 6
Joined
Feb 10, 2011
Messages
188
I am trying to make it so a player gets a bounty in gold equal to the unit that is killed point value.
The point values of my units range from 1-30

I tried this,
  • Player - Add ((Point-value of (Triggering unit)) / 4) to (Owner of (Killing unit)) Current gold
but it doesnt seem to work

can someone tell me the right way to do this.

/edit:
the bounty given to the killing player should be equal to 1/4 of the dying units point value.
 
Last edited:
Level 11
Joined
Nov 15, 2007
Messages
800
Can you please post the trigger where you set the units point-value specifically, and the whole trigger for when you want to give the bounty too?


Point values are set in the object editor and can't be altered through triggers, I believe you're thinking of custom value.
 
Level 6
Joined
Feb 10, 2011
Messages
188
Also which units did u test this against ? im pretty sure if u tested it against the units that have 1 - 3 it will return 0.
u should put in a game message to see what value it is trying to give to that player.

sorry i was tired last night when i wrote this, yes the values range from 1 - 30

i know there is a way to do it, I've seen triggers that worked before but i cant remember how its done. I will try that test in game soon and report back

just tested, it returns as 0
 
Last edited:
Level 6
Joined
Feb 10, 2011
Messages
188
yes 1 - 3 will return zero because wc3 doesnt round up. ur also using integers. Did u test the higher ones like anything over 4 ?

ya i test 4 and 5 both returned as 1. and 10 returned as 2 i think.

so how i can make it work right? should i use something besides integers?

and i dont want it to round if thats what u thought.

and in the OP i meant to say the bounty given to the killing player should be equal to 1/4 of the dying units point value.
 
Level 6
Joined
Feb 10, 2011
Messages
188
no its just the way blizzard rounds. instead change the numbers from 1 - 30 to 4 - 33 and it will work fine.

not sure how i could make it work, bounty is based off of a units gold cost and the point value is the same as the gold cost, but i did find this. its a trigger that seems to work, but its not accurate.

  • Deathtrigger
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set bountydivisor = ((Point-value of (Triggering unit)) mod 4)
      • Set bountymoney[(Player number of (Owner of (Killing unit)))] = (bountymoney[(Player number of (Owner of (Killing unit)))] + bountydivisor)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • bountymoney[(Player number of (Owner of (Killing unit)))] Greater than or equal to 4
        • Then - Actions
          • Set bountymoney[(Player number of (Owner of (Killing unit)))] = (bountymoney[(Player number of (Owner of (Killing unit)))] - 4)
          • Set bountyget = (((Point-value of (Triggering unit)) / 4) + 1)
        • Else - Actions
          • Set bountyget = ((Point-value of (Triggering unit)) / 4)
      • Player - Add bountyget to (Owner of (Killing unit)) Current gold
this is just a trigger i found, im not to sure what it is doing. And i really coudlnt explain it. could u?
 
its getting the modulo of the integer. It basically gets the remainder of a value and a divisor.

if u dont know what that is just google it. Its better explained there.

Also if u want the point value to be the gold just take out the divide by 4.
This will make point value of 1 give one gold and point value of 30 give 30 gold and everything in the middle.
 
Status
Not open for further replies.
Top