Gold question

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

kiwwi93
Junior Member
Posts: 45
Joined: July 27th, 2009, 7:35 am
Location: WA, USA

Gold question

Post by kiwwi93 »

Ok, so when a hero kills a normal unit, how do you make them give gold? like a hero kills a footman, and then he gets gold?
do you have to make a trigger? Or is it simple and I'm stupid and can't find it.
Image
User avatar
qweasd011
Forum Addict
Posts: 451
Joined: November 21st, 2008, 9:36 am
Title: Coleen!

Re: Gold question

Post by qweasd011 »

Yes, We create Triggers.

I'll show you how to make the trigger

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

If you want it in Jass I provided one to.

Code: Select all

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.

Code: Select all

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
You see this line above?
return GetUnitTypeId(GetTriggerUnit()) == 'hfoo'

the hfoo is the unit code of the footmen unit you can see unit codes at WE go to the object editor then press CTRL + D

ColeeN~
Image
kiwwi93
Junior Member
Posts: 45
Joined: July 27th, 2009, 7:35 am
Location: WA, USA

Re: Gold question

Post by kiwwi93 »

Your amazing!!! thanx very much :D
Image