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

[General] Unit Attachments

Status
Not open for further replies.
Level 5
Joined
Dec 12, 2011
Messages
116
Question 1. I have a custom buff based on the Slow buff. I want the buff to create two attachments. Instead of creating the Slow attachment, I want it to create the Slow <Target> and the Drain Life & Mana (Caster) <Target> effects. But I can't make it work.

Question 2. I have a custom buff based on the Endurance Aura buff. I have an ability based on Endurance Aura (Neutral Hostile). In that ability I changed the default buff to my custom buff. I give my hero that ability (through a disabled spellbook). I can see the buff through the Status of my unit, but I don't see any attachments...

Question 3. I've noticed that many non-custom buffs come with an attachment model set, but no attachment point string and quantity of attachments set to 0... And the attachment still appears? Why this occurs? Can I conclude that I don't need to set the quantity of attachments to 1 nor the attachment point to origin?? This is weird, do you agree?

Take a look in the image I attached to the post, from the default Immolation buff.

hamsterpellet
 

Attachments

  • immo_buff.jpg
    immo_buff.jpg
    20.2 KB · Views: 68
Level 11
Joined
Jul 9, 2009
Messages
927
For question no.2

You should edit the Art Attachments, in the buff not the ability

1st
Art - Target
Choose the attachment/Aura/Buff you want the model to have. (You can only have one attachment per buff)

2nd
Art - Target Attachment Point
Choose where the Attachment/Aura/Buff should be placed. (Learn more about attachment points here)

3rd
Art - Target Attachments
You can attach the attachment/Aura/Buff to 6 places in one buff. Type in the desired number of attachment spots you used.

Finally
Change the buff for your skill. Your done :D
 
Level 5
Joined
Dec 12, 2011
Messages
116
It already is as you said.
Didn't worked...

EDIT: Also, for my question 1, I thought it was answered, but I was wrong. I don't want my unit to show two buffs in it's status just because of that...
 
Last edited:
Level 11
Joined
Jul 9, 2009
Messages
927
maybe there is something wrong with your attachment points. Check that you have wrote the right spelling. :D
 
Level 5
Joined
Dec 12, 2011
Messages
116
Yeah, I gave up of configuring the attachments at the buff. I decided to use a trigger action to create a special effect... I needed hashtables. This is my first use of hashtables. Please take a look in my code, I want to know if I managed all leaks correctly.

  • MySkill Hashtable Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set MySkillHashTable = (Last created hashtable)
  • MySkill Activate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to MySkill Turn On
    • Actions
      • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Other\Drain\DrainCaster.mdl
      • Hashtable - Save Handle Of(Last created special effect) as 0 of (Key (Triggering unit)) in MySkillHashTable
  • MySkill Deactivate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to MySkill Turn Off
    • Actions
      • Special Effect - Destroy (Load 0 of (Key (Triggering unit)) in MySkillHashTable)
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in MySkillHashTable
EDIT: Argh, I will change this to Triggers & Scripts section. Sorry All!

hamsterpellet
 
Forum it's fine, we are creating something, not fixing it in general.

I suggest jass, because using hashtables in gui is just a little problematic and way to slow.

  • MySkill Hashtable Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
look like this, when we convert it into jass (WE do this when you save map):
JASS:
function Trig_MySkill_Hashtable_Initialization_Actions takes nothing returns nothing
    call InitHashtableBJ(  )
    set udg_Hash = GetLastCreatedHashtableBJ()
endfunction

//===========================================================================
function InitTrig_MySkill_Hashtable_Initialization takes nothing returns nothing
    set gg_trg_MySkill_Hashtable_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_MySkill_Hashtable_Initialization, function Trig_MySkill_Hashtable_Initialization_Actions )
endfunction
Red functions look like this:
JASS:
function InitHashtableBJ takes nothing returns hashtable
    set bj_lastCreatedHashtable = InitHashtable()
    return bj_lastCreatedHashtable
endfunction

function GetLastCreatedHashtableBJ takes nothing returns hashtable
    return bj_lastCreatedHashtable
endfunction
Now this look horrible indeed, so when you create that simple code just like you did with GUI, it will call few functions to do something, bla bla bla...
This is OK, it WORKS, but there is way to do it better.
If you work on 2 player maps or something small GUI is maybe even better than jass because you will do things faster, thrust me I code both.
But for huge projects where you have 10 powerful systems running in background, optimization is everything.
Finally we come into this:
JASS:
function Trig_MySkill_Hashtable_Initialization_Actions takes nothing returns nothing
    set udg_Hash = InitHashtable()
endfunction

//===========================================================================
function InitTrig_MySkill_Hashtable_Initialization takes nothing returns nothing
    set gg_trg_MySkill_Hashtable_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_MySkill_Hashtable_Initialization, function Trig_MySkill_Hashtable_Initialization_Actions )
endfunction
or in GUI shape
  • MySkill Hashtable Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_Hash = InitHashtable()
I hope this helps a little.
You must understand that even that things converted, trigger setup etc etc can be optimized as well, but I would like to show you how you can use jass in GUI (advanced GUI :razz:).

I won't explain all your triggers below, you should do some research, I just hope that I made jass interesting to you :)

Anyway here is answer.
It won't leak, but it's slow, especially because we use hashtables.
Also use father for saving unit handle, then you can save few thing like child objects (1 can be effect, 2 can be it's level, 3 can be bounty awarded etc etc).
 
Level 5
Joined
Dec 12, 2011
Messages
116
Yeah, I've heard that BJs are werid and horrible... Yes, I see...

I just hope that I made jass interesting to you :)

Sure! Thanks!

Anyway here is answer.
It won't leak, but it's slow, especially because we use hashtables.
Also use father for saving unit handle, then you can save few thing like child objects (1 can be effect, 2 can be it's level, 3 can be bounty awarded etc etc).

I see! Thank you again...

EDIT

Let's proceed with my questions...

Question 1 and question 3 weren't solved yet...
Question 1 I thought it was solved but I realized that I don't want two buffs showing in the Status bar of my units, just because of another attachment.
 
Status
Not open for further replies.
Top