General - Bounty and Units

Tutorial By ReVolver

Table of Contents

1. Finding the Trigger Editor
2. Adding the trigger
3. Editing the bounty



Step 1 - Finding the Trigger Editor

Like every WE and WEU out there, the Trigger Editor is found at the top left corner of the
main page of the editor as shown here.

(Image)

Step 2 - Adding the trigger

Add this trigger to your map to make all enemy units give bounty. Without this trigger, only Neutral Hostile
creeps give bounty. Note that the last action is called
'Player - turn flag on/off for player,' and 'gives bounty' is one of the player flags and we also *if you want* destroy the trigger. (follow steps 1-3)

1.


(Image)
2.

(Image)
3.

(Image)

End Results


(Image)

Step 3 - Editing the bounty

"Bounty is a random value between 'base + dice' and 'base + dice * sides' "
Every unit has a specific amount of gold they give away by default, but If you what them to drop more gold change it in the object editor.
Recommend Heroes : 200 gold , Hard Creeps : 100 gold and easy creeps or units for 45-60 gold.

(Image)

Edit: Second Way (Require JASS knowledge)

If you don't want to do it using the first method I mentioned you can use this way.

This is a function made by Vexorian that is very useful: I have added the function and showed an example on how to use it.

function Bounty takes player whichplayer, integer bounty, real x, real y returns nothing
 local texttag t=CreateTextTag()
 local string s="+"
    call AdjustPlayerStateBJ( bounty, whichplayer, PLAYER_STATE_RESOURCE_GOLD )
    if bounty<0 then
        set s=""
    endif
    call SetTextTagText(t,s+I2S(bounty),0.025)
    call SetTextTagPos(t,x,y, 0.00)
    call SetTextTagColor(t,255,220,0,255)
    call SetTextTagVelocity(t,0,0.03)
    if (GetLocalPlayer()==whichplayer) then
        call SetTextTagVisibility(t,true)
        set s="UI\\Feedback\\GoldCredit\\GoldCredit.mdl"
    else
        call SetTextTagVisibility(t,false)
        set s=""
    endif
    call DestroyEffect(AddSpecialEffect(s,x,y))
    call SetTextTagFadepoint(t,2)
    call SetTextTagLifespan(t,3)
    call SetTextTagPermanent(t,false)
 set t=null
endfunction



This will give you 20 gold if you kill a Footmen unit type.

function Conditions takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) == 'hfoo' 
endfunction

function Actions takes nothing returns nothing
    call Bounty(GetOwningPlayer(GetKillingUnit()),20,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()))
endfunction

//===========================================================================
function InitTrig_BountySystem takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions )
endfunction


Click here to comment on this tutorial.
 
 
Blizzard Entertainment, Inc.
Silkroad Online Forums
Team Griffonrawl Trains Muay Thai and MMA fighters in Ohio.
Apex Steel Pipe - Buys and sells Steel Pipe.