• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Gold from trees

Status
Not open for further replies.
Level 10
Joined
Mar 31, 2009
Messages
732
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
 
Level 2
Joined
Apr 30, 2010
Messages
5
Why do you want to do this?
Jsut change the lumber UI into gold then you have it.
 
Level 19
Joined
Apr 10, 2010
Messages
2,789
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

Make each chop of tree give you gold, like how pillage works against buildings. Like that.


Why do you want to do this?
Jsut change the lumber UI into gold then you have it.

How?
And it for my map.
 
Last edited:

Go to Gameplay Constants and scroll to everything related to Gold and Lumber. In the Gold fields, place every Lumber field. E.g. Icon - Gold -> replace it with the icon of the lumber. The categories you should worry are:
1) Icon, 2) Text - General, 3) Text - Message (for gold/lumber messages, e.g. "Not enough gold.")
 
Level 10
Joined
Mar 31, 2009
Messages
732
Make each chop of tree give you gold, like how pillage works against buildings. Like that.

Not possible without JASS, as there is no detection function for a destructable taking damage, only a destructable dying.

This might work:
JASS:
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
But I havent tested it, and don't think it will work. Not sure how units/destructables work, it might not catch a destructable being attacked.

Other way to go is to pick every tree on the map and register an event for them being attacked... again would have to be treated as a unit.
 
Level 6
Joined
Mar 22, 2009
Messages
276
Do what .Ouch said, just change the lumber UI with the gold UI and you have what you want. Use the steps given by Pharaoh.

.Ouch idea is the easiest and best way i think. :)
 
Level 6
Joined
Mar 22, 2009
Messages
276
Treat the lumber resource as gold, then make the real gold resource into another resource.
Set all the gold costs into lumber cost. Just swap the usage of lumber and gold. Ill try to make a test map when I got home.
 
Level 5
Joined
May 27, 2007
Messages
162
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.
 
Level 19
Joined
Apr 10, 2010
Messages
2,789
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.

But my lumber is water at my map. And if it reaches 0, you die.

Change the gold mine model to the tree you want, and there you go xD




Ok thanks. But is there a command to replace doodads with those units? Since I put a lot of trees in my map already.
 
Level 8
Joined
Mar 15, 2007
Messages
230
Just create neutral units that are trees, and give your peasants a pillage ability that returns gold per attack. You'll have to set a gold cost for your trees so that you get resources back. That should be a feasible workaround.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
Status
Not open for further replies.
Top