• 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.

Easyer way to detect bounty given?

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2010
Messages
950
Is there a easy way to detect how much bounty a unit gives to the owner of killing unit.
I want to be able to give double bounty to certain players. Was wondering if theres a simpler way it can be done other than the way im thinking ill need to do it..
which is declare everything ad the unit and price then do a loop checking for int A etc.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Or you could just record the bounty that each unit in your game drops, and when a unit dies match its unit-type with the stored bounty values and (since the bounty will already be given once by default) simply add it again (for the players you want to receive double bounty). That's a hell of a lot better than using a loop. Just look in the Object Editor to see the bounty return values of each unit type.
 
Level 13
Joined
Mar 24, 2010
Messages
950
  • Insane AI Killing
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Killing unit)) controller) Equal to Computer
      • (Melee AI of (Owner of (Killing unit))) Equal to Insane AI
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Bounty_UnitType[(Integer A)]
            • Then - Actions
              • Player - Add Bounty_Int[(Integer A)] to (Owner of (Killing unit)) Current gold
            • Else - Actions
this is what i planned to do if there wasnt a better way that i overlooked some how.

In my initialization i have it set up what unit is what array number and the array value for the int bounty corresponding with the array unit.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
That won't be 100% accurate, but in most situations I suppose it would work okay. The only problem is if the player obtains gold from various sources in a small amount of time, it could cause your script to detect an improper amount of gold bounty.

The method I suggested earlier wouldn't work either, though, since the bounty given is random and it isn't possible to determine how much gold exactly was given by a killed unit. Bond009 I apologize for giving such a poor suggestion, I must have been tired. If you only want your units to give a certain, defined amount of bounty (for example a Footman would always give 10 gold) then it would work since you don't have to anticipate the randomization of the bounty.

The best way is to code your own bounty, as Ciebron suggested.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Why not just make a script to customize bounty entirely? If you've already got a "table" of values for each unit-type then you might as well just give the Object Editor values 0 and then whenever a unit dies display a text-tag (only to the owner of the killing unit) with the amount of bounty that was calculated.
 
Status
Not open for further replies.
Top