• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Spell - Castime - Attachments?

Status
Not open for further replies.
Level 3
Joined
Jan 10, 2012
Messages
31
I'm really curious, so is there a way to add an attachment to a unit while the are casting a spell that has castime of say 3 seconds, so during that time they'll have an attachment? and after the spell is cast the attachments go away till "Channeling - Casting" again?
 
Level 25
Joined
Sep 26, 2009
Messages
2,405
If you mean the basic "Casting Time" field all abilities have, then yes, it can be done.

You will need 2 triggers for this. I made example triggers that add the "Bloodlust" effect when unit starts the cast time of Heal ability.
  • Heal Efx
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Heal
    • Actions
      • Special Effect - Create a special effect attached to the hand left of (Triggering unit) using Abilities\Spells\Orc\Bloodlust\BloodlustTarget.mdl
      • Set efx_L = (Last created special effect)
      • Special Effect - Create a special effect attached to the hand right of (Triggering unit) using Abilities\Spells\Orc\Bloodlust\BloodlustTarget.mdl
      • Set efx_R = (Last created special effect)
This one creates special effect on left and right hand when the unit starts channeling the ability = when it initiates the casting time of an ability.



  • Heal Efx Delete
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Heal
    • Actions
      • Special Effect - Destroy efx_L
      • Special Effect - Destroy efx_R
A second trigger is of course needed to delete those special effects.
Atm, this only supports 1 unit. If you want this for more units, you will have to learn (de)indexing and using arrays.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
In the object editor:
Art - Caster = model file
Art - Caster Attachment Point 1 = attachpoint
Art - Caster Attachment Point 1 = attachpoint
 
Level 3
Joined
Jan 10, 2012
Messages
31
Ok, using MUI how do I reference the unit and the specific attachments? specifically, like get unit from integer Spellcastingunits and then remove the attachments from the unit, or even get the right attachments to destroy?
 
Level 25
Joined
Sep 26, 2009
Messages
2,405
That will only work for 1 unit won't it Nich? and Chobibo that didn't work already tried that :/
Yes, the trigger I posted is for 1 unit only (I made it more like to emphasize that it can be done).
Like Rheiko and I wrote in our posts, if you want that to support multiple units, you will need to (de)index that.


Ok, using MUI how do I reference the unit and the specific attachments? specifically, like get unit from integer Spellcastingunits and then remove the attachments from the unit, or even get the right attachments to destroy?
You can do it like this:
  • Efx Add
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Your_Ability
    • Actions
      • -------- Increase index --------
      • Set efx_index = (efx_index + 1)
      • -------- ------------------------------------------------------------------------------------ --------
      • -------- ------------------------------------------------------------------------------------ --------
      • -------- ------------------------------------------------------------------------------------ --------
      • -------- Index triggering unit and attach and index special effects --------
      • Set efx_unit[efx_index] = (Triggering unit)
      • Special Effect - Create a special effect attached to the hand left of efx_unit[efx_index] using Abilities\Spells\Orc\Bloodlust\BloodlustTarget.mdl
      • Set efx_L[efx_index] = (Last created special effect)
      • Special Effect - Create a special effect attached to the hand right of efx_unit[efx_index] using Abilities\Spells\Orc\Bloodlust\BloodlustTarget.mdl
      • Set efx_R[efx_index] = (Last created special effect)

  • Efx Delete
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Your_Ability
    • Actions
      • Set unit = (Triggering unit)
      • -------- ------------------------------------------------------------------------------------ --------
      • -------- ------------------------------------------------------------------------------------ --------
      • -------- ------------------------------------------------------------------------------------ --------
      • -------- Loop through each indexed unit to find out if the triggering unit "unit" is the currently looped efx_unit --------
      • For each (Integer LoopInt) from 1 to efx_index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • unit Equal to efx_unit[LoopInt]
            • Then - Actions
              • -------- Found our unit, destroy its special effects --------
              • Special Effect - Destroy efx_L[LoopInt]
              • Special Effect - Destroy efx_R[LoopInt]
              • -------- ------------------------------------------------------------------------------------ --------
              • -------- ------------------------------------------------------------------------------------ --------
              • -------- ------------------------------------------------------------------------------------ --------
              • -------- Now deindex here by moving the last indexed unit/effects into this now empty slot --------
              • Set efx_unit[LoopInt] = efx_unit[efx_index]
              • Set efx_L[LoopInt] = efx_L[efx_index]
              • Set efx_R[LoopInt] = efx_R[efx_index]
              • -------- ------------------------------------------------------------------------------------ --------
              • -------- ------------------------------------------------------------------------------------ --------
              • -------- ------------------------------------------------------------------------------------ --------
              • -------- Nulls last indexed unit/effects --------
              • Set efx_unit[efx_index] = No unit
              • Custom script: set udg_efx_L[udg_efx_index] = null
              • Custom script: set udg_efx_R[udg_efx_index] = null
              • -------- ------------------------------------------------------------------------------------ --------
              • -------- ------------------------------------------------------------------------------------ --------
              • -------- Decrease total index --------
              • Set efx_index = (efx_index - 1)
              • -------- ------------------------------------------------------------------------------------ --------
              • -------- ------------------------------------------------------------------------------------ --------
              • -------- ------------------------------------------------------------------------------------ --------
              • -------- End loop, since the triggering unit has been found --------
              • Set LoopInt = efx_index
            • Else - Actions
      • Set unit = No unit
Legend

unit = temp unit variable
LoopInt = integer variable used in Loops only
efx_index = integer variable
efx_unit = unit array variable
efx_L = special effect array variable
efx_R = special effect array variable
 
Level 3
Joined
Jan 10, 2012
Messages
31
Awwwh, darn it, still didn't work 100%, if 2 units were casting the spell, even at different times it would bug out :/ and by bug out I mean only 1 attachment was removed from the second unit to cast and the first unit it removed both effects
 
Level 25
Joined
Sep 26, 2009
Messages
2,405
You must've set something wrong (probably when deindexing or something) since I tested that trigger with 5 priests and their Heal ability casting it at around the same time before posting it here and it worked just fine.
 
Status
Not open for further replies.
Top