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

Special Harvesting Trigger

Status
Not open for further replies.
Level 17
Joined
Jun 12, 2007
Messages
1,261
Could not find it, so here is my request:

My map will have more then just 2 resources, actually it will have more then 20 resources, these will stored in array integer so each player can access it.
These integers will then be displayed to each player in their own multiboard.
This is all within my powers.

And here comes my problem:
But I don't want to use the AoE3 harvest method:
- They will just attack the deposit for example gold, and one gold is added to the player's gold integer.

I want to have my own and if possible something like this:
- Peasants will have 10 mana. (Inventory)
- When they attack a deposit it will add 1 mana, when it has 10 mana it will go back to the nearest let's say town hall, they will also have the animation if they were caring a bag (gold harvest animation) when they have more then 0 mana.
- At the town hall it will store the resource it was harvesting, bringing the mana back to 0.
- It will then return to the resource it was gathering.

I would like to base resources out of the destructible rock chuck. There will be tree's based of it, gold, iron, coal, copper and tin deposits, food bushes etc.
My problem is I don't have a clue how to make this work.

Only thing I could think of is replacing the peasant when it attacks a resource, so when it attacks a gold deposit it will turn into a peasant (raw gold).
But still this is beyond my power so it would be nice if somebody helped me.
I will reward people that help with rep and credits in the map.

P.S.
It has to be MUI since most players will have like 40 harvesters?
Don't care about leaks, I can fix them myself, besides it's just an example.
 
Level 11
Joined
Apr 6, 2008
Messages
562
Seems a higher quality map.--

do something like this for the peasants carrying gold animation-

  • red harvest
    • Events
      • Unit - A unit owned by Player 1 (Red) Finishes casting an ability
    • Conditions
      • ((Unit-type of (Triggering unit)) is A peon-type unit) Equal to True
      • (Ability being cast) Equal to *
    • Actions
      • Set harvestlocred = (Position of (Triggering unit))
      • Set harvestanglered = (point of the triggering unit's facing angle**)
      • Set harvestdesred = (Target destructible of ability being cast)
      • Unit - Remove (Triggering unit) from the game
      • Unit - Create 1 gold bag pes*** for Player 1 (Red) at harvestlocred facing harvestanglered
      • Unit - Order (Last created unit) to Harvest harvestdesred
*= ability being cast

**= could not find this in the editor but I know it is there.

***= unit type with the "gold" animation name required trait.

harvestlocred= point variable

harvestanglered= angle/point/integer (not sure what to use)

harvestdesred= destructible variable

and to turn the "gold" in would be the opposite trigger...
 
Level 15
Joined
Dec 18, 2007
Messages
1,098
Ok, I can't really use WE at the moment so I will explain my solution. First, create an ability based off Orb of Lightning and make the spell it triggers a spell that regenerates 1 mana.
So each 0.2 second or something, you pick every Peasant unit with more than 0 mana and remove the animation tag "gold" or "lumber" and then add the animation tag "gold" or "lumber" etc. If that peasant unit you picked has 10 mana, set the unit to a unit variable temporarily and pick units in the area of type town hall or whatever and order the unit to move there.
Another trigger would trigger every 0.2 seconds or something and pick every town hall in the area and then pick peasants nearby and add the gold, etc. etc.
This is basically what it is, will explain in more detail if needed.
PS: Use the unit's custome value to store what resource it was collecting.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Seems a higher quality map.--

do something like this for the peasants carrying gold animation-

  • red harvest
    • Events
      • Unit - A unit owned by Player 1 (Red) Finishes casting an ability
    • Conditions
      • ((Unit-type of (Triggering unit)) is A peon-type unit) Equal to True
      • (Ability being cast) Equal to *
    • Actions
      • Set harvestlocred = (Position of (Triggering unit))
      • Set harvestanglered = (point of the triggering unit's facing angle**)
      • Set harvestdesred = (Target destructible of ability being cast)
      • Unit - Remove (Triggering unit) from the game
      • Unit - Create 1 gold bag pes*** for Player 1 (Red) at harvestlocred facing harvestanglered
      • Unit - Order (Last created unit) to Harvest harvestdesred
*= ability being cast
**= could not find this in the editor but I know it is there.
***= unit type with the "gold" animation name required trait.
harvestlocred= point variable
harvestanglered= angle/point/integer (not sure what to use)
harvestdesred= destructible variable
and to turn the "gold" in would be the opposite trigger...

Nah, that wont work for multiple workers, it would just overwrite the variables as far as I know...

Ok, I can't really use WE at the moment so I will explain my solution. First, create an ability based off Orb of Lightning and make the spell it triggers a spell that regenerates 1 mana.
Don't know the use of this, they gain mana when they harvest.. And they harvest by attacking the destructible.. And that would be easy if there was an event; destructible gets attacked..

So each 0.2 second or something, you pick every Peasant unit with more than 0 mana and remove the animation tag "gold" or "lumber" and then add the animation tag "gold" or "lumber" etc. If that peasant unit you picked has 10 mana,

Ah didn't knew there were animation tags, lol need to shape up my knowledge about models and stuf.
Oke this part is easy for me to do.

set the unit to a unit variable temporarily and pick units in the area of type town hall or whatever and order the unit to move there.
Another trigger would trigger every 0.2 seconds or something and pick every town hall in the area and then pick peasants nearby and add the gold, etc. etc.
Will it pick the nearest? I'm not sure... It would be nice if it could pick the nearest structure when they deposit.

PS: Use the unit's custome value to store what resource it was collecting.

Could use more explanation about that one, I have never worked with custom values before. I'll check the custom value thing out, seems useful.
Basically, I can set a value to a unit when it harvest a certain thing..
So 1 would be gold, 2 would be iron, 3 would be lumber for example?

-----

I have some additional questions now, for example if the harvester harvests gold till 9 gold (mana), and then suddenly does lumber it will have 10 lumber (mana).
I want to prevent this bug.
I know I have to put in some thing in the trigger that starts harvest and adds mana.
I might figure this out on my own, like..

When custom value is not equel to 0 (standing for nothing) set mana to 0.

Would that work? xD


Thanks for your help in advance though.
 
Level 22
Joined
Jun 24, 2008
Messages
3,050
Ok, you need a boolean for the unit to return. If its true, it should be ordered to return.

Use the action 'Wait for (Condition)' and then add your return actions.

Just use an integer that rises in the [] arrays, to make it Mui.

So whenever you make a unit attack, you trigger the mana adding, and then you wait for (Real "Mana of triggering unit" becomes 10), and then you do your return actions, as changing the animation tag (gold) and ordering it to return. Then use your boolean. When it comes close to the drop off, and it is 'true' then set to 0, and add your integer o your integer.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Ok, you need a boolean for the unit to return. If its true, it should be ordered to return.

Use the action 'Wait for (Condition)' and then add your return actions.

Just use an integer that rises in the [] arrays, to make it Mui.

So whenever you make a unit attack, you trigger the mana adding, and then you wait for (Real "Mana of triggering unit" becomes 10), and then you do your return actions, as changing the animation tag (gold) and ordering it to return. Then use your boolean. When it comes close to the drop off, and it is 'true' then set to 0, and add your integer o your integer.

Could use a sample trigger, my brain is having trouble reading words... xD
I still have not heard a good way to send the unit back to the deposit it was working.

I'm getting a picture now, but its foggy and fluffy.
Need some samples to remove the fluffiness and fogginess.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Ok, i will create them now. I'll edit this post afterwards, so stay tuned :D

Edit:

I'll check it out when I have time, most likely Friday. xD
Don't worry about leaks, I know how to fix 99% of them.

EDIT:
Hmm, close but not enough.
It's for units, that's not so hard, but mine are based of a destructible, not a unit....
Also it's not MUI, I know what u mean by adding the integer.. but if there are like 100 harvesters, each harvesting each second, the game might last 2 hours.... That's a high integer value.... You sure it will handle it?

(I didn't care about leaks I said, sure, but darn that is unoptimized man, it will add the event like 1000 times, depending on how much it harvests... xD)

Anyway, this is what TheBlooddancer made, I hope somebody can edit it to be more fitting to my desires. :p P.S. You did gave me a better look of what I need to make. :p

  • Increasing
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
      • (Unit-type of (Attacking unit)) Equal to Peasant
    • Actions
      • Set Gather[(Player number of (Triggering player))] = (Attacked unit)
      • Trigger - Add to Delivering <gen> the event (Unit - (Attacking unit)'s mana becomes Equal to 10.00)
      • Unit - Set mana of (Attacking unit) to ((Mana of (Triggering unit)) + 1.00)
  • Delivering
    • Events
    • Conditions
    • Actions
      • Set DropOff = (Random unit from (Units within 1000.00 of (Position of (Triggering unit)) matching (((Owner of (Matching unit)) Equal to (Owner of (Triggering unit))) and ((Unit-type of (Triggering unit)) Equal to Castle))))
      • Unit - Order (Triggering unit) to Right-Click DropOff
      • Trigger - Add to Final <gen> the event (Unit - A unit comes within 50.00 of (Triggering unit))
  • Final
    • Events
    • Conditions
    • Actions
      • Unit - Set mana of (Triggering unit) to 0.00
      • Set Integer = (Integer + 10)
      • Unit - Order (Triggering unit) to Attack Gather[(Player number of (Triggering player))]
I would really like it if was MUI already.. and working for destructibles not units. If you want you may want to add the custom value thing that was suggested earlier, but I think I can manage that.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Main problem is that it's used with destructibles.
I rly need this.. xD

If you have alternate ways just tell me, as long as it looks nice.
I don't want to stick with my AoE3 harvesting.

---------

Anyway, there might be an other solution.
Using the normal harvest for tree's to be multi.
There are a few problems though.

- It will still show +10 when it stored lumber.
- I don't know how to detect when a tree is harvest.
- I don't know how to detect when a unit deposits.

I tried it, and posted my trigger in the Trigger Section. Don't know how to create it.
Maybe anybody here knows how to detect it?

Cause I only need to know how to detect it, I can work with the other actions myself.
 
Status
Not open for further replies.
Top