Looking for guidance on one spell

LearningCode

New Member
Reaction score
24
Okay, I'm trying to make a spell, but there are parts that I don't really know how to accomplish.

Part 1 of spell:
1) Hero casts spell (Some spirit ball spell)
2) Spell creates dummy (shrunken down wisp)
3) Dummy has a random aura (Anything from Speed to damage to healing aura)
4) Dummy does not do anything, just follows caster indefinitely (AKA forever)

Part 2 of spell Part. A:
1) Hero casts a different spell (Some attacking spell)
2) Trigger checks if Hero has 3 dummies
3) Oldest 3 dummies are removed from game
4) Trigger activates some awesome spell

Part 2 of spell Part. B:
1) Hero casts another spell (Some healing spell)
2) Trigger checks if Hero has 1 dummy
3) Oldest dummy is removed from the game
4) Heal activates

The bold parts are the parts I have no idea on how to do =/
 

LearningCode

New Member
Reaction score
24
Umm..
Err..
Wha- ?

Wait-
I've never done it before xD
I do it using SetUnitUserData, right?

Do I use [lJASS]struct[/lJASS] or [lJASS]private struct[/lJASS]?
How would the triggers of the other 2 spells use the struct in the "Some Spirit ball spell"
 

LearningCode

New Member
Reaction score
24
Okay, already done the "heavy" parts, I think..
If I want to access the struct attached to the unit..

I just use[lJASS] local <structname> <something> = GetUnitUserData(<unit>)[/lJASS], right? o.0

Then, after I do that, I can call any method within the struct?
Once I am done with the spell..

How do I, like, keep the variables?
Erm..
If the method called changes the value of an integer "SpiritNumber" to 3
Will the value of SpiritNumber be automatically saved?

Like, I don't have to use [lJASS]call SetUnitUserData(blah, blah)[/lJASS] again, right?
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Will the value of SpiritNumber be automatically saved?
Remember this in mind. Struct is actually integer. Members in it are globals with array.
When you allocate a struct index, that means you get an free unused index. When you set it's members' value, it basically is setting globals variables..

JASS:
struct Data
    integer int
endstruct

    //Set value :
    set &lt;vars&gt;.int = 5


When converted into Jass :
JASS:
globals
    integer Data_int
endglobals

function Data__allocate takes nothing returns integer
    //return new index/recycled index.
endfunction

function Data__deallocate takes integer this returns nothing
   //recycle the index
endfunction
  
   //Set value :
   set Data_int[&lt;vars&gt;] = 5
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top