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

A simple Question

Status
Not open for further replies.
Level 4
Joined
Jan 8, 2009
Messages
68
hi

i got this idea that i need to test. but to complete my idea i need some help.

id like to give a worker only 1 wood but only when the tree falls.
the idea is to simulate that the worker has chopped down one tree.

i guess this is easy but my World Editor skills are not that good..

culd you please help me?
thx
 
You could set it so that every time a worker delivers 10 wood (10 hits of the tree by default) it'll set the player's lumber to (their lumber - 9). It'll look more simple when you implement it, because you know how many chops you'd like it to take. Alternatively, you could use the "Player - Divert Income" function, and set it to the appropriate percent (90%, if using the default harvest). Just divert it to neutral hostile, or something else that won't effect the game at all.

However, when more than one worker is chopping trees in any given area, or if you switch trees, it'll get messed up, for obvious reasons.

To make it bug-proof, you'd have to make it so that the workers never had to return their lumber (odd, but functional), by setting the capacity ridiculously high (I think 0 might make it infinite, but I'm not sure), and make a trigger that adds 1 lumber to the owner of any unit that kills a tree.
 
Level 11
Joined
Jun 21, 2007
Messages
505
You can find Harvest ability in Object Editor-->Abilities.

For it you got to change two fields:
Data - Damage dealt to the tree (set it to 1000), and
Data - Lumber Capacity (set it to 1).

That shouldn't make any problems. Keep it mind that it will affect all units who have that ability.
 
You can find Harvest ability in Object Editor-->Abilities.

For it you got to change two fields:
Data - Damage dealt to the tree (set it to 1000), and
Data - Lumber Capacity (set it to 1).

That shouldn't make any problems. Keep it mind that it will affect all units who have that ability.

There aren't any problems, per se, but they'd kill each tree in one hit, so the forest would be gone in a minute. Unless there's a function to change the amount of lumber a unit is holding, I don't think that the main idea is entirely feasible.
 
Level 4
Joined
Jan 8, 2009
Messages
68
hi guys. or girls? whatever..

is there a way to make this happen and have multiple units and so that they will return wood.

is it possible to make a intreger that removes 9 wood from the worker but parhaps make it an array so that it works in multiple units.
i have no idea but culd something like this work?
 
Level 11
Joined
Jun 21, 2007
Messages
505
Here's the solution. Edit the "Harvest" ability to make it allow a unit to carry 10000 lumber.

The create a trigger:
  • Events
    • Destructible - A Destructible within (Playable Map Area) dies
  • Conditions
    • (Destructible-Type of (Dying Destructible)) Equal to Summer Tree Wall
  • Actions
    • Unit Group - Pick every unit in a region around dying destructible and set distance from each of those units to the dying destructible to some array variable of type Real. And also name some other variable of type real to AnglesVariable, and store Angle from position of Dying Destructible to Picked Unit
    • Set IntegerVariable = Number of units picked in Unit Group
    • Set TheShortestDistance = 10000
    • For Each Integer A From 1 to IntegerVariable do (Actions)
      • If RealTypeVariable is Less than TheShortestDistance Then do Set TheShortestDistance = RealTypeVariable[Integer A] And also do Set SomeIntegerVariable = Integer A
    • Set SomeUnit = Random Unit from region, which is a point with offset - Position of destructible offset by TheShortestDistance towards AnglesVariable[SomeIntegerVariable], offset by 10, 10
    • -------- The action below will make the worker to drop all its lumber --------
    • Unit - Issue an Order Targeting a Unit - Order SomeUnit to Harvest AVerySpecialHidden Goldmine
    • Unit - Issue an Order Targeting a Point - Order SomeUnit to move to some main Hall
    • Unit Group - Add SomeUnit to ThoseWhoMustDeliverLumber Unitgroup
And when someone comes close to Main Hall, you check if he's in ThoseWhoMustDeliverLumber group, remove him from that group and add lumber to player.
 
Level 4
Joined
Jan 8, 2009
Messages
68
i cant get this to work..
  • Events
  • Destructible - A Destructible within (Playable Map Area) dies
  • Conditions
  • (Destructible-Type of (Dying Destructible)) Equal to Summer Tree Wall
  • Actions
  • Unit Group - Pick every unit in a region around dying destructible and set distance from each of those units to the dying destructible to some array variable of type Real. And also name some other variable of type real to AnglesVariable, and store Angle from position of Dying Destructible to Picked Unit
  • Set IntegerVariable = Number of units picked in Unit Group
  • Set TheShortestDistance = 10000
  • For Each Integer A From 1 to IntegerVariable do (Actions)
  • If RealTypeVariable is Less than TheShortestDistance Then do Set TheShortestDistance = RealTypeVariable[Integer A] And also do Set SomeIntegerVariable = Integer A
  • Set SomeUnit = Random Unit from region, which is a point with offset - Position of destructible offset by TheShortestDistance towards AnglesVariable[SomeIntegerVariable], offset by 10, 10
  • -------- The action below will make the worker to drop all its lumber --------
  • Unit - Issue an Order Targeting a Unit - Order SomeUnit to Harvest AVerySpecialHidden Goldmine
  • Unit - Issue an Order Targeting a Point - Order SomeUnit to move to some main Hall
  • Unit Group - Add SomeUnit to ThoseWhoMustDeliverLumber Unitgroup

can you make me a map?
 
Level 4
Joined
Jan 8, 2009
Messages
68
there is no way that a simple thing as this is impossible.
i have seen people to thing with the World Editor that i thought was impossible.
and now i hear that a simple thing as this is impossible... MEH!

PLEASE help me.
 
Idea!

  • Events
    • Destructible - A destructible dies
  • Conditions
    • The destructible is a tree
    • Killing unit has harvest ability
  • Actions
    • Unit - Remove harvest ability from killing unit
    • Unit - Add return lumber ability to killing unit
    • --------Base that off of the channel ability, making it a single target on town halls only at roughly melee range--------
    • Unit - Order killing unit to (return lumber) (closest town hall)
  • Events
    • Unit - A unit begins the effect of an ability
  • Conditions
    • Spell being cast = return lumber
  • Actions
    • Player - Add one lumber to owner of casting unit
    • Floating Text - Something similar to the normal resource return effects
    • Unit - Remove return lumber ability from casting unit
    • Unit - Add harvest ability to casting unit
    • Unit - Order casting unit to harvest nearest tree
I think that might actually work! :grin:

**Edit** For the return lumber ability, a better method of implementing it would be an instant no-target spell in the UI, which would trigger an invisible ability to the effect of the one mentioned above. That way, if the worker does something in between felling the tree, and returning, the return can be activated in one click, rather than clicking the ability, then the town hall.
 
Last edited:
Level 11
Joined
Jun 21, 2007
Messages
505
The order string for a peasant who is automatically returning resources is "returnresources"
If yo right click a tree or anything, then the order-string is "smart"
Only when peasant is automatically ordered to harvest, only then the order string os "harvest"
I've done some testing actually.
 
Level 4
Joined
Jan 8, 2009
Messages
68
i cant get this to work either... culd you please make a map?

as i said before. my world editor skills are limited.
 
Even through jass?

I couldn't find any native functions that detect killing units of destructibles, and I tried using the JASS function for killer of a unit which failed as well, so that'd be a no... I wonder if one of those JASS-improving programs has something like it. :confused:


I suppose you could use the tax function, and set the harvest ability to have a very large interval, and damage to tree greater than or equal to its HP.
 
Ok what about unit begins casting ability? harvest is an ability right?

You might be on to something, there... I'm too tired to try it out now, though. I just got smothered in homework, too (my socials teacher assigned another project before the previous was due, then my English teacher thought it might be a good time for a project)... Caffeine makes me feel ill, too. :cry:
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
I would suggest something like this...
  • Trees
    • Events
      • Destructible - A destructible within DestructRegion <gen> dies
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Peasant
    • Actions
      • Set Owner = (Owner of (Triggering unit))
      • Player - Add 1 to Owner Current lumber
Create many different regions with the destructibles cause this event works only for the first 64 trees chopped,so if you use it globally in your map it will only work for the first 64 trees.If you use many different regions that contain less than 64 trees you should be ok.

Now...you also need to set the life of the destructible to 1 so it will be instantly chopped.

You can also change the conditions and add the unit you want...


*I didn't test this,so it might now work*
 
Level 11
Joined
Jun 21, 2007
Messages
505
reason 3, your way doesn't work at all, I have just checked. (Attacking Unit) refers to the unit which attacks some other unit. There's no way to return the unit killing a destructible.

The only way is to pick a random unit standing very close to destructible, and verifying if its order is "smart" or "harvest" and its unit-type is Peasant
 
Status
Not open for further replies.
Top