Custom Spell Help - Fan of Knives with Slow Poison

Level 3
Joined
Jan 18, 2014
Messages
27
Aloha once again!

So I'm currently trying to develop a custom spell for a unit which I plan to be almost exactly like the Warden's Fan of Knives spell, only I want it to infect all hit targets with the slow poison buff.

After doing some research on how to attach buffs to units by giving them an ability (with the use of triggers) I've hit a road block. It seems no matter what I do I cannot get the ability carrying the slow poison buff to attach to enemy units in the cast range.

Instead the ability is given to the hero casting the spell. The triggers I'm using for this at the moment are:

  • Map Initialization
    • Unit Group - Pick every unit in (Units owned by Player 2 (Blue)) and do (Actions)
      • Loop - (Actions)
        • Unit Group - Add (Picked unit) to UG_Enemies
  • Unit - A unit Begins casting an ability
    • Ability Comparison - (Ability being cast) Equal to Fan of Infection
      • Unit Group - Pick every unit in (UG_Enemies) and do (Actions)
        • Loop - (Actions)
          • Unit Group - Pick every unit in (Units within 10 of (Position of (Casting unit)) matching ((Picked unit) Equal to (Random unit from UG_Enemies))) and do (Unit - Add Infected to (Picked unit))
    • Wait 1.00 seconds
    • Unit - Remove Infected from (Picked unit)
Infected is the ability I'm trying to give to the enemy units that will bestow slow poison on them (I used command aura, changing the buff to slow poison and so it could only affect the unit with the ability).

If you think you might be able to help me I would be very grateful for any advice.
 
Last edited:
Actions;
  • Set TempUnit = Triggering Unit
  • Set TempPoint = Position of TempUnit
  • Unit - Create 1 Dummy at for Triggering Player at TempPoint facing 0.00 degrees
  • Set TempUnit2 = Last created unit
  • Unit - Add 1.0 second expiration timer to TempUnit2
  • Unit - Add Dummy Ability to TempUnit2
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in 400 of TempPoint matching (Matching Unit is an enemy of Triggering Player) and ((Matching Unit is a structure equal to false) and Matching Unit is alive equal to true))
    • Loop
    • Unit - Order TempUnit2 to <use ability> on Picked Unit
  • Custom script: call RemoveLocation(udg_TempPoint)
  • Custom script: set udg_TempPoint = null
  • Custom script: set udg_TempUnit = null
  • Custom script: set udg_TempUnit2 = null
 
Last edited:
Level 3
Joined
Jan 18, 2014
Messages
27
Having a slight noob issue: I can't find the comparison for "Matching unit is an enemy of Triggering Player"
 
Boolean -> Unit is an enemy

Oh, and please do not double post. Use the
edit.gif
button instead.
 
Level 3
Joined
Jan 18, 2014
Messages
27
Brilliant, thanks.
Yeah my bad with that one, apologies.

I'm actually having another problem here (sorry, still working out some of the WE kinks). The trigger is becoming disabled because of the custom script section here:

  • Custom script: set bj_wantDestroyGroup = true
It expects me to input a variable name, would that be the group I specified (UG_Enemies), or another group?
 

Bannar

Code Reviewer
Level 24
Joined
Mar 19, 2008
Messages
3,136
It is a boolean variable declared as: boolean bj_wantDestroyGroup = false.
while the Pick (...) statement is expressed via:
JASS:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
endfunction
As you can see, this boolean allows us to clear the group automatically preventing any leaks as a result.
 
Level 3
Joined
Jan 18, 2014
Messages
27
Sure no worries. Here it is:

  • Unit - A unit Begins casting an ability
    • (Ability being cast) Equal to Fan of Infection
      • Set U_TempUnit = Triggering unit)
      • Set PT_InfectCastPosition = (Position of U_TempUnit)
      • Unit - Create 1 Infection Casters for (Triggering player) at PT_InfectCast Position facing 0.00 degrees
      • Set U_InfectionCaster = (Last created unit)
      • Unit - Add a 1.00 second Generic expiration timer to U_InfectionCaster
      • Unit - Add Poison Arrows to U_InfectionCaster
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 400.00 of PT_InfectCastPosition matching (((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)
        • Loop - Actions
          • Unit - Order U_InfectionCaster to Neutral - Poison Arrows (Picked unit)
      • Custom script: call RemoveLocation(udg_PT_InfectCastPosition)
      • Custom script: set udg_PT_InfectCastPosition = null
      • Custom script: set udg_U_TempUnit = null
      • Custom script: set udg_U_InfectionCaster = null
 
Last edited:
Level 3
Joined
Jan 18, 2014
Messages
27
Only just seen Bannar's reply actually. I'll have a go with the JASS and let you know if that's cleared things up.
- EDIT: Just realised I don't know anything about even inputting JASS code. How're we doing this?

Alright, I'll use Temps and ditch the underscores.

Damn I feel like a noob right now.
 

Bannar

Code Reviewer
Level 24
Joined
Mar 19, 2008
Messages
3,136
You don't have to write this in jass in order to get it work. I've just shown you how things look behind the scenes so you actually know why CakeMaster even used bj_wantDestroyGroup. It's better for you to understand the low level code.

  • Custom script: set_udg_U_TempUnit = null
remove the underline "_" between set and udg. Btw, could you post the error you get? Surely it's not about bj_wantDestroyGroup.
 
Level 3
Joined
Jan 18, 2014
Messages
27
Eagle eyes indeed! That shouldn't be there, sorry. The underscore isn't actually there, I'll edit that.

This is a print screen of what I'm getting (JPEG):

ERROR.jpg

I've cleared up the variables, got rid of all the underscores. Still disabling itself.
 

Bannar

Code Reviewer
Level 24
Joined
Mar 19, 2008
Messages
3,136
Code:
 ^ ^    ^ ^
(>.>)  (<.<)
(  ))  ((  )

o, rly? ya, rly

Have you just pasted declaration of a function into script code? :p
If you want to use a function, you invoke it via: call <function name> ( <function arguments> ). In this case it's: call ForGroupBJ( myGroup, function myCode ).

However, you do not need to do that. Let's stay with triggers in your case. Show me your whole trigger including events and conditions. How to easily post triggers.
 
Level 3
Joined
Jan 18, 2014
Messages
27
I haven't done that. Should that be something I should do then or no?

Here's the trigger as it stands.

  • Events
    • Unit - Unit Begins casting an ability
  • Conditions
    • Ability Comparison - (Ability being cast) Equal to Fan of Infection
  • Actions
    • Set TempUnit = (Triggering Unit)
    • Set TempInfectCastPosition = (Position of TempUnit)
    • Unit - Create 1 Infection Casters for (Triggering Player) at TempInfectCastPosition facing 0.00 degrees
    • Set TempInfectionCaster = (Last created unit)
    • Unit - Add 1.0 second Generic expiration timer to TempInfectionCaster
    • Unit - Add Poison Arrows to TempInfectionCaster
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in 400 of TempInfectCastPosition matching ((((Matching Unit) is an enemy of Player 1 (Red)) Equal to True) and ((((Matching Unit is A structure) Equal to False) and (((Matching Unit) is alive) Equal to True))
      • Loop - Actions
        • Unit - Order TempInfectionCaster to Neutral - Poison Arrows on (Picked Unit)
    • Custom script: call RemoveLocation(udg_TempInfectCastPosition)
    • Custom script: set udg_TempInfectCastPosition = null
    • Custom script: set udg_TempUnit = null
    • Custom script: set udg_TempInfectionCaster = null
 
Level 3
Joined
Jan 18, 2014
Messages
27
Yeah. Ah that's concerning.

I'm wondering if it might be because I've got a fair bit of custom data in.

Sure here it is, it's just a testing map anyway so there's nothing else going on in there really.

View attachment Testing Map.w3x
 

Bannar

Code Reviewer
Level 24
Joined
Mar 19, 2008
Messages
3,136
Test map saves fine for me. You can turn on that trigger. In regard to spell - your dummy unit should have Locust and Invurneable abilities. The spell which you are adding (within trigger) to that dummy needs to be an Unit Ability, not a Hero Ability. Make sure that spell you're adding has no mana cost as well as no requirements.
 
Level 3
Joined
Jan 18, 2014
Messages
27
It's amazing how many things can be solved with just saving and rebooting WE. The trigger's not disabling now, so that's fine.

I've set the ability (Neutral - Poison Arrows) to a unit ability now instead of a hero ability, and the mana cost is zero, but I'm still having issues (spell is still not being cast on the enemies).

Is this an issue with the ability having to be learned perhaps?
 
Level 3
Joined
Jan 18, 2014
Messages
27
I have done yeah, only saw your reply after posting mine.

Still nothing, but I haven't given the units' locust yet.

I'm assuming that'll have to be changed into a unit ability, but will it need to be set as default active?
 

Bannar

Code Reviewer
Level 24
Joined
Mar 19, 2008
Messages
3,136
At first, Poisoned Arrows is attack-oriented ability i.e attack enchancer. You have disabled attacks for your dummy unit. Second, ordering unit to attack multiple targets within such short period will result in unit actually attacking just one, the last found target.

What you should do instead: base your dummy ability of Shadow Strike or something similar what does not require unit to attack a target but rather cast a spell on target.
 
Level 3
Joined
Jan 18, 2014
Messages
27
Cracking, I've done all of that (and changed the base ability to shadow strike) and there now at least some casting going on, but it is as Bannar said only casting on one unit.

Is there a way of getting all the enemy units to contract the buff?

EDIT: By all I mean those in range.
 
Last edited:

Bannar

Code Reviewer
Level 24
Joined
Mar 19, 2008
Messages
3,136
Thats why I use furbolg's hut as a base for most dummies - 0 casting point, almost everything is set how I want it to be. With such dummies, you can cast plenty of abilities regarless of amount of targets found. Currently, dummies which are based on unit-type you've chosen, have to perform casting animation which prevents them from casting multiple spells within short period of time.
 
Level 3
Joined
Jan 18, 2014
Messages
27
I've checked the backswing and animation points and set them all to zero. Didn't change anything, so I tried altering the unit type I've based it on so it had no cast animation/time (changed it to a Tent).

Still no change. I think it could be, as you've said CakeMaster, the true cast time of Shadow Strike.

I'll post the map as it is at the moment as I'm going to have to leave any more edits till tomorrow.

View attachment Testing Map.w3x
 
Level 3
Joined
Jan 18, 2014
Messages
27
I found an alternative solution to this issue!

Instead of using an invisible dummy unit, I've changed the unit to a Disease Cloud and altered the Mountain King's Thunder Clap ability so it can be given to and used by the Disease Cloud.

It works a treat, giving a lasting poison effect and slowing units close to the warden for a short time.

Here's what it looks like if you're still curious to see, the only edits' I will make to this will probably just be to change the names and icons for the spells/buffs so it's more tailored to the Corrupt Warden unit I'm creating:

View attachment Fan of Corruption Test Map (Disease Cloud & Thunder Clap Edit).w3x

Thank you both (Bannar & CakeMaster) so much for your help with this problem, I've learnt a lot just from this little issue.

Felt pretty boss when this came to me :ogre_datass:

(Sorry for the double posting but it seemed like this would read easier as a separate reply).
 
Last edited:
Top