- Joined
- Apr 10, 2010
- Messages
- 2,789
Can you do this: When you chop trees, you obtain gold? If you can what should I do?
Thanks
Thanks
Hm.
Which of these do you want to do:
1. Make your workers gather gold from trees instead of lumber
2. Make each chop of a tree give you gold, like how Pillage works against buildings
3. Make each tree award a gold bounty when its fully cut down
Why do you want to do this?
Jsut change the lumber UI into gold then you have it.
How?
Make each chop of tree give you gold, like how pillage works against buildings. Like that.
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
if ( not ( GetDestructableTypeId(GetTriggerUnit()) == 'LTlt' ) ) then
return false
endif
return true
endfunction
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
call AdjustPlayerStateBJ( 1, GetOwningPlayer(GetAttacker()), PLAYER_STATE_RESOURCE_GOLD )
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
Alternatively.
Every 0.1 game seconds
Set LumberX (Integer Variable) to the Player Property (Current Lumber)
Set Player Property (Current Gold) = Arithmetic (Current Gold + LumberX)
Set Player Property (Current Lumber) = Arithmetic (Current Lumber - LumberX)
What this will do, is every 0.1 second of game time, if the player has any lumber, it will be converted into gold. So, your player will never have any lumber, only gold. Don't know if this is of any use, but it is certainly one of the simplest ways of doing things, in my opinion, probably also the most limiting.
Change the gold mine model to the tree you want, and there you go xD