Mana Absorb Auto Recast

chiwang

New Member
Reaction score
0
So the premise of my trigger is that I'm adding a 3rd resource Food.

Peasants will be able to "gather" food from Farms by Mana Absorbing the mana of the Farm.

The cooldown of Mana Absorb is 0 seconds and the casting time is 20 seconds. Peasants initially have 0 mana and have a capacity of 10. My trigger aims to have Peasants automatically Mana Absorb a farm after the first manual user-commanded Mana Absorb.

Here is the trigger:

EVENTS:
--------Unit - A unit finishes casting an ability

CONDITIONS:
--------(Ability being cast) Equal to Mana Absorb

ACTIONS:
--------Unit - Set mana of (Casting unit) to 0.00
--------Unit - Order (Casting unit) to Undead Destroyer - Absorb Mana (Target unit of ability being cast)

Basically, the trigger fails because nothing happens after the initial user-commanded Mana Absorb. How can I fix this?

Also, can I get some ideas on how to get my Peasants to return to the nearest town hall after Mana Absorbing?



Thanks everyone for your help :)
 

Ayanami

칼리
Reaction score
288
So the premise of my trigger is that I'm adding a 3rd resource Food.

Peasants will be able to "gather" food from Farms by Mana Absorbing the mana of the Farm.

The cooldown of Mana Absorb is 0 seconds and the casting time is 20 seconds. Peasants initially have 0 mana and have a capacity of 10. My trigger aims to have Peasants automatically Mana Absorb a farm after the first manual user-commanded Mana Absorb.

Here is the trigger:

EVENTS:
--------Unit - A unit finishes casting an ability

CONDITIONS:
--------(Ability being cast) Equal to Mana Absorb

ACTIONS:
--------Unit - Set mana of (Casting unit) to 0.00
--------Unit - Order (Casting unit) to Undead Destroyer - Absorb Mana (Target unit of ability being cast)

Basically, the trigger fails because nothing happens after the initial user-commanded Mana Absorb. How can I fix this?

Also, can I get some ideas on how to get my Peasants to return to the nearest town hall after Mana Absorbing?



Thanks everyone for your help :)

If you use autocast, the trigger won't recognize "Mana Absorb" as an ability when used.
 

chiwang

New Member
Reaction score
0
You mean like Inner Fire/Heal autocast? The skill is Mana Absorb theres no autocast for that, I'm trying to trigger a loop for the skill.
 

chiwang

New Member
Reaction score
0
Basically, the trigger fails because nothing happens after the initial user-commanded Mana Absorb. How can I fix this?

Mana Absorb works fine on the building if you cast it yourself, I just want it to keep recasting after you order a Peasant to Mana Absorb the building.
 

Ayanami

칼리
Reaction score
288
Hmm, then create a periodic trigger that constantly orders the Peasant to cast Mana Absorb? Well, Mana Absorb has a 20 seconds casting time right?
 

chiwang

New Member
Reaction score
0
Ya but is there something wrong with the trigger I have already?

EDIT: Well I mean there IS something wrong :p because it doesn't work :(
Whats wrong with it?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
To start with, copy your trigger directly instead of writing everything by yourself. Just right-click the trigger inside the triggerwindow, just above "Event" and click "Copy as text".
Also change the event to A unit Starts the effect of an ability instead, and change (Casting unit) to (Triggering unit) :D
 

Ayanami

칼리
Reaction score
288
Post all of your triggers using WC3 tags. From there, I will be able to help. But likeKomaqtion said, use Triggering unit.
 

chiwang

New Member
Reaction score
0
Ok Glenphir and Komaqtion, thanks for your help. Revised trigger below:

Trigger:
  • Mana
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mana Absorb
    • Actions
      • Set Food[(Player number of (Owner of (Triggering unit)))] = (Food[(Player number of (Owner of (Triggering unit)))] + 10)
      • UNIT - SET MANA OF (TRIGGERING UNIT) TO 0.00
      • UNIT - ORDER (TRIGGERING UNIT) TO UNDEAD DESTROYER - ABSORB MANA (TARGET UNIT OF ABILITY BEING CAST)
      • Leaderboard - Change the value for (Owner of (Triggering unit)) in (Leaderboard of (Owner of (Triggering unit))) to Food[(Player number of (Owner of (Triggering unit)))]


However, the Peasant still doesn't do anything after 1 Mana Absorb and also the Peasant's mana doesn't get emptied (basically the capitalized parts don't work). When I used casting unit the Peasant's mana got emptied.
 

chiwang

New Member
Reaction score
0
Sure, thanks for your time.

View attachment legionwars.w3x

So revised trigger:

Trigger:
  • Mana
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Farm
    • Actions
      • Wait 1.00 seconds
      • Set Food[(Player number of (Owner of (Triggering unit)))] = (Food[(Player number of (Owner of (Triggering unit)))] + 10)
      • Unit - Set mana of (Triggering unit) to 0.00
      • Wait 0.50 seconds
      • Unit - Order (Triggering unit) to Undead Destroyer - Absorb Mana (Target unit of ability being cast)
      • Leaderboard - Change the value for (Owner of (Triggering unit)) in (Leaderboard of (Owner of (Triggering unit))) to Food[(Player number of (Owner of (Triggering unit)))]


It seems this line:
Trigger:
  • Unit - Order (Triggering unit) to Undead Destroyer - Absorb Mana (Target unit of ability being cast)

doesn't work, everything else is fine. I think the problem is the "Target unit of ability being cast," since I ordered the Triggering unit to go harvest gold instead of Mana Absorb and it worked. Help?



And also, any ideas on how to get my Peasants to return to the nearest town hall after Mana Absorbing?
 

Squirel

New Member
Reaction score
13
For the return to town hall, you might try modifying the call to arms ability. You might be able to cause it to not create a militia. You'd have to play around with it. That would get the return to town hall but then I don't know how to get the Peasant to return to the farm. You might do that with a variable for the location of the farm. I'm not really sure but I think that that's what you need to mess around with.
 

chiwang

New Member
Reaction score
0
OK, so big update.

After the User orders a Peasant to gather food from a Farm, the Peasant will go into a loop where it will gather food from Farm then return to nearest Town Hall and start all over again.

Trigger:
  • Mana
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to GatherFood
    • Actions
      • Set FarmUnit = (Target unit of ability being cast)
      • Wait 1.00 seconds
      • Unit - Order (Triggering unit) to Human Peasant - Call To Arms
      • Wait until ((Unit-type of (Triggering unit)) Equal to Villager Militia), checking every 1.00 seconds
      • Unit - Order (Triggering unit) to Human Militia - Back To Work
      • Wait 1.00 seconds
      • Unit - Order (Triggering unit) to Undead Destroyer - Absorb Mana FarmUnit
      • Set Food[(Player number of (Owner of (Triggering unit)))] = (Food[(Player number of (Owner of (Triggering unit)))] + 10)
      • Leaderboard - Change the value for (Owner of (Triggering unit)) in (Leaderboard of (Owner of (Triggering unit))) to Food[(Player number of (Owner of (Triggering unit)))]
      • Unit - Set mana of (Triggering unit) to 0.00



However, a single lone problem remains. Lets say there are three Farms that you want to gather food from. So you order 3 Peasants to 3 separate Farms... when the loop kicks in all 3 Peasants will return to only 1 Farm since the UnitFarm variable is only 1 Unit. :banghead: Suggestions?
 

Squirel

New Member
Reaction score
13
Hadn't thought of that. You need an array variable with alot of indexes... You also need to count each time a peasant starts to cast that ability. The index will be related to the number of times that a unit casts that spell. The farm that you're targeting gets stored to that array index... Hard to explain and very complicated. Unless anyone has a better way to do it...
 

chiwang

New Member
Reaction score
0
Ya Squirel I was thinking the same thing but was wondering if there was a better way as well haha. Thanks man for helping though. Same to you, Glenphir and Komaqtion.

Okay, this trigger has been solved! I just gave every Peasant its own custom value and made an unit array Farm(custom value of Peasant).

Trigger:
  • Mana
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Farm
    • Actions
      • Set Farm[(Custom value of (Triggering unit))] = (Target unit of ability being cast)
      • Wait 1.00 seconds
      • Unit - Order (Triggering unit) to Human Peasant - Call To Arms
      • Wait until ((Unit-type of (Triggering unit)) Equal to Villager Militia), checking every 1.00 seconds
      • Unit - Order (Triggering unit) to Human Militia - Back To Work
      • Wait 1.00 seconds
      • Unit - Order (Triggering unit) to Undead Destroyer - Absorb Mana Farm[(Custom value of (Triggering unit))]
      • Set Food[(Player number of (Owner of (Triggering unit)))] = (Food[(Player number of (Owner of (Triggering unit)))] + 10)
      • Leaderboard - Change the value for (Owner of (Triggering unit)) in (Leaderboard of (Owner of (Triggering unit))) to Food[(Player number of (Owner of (Triggering unit)))]
      • Unit - Set mana of (Triggering unit) to 0.00


Thanks again to all those who helped!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top