Invocation Spell

Level 19
Joined
Oct 7, 2014
Messages
2,213
I have this ultimate spell which gives increase attack damage, attack speed and movement speed, I based it at a Battle Roar spell. Then a trigger where it picks up all units who has the Invocation buff (from the Battle Roar) and then a dummy will be created to each units who has Invocation buff. The dummy unit will cast a custom Blood Lust (for increased attack speed and movement speed).

The problem is I can't create dummies to all units who has a Invocation buff which is my problem.

  • Invocation
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
    • Actions
      • Set Invo_TargetRange = (Units within 650.00 of (Position of (Casting unit)) matching (((Matching unit) has buff Invocation ) Equal to True))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in Invo_TargetRange and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Angel for Player 1 (Red) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
 
Level 19
Joined
Oct 7, 2014
Messages
2,213
Like this?

  • Invocation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Invocation
    • Actions
      • Set Invo_TargetRange = (Units within 650.00 of (Position of (Casting unit)) matching (((Matching unit) has buff Invocation ) Equal to True))
      • Set Invo_TargetPosition = (Position of (Target unit of ability being cast))
      • Custom script: call DestroyGroup(udg_Invo_TargetRange)
      • Unit Group - Pick every unit in Invo_TargetRange and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Angel for (Owner of (Target unit of ability being cast)) at Invo_TargetPosition facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Invo_TargetPosition)
 
Last edited:
The remove location is outside the loop.
And the position is suppose to be before the group.
And seems we need 2 locations to handle this.

Wait, is dummy bloodlust having 99999.00 range of casting?

Something like this :
  • Invocation
  • Events
  • Unit - A unit Starts the effect of an ability
  • Conditions
  • (Ability being cast) Equal to Invocation
  • Actions
  • Set Invo_CastPosition = (Position of (Casting Unit))
  • Set Invo_TargetRange = (Units within 650.00 of (Position of (Invo_CastPosition) matching (((Matching unit) has buff Invocation ) Equal to True))
  • Unit Group - Pick every unit in Invo_TargetRange and do (Actions)
  • Loop - Actions
    • Set Invo_TargetPosition = (Position of (Picked Unit))
    • Unit - Create 1 Angel for (Owner of (Target unit of ability being cast)) at Invo_TargetPosition facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_Invo_TargetPosition)
  • Custom script: call RemoveLocation(udg_Invo_CastPosition)
  • Custom script: call DestroyGroup(udg_Invo_TargetRange)
 
Level 19
Joined
Oct 7, 2014
Messages
2,213
The Dummy Blood Lust has 100 range and costs 100 mana. Since I created the Dummy to all units I made the Dummy to have 100 mana only in order to be only casted upon the unit who has Invocation buff.
 
Level 21
Joined
Aug 27, 2013
Messages
3,963
Do this instead. You don't have to pick those who have Invocation buff. Just do the Bloodlust or any other AS & MS bonus ability at the same time with your invocation spell.
  • Invocation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Invocation
    • Actions
      • Set Invo_Caster = (Triggering unit)
      • Set Invo_CastPosition = (Position of Invo_Caster)
      • Unit - Create 1 Dummy for (Owner of Invo_Caster) at Invo_CastPosition facing Default building facing degrees
      • Set Invo_Dummy = (Last created unit)
      • Unit - Add a 1.00 second Generic expiration timer to Invo_Dummy
      • Unit - Add Invocation (AS & MS) to Invo_Dummy
      • Set Invo_TargetRange = (Units within 650.00 of Invo_CastPosition matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an ally of (Owner of Invo_Caster)) Equal to True))))
      • Unit Group - Pick every unit in Invo_TargetRange and do (Actions)
        • Loop - Actions
          • Unit - Order Invo_Dummy to Human Sorceress - Slow (Picked unit)
      • Custom script: call RemoveLocation(udg_Invo_CastPosition)
      • Custom script: call DestroyGroup(udg_Invo_TargetRange)
 

Attachments

  • Invocation.w3x
    17.5 KB · Views: 34
Level 24
Joined
Aug 1, 2013
Messages
4,657
@Daffa The Mage
The "set bj_wantDestroyGroup" is actually exacly the same as the destroy group.
It is even less cpu consuming I think.

The locations are indeed a leak.

This is what the trigger should be:
Event:
- A unit starts the effect of an ability
Conditions:
- (Ability Being Cast) equal to Invocation
Actions:
- Set TempUnit = (Triggering Unit)
- Set TempLocation = (Position of TempUnit)
- Set TempPlayer = (Owner of (TempUnit))
- Custom Script: set bj_wantDestroyGroup = true
- Unit Group - Pick every unit in (Units within 650.00 of TempLocation) and do (Actions)
---- Set TempUnit2 = (Picked Unit)
---- If
------- ((TempUnit2 is alive) Equal to True)
------- ((TempUnit2 is A structure) Equal to False)
------- ((TempUnit2 belongs to an ally of TempPlayer) Equal to True)
---- Then
------- Unit - Create 1 Dummy for TempPlayer at TempLocation facing Default building facing degrees
------- Set Dummy = (Last created unit)
------- Unit - Add a 1.00 second Generic expiration timer to Dummy
------- Unit - Add Invocation (AS & MS) to Dummy
------- Unit - Order Dummy to Human Sorceress - Slow TempUnit2
---- Else
- Custom script: call RemoveLocation(udg_TempLocation)

Although I am pretty certain that Human Sorceress - Slow is not the right one.
 
Level 21
Joined
Aug 27, 2013
Messages
3,963
@Wietlol
why would you create the dummy as many as the picked unit? just one dummy is enough.
Human Sorceress - Slow in the test map is already customized, it is for AS & MS bonus.

@apcrabnightlive
I don't really make efficiency as top priority for that trigger i made for you but of course,
you can make it efficient by your own but mine is already okay.
using buff and not using buff is irrelevant, i suggested not using that because it's easier that way.
 
Level 21
Joined
Aug 27, 2013
Messages
3,963
I'm not sure but maybe there is. Because I currently can't open my world editor to check them out. But any AS or MS related ability, whether it is slowing your enemy or giving your friendly units bonus. they can be made to give the opposite effect using "-" symbol before the value but you must press Shift + Enter the line before inputting the value.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
@Wietlol
why would you create the dummy as many as the picked unit? just one dummy is enough.
Human Sorceress - Slow in the test map is already customized, it is for AS & MS bonus.

Go to your map, place a few units around that footman, test spell... and search which unit has the "slow" and try to find out why all others dont.

When you order a unit to do something, that unit has not completed that order.
When I order you to get me a drink, and before you get the chance to get it, I order you to get a drink for someone else... you will only remember the last order I give... because you are dumb... (the footman, not you in person ;)

You have to wait until that dummy finished his spell. Even with 0 casting time, 0 casting point and instant effect, that unit is not able to cast the slow.
So it will only cast the slow on one target.
You have to put a wait inside that loop to make one dummy cast the slows...
But you dont want that wait but you want all units to get the slow at the same time... so you create one dummy for each unit.
 
Level 17
Joined
Sep 26, 2009
Messages
2,057
Nope... this is how dummies work for all 2 years of my wc3 modding time.

There are a few exeptions but those are getting really in-depth.
You can make 1 dummy unit cast single-target spell on number of units 'instantly'.
You need to set up correctly the dummy unit in object editor first (e.g. no movement, thus no turning rate, cast point equal to 0 and maybe something more, can't recall everything atm), as well as the spell itself (no cast time delays, etc.). Then when you create the dummy and order to it cast the spell on every unit in a unit group, it will actually do it (given there are no things that would prevent it... like spell range, mana, etc.).
I've made multiple spells like that in my map.

IIRC the only problem I had with that approach was that giving the dummy another order didn't work (as in remove ability, give it a new one, order it to cast the new ability), but I think that is because it is more time consuming than simply giving the dummy the same order over and over but for different target each time.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Well... it is less efficient than using only one dummy but... with one dummy it doesnt even work.
The trigger I posted is the most efficient way of doing this spell.
Also notice that I use "Temp..." variables.
You can use these variables over and over again.
 
Level 17
Joined
Sep 26, 2009
Messages
2,057
I made a test map with the spell and uploaded it here. You can check how I set up the dummy unit.

This is the actual trigger I used for the spell itself:
  • Mass Speed
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mass Speed
    • Actions
      • Set p = (Target point of ability being cast)
      • Unit - Create 1 dummy for (Owner of (Triggering unit)) at p facing Default building facing degrees
      • Set dummy = (Last created unit)
      • Unit - Add Speed to dummy
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 356.00 of p matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True))) and do (Actions)
        • Loop - Actions
          • Unit - Order dummy to Human Sorceress - Slow (Picked unit)
      • Unit - Remove dummy from the game
      • Custom script: call RemoveLocation(udg_p)

Of course the trigger can be more optimized by minimizing function calls, but that was not the point of why I made the trigger in the first place, so I skipped that in favor of simplicity for anyone reading this.
 

Attachments

  • MassSpeed.w3x
    18.4 KB · Views: 33
Level 17
Joined
Sep 26, 2009
Messages
2,057
What if I cast other spells at the same time? Would it cause lag? Because since a lot of spells will use the same variables?
No, it won't cause lag. Triggers are executed in sequence, never together (although it may seem they are fired together, one is executed e.g. 0.01 second later than the other). If you use temporal variables correctly (= by saving important values only for that one trigger's execution, not for any period of time in which other trigger executes) you will be fine.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
What if I cast other spells at the same time? Would it cause lag? Because since a lot of spells will use the same variables?
Using the same variables doesnt matter for it... in fact it is even better because the variables are still saved between the casting of spells.
When using the same variables, you replace that data every time.
When you use unique variables for each spell, you will have all that data for each spell... thus more unused data while playing.

Yeah it worked. :)
Sorry, didn't saw his post.
I still recommend you to put the filter inside the loop.
When doing that, the spell is easier to modify and you can copy/paste for other similar spells (with different filters).
 
Top