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

Unit group

Status
Not open for further replies.
I was making a spell but for some reason the unit isn't picked correctly. Here is the problem:

  • Arcane pulse spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane pulse
    • Actions
      • Unit Group - Add (Casting unit) to gArcanePulse[0]
  • Arcane pulse loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in gArcanePulse[0] and do (Actions)
        • Loop - Actions
          • Unit - Kill (Picked unit)
I know theres leaks and stuff but the main problem is that the caster doesn't die and yes I'm 110% sure that the correct ability is being cast. Please help
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Try creating the group beforehand - when you destroy a group, and later add units to that group, then you basically add unit to no group.

To create the group again use line like this:
  • Set UnitGroup[0] = (Units in No region)
Now you have group that contains no units.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
casting unit is not correct as it should not be used. casting unit calls triggering unit. so instead just use triggering unit.
It is correct in the sense that it calls the correct unit (the one that used the spell), however it is less efficient than triggering unit for the reasons you wrote.

Why I pointed that out is because even though changing (casting unit) to (triggering unit) is better, it does not solve his problem.


Thanks for the tip :) So when is casting unit a better option?

I've added this under map inst.:
  • Set gArcanePulse[0] = (Units in No region)
yet nothing happens
Look at it this way: You have a unit group (a room for units). You destroy that group via custom script to prevent leak. So now there is no unit group (e.g. you destroyed that room).
Now you logically can't add another units to the same group, because you destroyed that group - the group is there no longer (you have no room).
The "add unit to unit group" adds unit to already existing group! It does not create new group!

The "set unit_group_variable = (units in region)" creates a new empty group. This
  • Set gArcanePulse[0] = (Units in No region)
does basically the same thing as what Death posted - it creates an empty group. So now you have your group and you are free to add new units there.

But
If you destroy that group, you will need to create it anew. Doing it once at map initialization won't be enough.

Basically: If you want to add units to unit group, make sure you did not destroy that group. If you did destroy it, you have to create that unit group anew

-------
Also, I've made myself a test map, where I created the exact copies of your 2 triggers in the first post. Triggers worked. So if the stuff with unit group does not help, you have problem in your other triggers and should try debug messages.
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,993
Ok tell me one thing, are your triggers currently like this?
  • Arcane pulse spell
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Arcane pulse
  • Actions
    • Unit Group - Add (Casting unit) to gArcanePulse[0]
  • Arcane pulse loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in gArcanePulse[0] and do (Actions)
    • Loop - Actions
      • Unit - Kill (Picked unit)
Edit: also why the hell you don't make this in 1 trigger? Isn't the spell complete? Then what would be the spell like?
 
Ok tell me one thing, are your triggers currently like this?
  • Arcane pulse spell
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Arcane pulse
  • Actions
    • Unit Group - Add (Casting unit) to gArcanePulse[0]
  • Arcane pulse loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in gArcanePulse[0] and do (Actions)
    • Loop - Actions
      • Unit - Kill (Picked unit)
Edit: also why the hell you don't make this in 1 trigger? Isn't the spell complete? Then what would be the spell like?

It's far from complete. The perpose of the trigger was not to kill the caster, it's purpose was to get the caster in the arcane pulse group. If the caster doesn't die, it means that he is not in the group. It looks currently like this:
  • Arcane pulse spell Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane pulse
    • Actions
      • Hashtable - Save 200 as 3 of (Key (Triggering unit)) in HashHpLoss
      • Unit Group - Add (Triggering unit) to gArcanePulse[0]
  • Arcane pulse loop Copy
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in gArcanePulse[0] and do (Actions)
        • Loop - Actions
          • Set Temp_Int = (Load 3 of (Key (Picked unit)) from HashHpLoss)
          • Unit - Set mana of (Picked unit) to (Real(Temp_Int))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (((Temp_Int Equal to 20) or (Temp_Int Equal to 40)) or ((Temp_Int Equal to 60) or (Temp_Int Equal to 80))) or (((Temp_Int Equal to 100) or (Temp_Int Equal to 120)) or (((Temp_Int Equal to 140) or (Temp_Int Equal to 160)) or ((Temp_Int Equal to 180) or (Temp_Int Equal to 200))))
            • Then - Actions
              • Set Temp_Unit = (Picked unit)
              • Special Effect - Create a special effect attached to the chest of Temp_Unit using Abilities\Spells\Human\Avatar\AvatarCaster.mdl
              • Set Temp_Goup = (Units within 450.00 of (Position of (Picked unit)))
              • Unit Group - Pick every unit in Temp_Goup and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Owner of (Picked unit)) is an enemy of (Owner of Temp_Unit)) Equal to True
                    • Then - Actions
                      • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - ((Max mana of (Picked unit)) x 0.90))
                    • Else - Actions
            • Else - Actions
          • Hashtable - Save (Temp_Int - 1) as 3 of (Key (Picked unit)) in HashHpLoss
Releases acrane energy every 0.75 seconds that reduces the mana of nearby enemy units by 9%. It also spreads hitpoints equal to 40% of the caster's intelegence to nearby allies. Releases 10 pulses.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
It's far from complete. The perpose of the trigger was not to kill the caster, it's purpose was to get the caster in the arcane pulse group. If the caster doesn't die, it means that he is not in the group. It looks currently like this:
*trigger*

What you have there atm is quite messed up to be honest.

This is what you want:
Releases acrane energy every 0.75 seconds that reduces the mana of nearby enemy units by 9%. It also spreads hitpoints equal to 40% of the caster's intelegence to nearby allies. Releases 10 pulses.

But this is what you have:
The loop trigger fires every 0.5 second, the mana draining effect fires every 10 seconds, the spell lasts 100 seconds.
If the spell's mana cost is for example 120 and the caster has 1000 mana, upon using this spell his mana will suddenly drop to 200 and will be periodically reduced to 0.
The spell's mana reducing effect drains 90% mana instead of 9%.

I'm not really sure why you save value 200 and let everything depend on it - all you would need is to index the caster and save integer value equal to number of ticks remaining.

Also - you currently use unit group array, but I don't really see you using that array for more than 1 group. Try changing the gArcanePulse[0] group for a regular non-array unit group and see if problems persist.
A dumb question - Do you even create HashHpLoss hashtable?
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,993
Is the group already made ? if not try in a map initializer trigger to do this.
  • Custom script: set udg_urGroup = CreateGroup()
To be honest, that is completly useless:
JASS:
//***************************************************************************
//*
//*  Global Variables
//*
//***************************************************************************

globals
    // User-defined
    group                   udg_Group                  = null

    // Generated
    trigger                 gg_trg_Test                = null
endglobals

function InitGlobals takes nothing returns nothing
    set udg_Group = CreateGroup()
endfunction

function Trig_Test_Actions takes nothing returns nothing
    Test
endfunction
@ NightSkyAurora: I don't understand what is wrong with your triggers, at top.
 
the thing u set in the variable is the initiated variables. so when u put in 1 u initiate array[0] and array[1]
it doesnt mean thats the max allowed for that index.

i have a chapter how to index in my tutorial. there is also a chapter that deals with the variable editor and about what everything means in there

o_O Ohh, I've always thought that it is the max allowed number.

It's still incomplete but am I on the correct track?
  • Arcane pulse spell Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane pulse
    • Actions
      • Set iArcanePulseIndex = (iArcanePulseIndex + 1)
      • Set uArcaneNovaC[iArcanePulseIndex] = (Triggering unit)
      • Set iPulseCount[iArcanePulseIndex] = 10
      • Unit Group - Add (Triggering unit) to gArcanePulse[0]
  • Arcane pulse loop Copy
    • Events
      • Time - Every 0.75 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to iArcanePulseIndex, do (Actions)
        • Loop - Actions
          • Set Temp_Goup = (Units within 450.00 of (Position of uArcaneNovaC[Temp_Int]) matching (((Owner of (Matching unit)) is an enemy of (Owner of uArcaneNovaC[Temp_Int])) Equal to True))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - ((Max mana of (Picked unit)) x 0.09))
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
EDIT: Yup I made that costom script afterwards. I think the problem was in the world editor itself or maby my pc. After a copy and paste it worked just fine.
I didn't start with jass yet. still learning GUI though
 
Ok got it!
[hidden="trigger]
  • Arcane pulse loop Copy
    • Events
      • Time - Every 0.75 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to iArcanePulseIndex, do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of uArcaneNovaC[Temp_Int])
          • Set Temp_Goup = (Units within 450.00 of Temp_Point matching (((Owner of (Matching unit)) is an enemy of (Owner of uArcaneNovaC[Temp_Int])) Equal to True))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - ((Max mana of (Picked unit)) x 0.09))
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Set Temp_Goup = (Units within 450.00 of Temp_Point matching (((Owner of (Matching unit)) is an ally of (Owner of uArcaneNovaC[Temp_Int])) Equal to True))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (((Real((Intelligence of uArcaneNovaC[Temp_Int] (Include bonuses)))) x 0.40) / (Real((Number of units in Temp_Goup)))))
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Custom script: call DestroyLocation[udg_Temp_Point]
[/hidden]
I know custom scrips is jass but I can't code from a blank page in jass only
 
this should be stored into a temp variable. (Owner of uArcaneNovaC[Temp_Int]))
y do u make 2 of the exact same loops ? instead put all the actions in one group.

anything u use twice or more store into a variable. so store picked unit also.

this should give u error
  • Custom script: call DestroyLocation[udg_Temp_Point]
it should be () not []

@ wrda
groups are created at start yes. but if it was deleted or if u use index 2 or higher and set the initialized index in the variable editor to 1 then index 2 would never be created. thats y i said try it. ive seen it many times were someone adds units to a group then destroys it and asks y it wont work when they add a new unit to the group
 
I remember to test that^^ it looks like a bug, you can't add units to the group when it is destroyed but you can set the group via set variable, looks a bit weird.

its not a bug. its because GUI doesnt have a create group option. the only way to create a group in GUI is use set tempGroup = units in range matching condition action.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
It's not a bug, nor is it weird.
"Set UnitGroup = Parameters for unit group"
What I wrote above creates unit group and those parameters define what unit group you are creating/what the unit group consists of.
If you do this:
  • ...actions
  • Set Group[0] = (Units in (Playable map area))
  • Set Group[0] = (Units within 512.00 of (Center of (Playable map area)))
  • ... other actions...
then you created 2 unit groups - the first one will create a permanent leak because you have no way to call to that group.

"Add unit to unit group" adds unit to already existing unit group. As I wrote few posts earlier, you cannot add units to destroyed/non-existant group. Or in a sense you can - but you basically add those units to <null> group.
 
The loops is not the same. One is for the enemies and the other for allies.

  • Arcane pulse loop Copy
    • Events
      • Time - Every 0.75 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to iArcanePulseIndex, do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of uArcaneNovaC[Temp_Int])
          • Set Temp_Player = (Owner of uArcaneNovaC[Temp_Int])
          • Set Temp_Goup = (Units within 450.00 of Temp_Point matching (((Owner of (Matching unit)) is an enemy of Temp_Player) Equal to True))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - ((Max mana of (Picked unit)) x 0.09))
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Set Temp_Goup = (Units within 450.00 of Temp_Point matching (((Owner of (Matching unit)) is an ally of Temp_Player) Equal to True))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (((Real((Intelligence of uArcaneNovaC[Temp_Int] (Include bonuses)))) x 0.40) / (Real((Number of units in Temp_Goup)))))
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Custom script: call RemoveLocation(udg_Temp_Point)
I got the error when I saved but it's fixed now, thanks.
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,993
its not a bug. its because GUI doesnt have a create group option. the only way to create a group in GUI is use set tempGroup = units in range matching condition action.
I know. I had that conclusion years ago.

It's not a bug, nor is it weird.
"Set UnitGroup = Parameters for unit group"
What I wrote above creates unit group and those parameters define what unit group you are creating/what the unit group consists of.
If you do this:
  • ...actions
  • Set Group[0] = (Units in (Playable map area))
  • Set Group[0] = (Units within 512.00 of (Center of (Playable map area)))
  • ... other actions...
then you created 2 unit groups - the first one will create a permanent leak because you have no way to call to that group.

"Add unit to unit group" adds unit to already existing unit group. As I wrote few posts earlier, you cannot add units to destroyed/non-existant group. Or in a sense you can - but you basically add those units to <null> group.
I'm not stupid... anyway thanks for wasting your time reminding me.
@NightSkyAurora
store (Picked Unit) into a variable, makes it faster and more efficient.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
In your "Arcane Pulse Spell" trigger you still add unit to unit group "Unit Group - Add (Triggering unit) to gArcanePulse[0]" - is this needed for something? Previously you used it because you picked that unit and loaded hashtables. But now you index units, you don't need to use that unit group.

Also your loop trigger can be improved a bit - instead of creating 2 groups on the same spot, you can create only one group - you pick all units which are alive, are not the caster (unless you want the caster to heal himself through this spell) and are not neutral passive.
Then through If/Then/else you check if that picked unit is enemy - if yes, drain its mana; if not, heal it.

A side note - isn't it better in efficiency to calculate the heal amount before the unit group loop? You basically calculate the same thing for each allied unit in that group.
 
Gosh these vars and maths makes me crazy. I removed the group in the spell. The reason why I pick 2 groups in the loop is because at some point I will need to count the allies to know how much HP each can get. So I just heal them in the same group.

  • Arcane pulse loop Copy
    • Events
      • Time - Every 0.75 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to iArcanePulseIndex, do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of uArcaneNovaC[Temp_Int])
          • Set Temp_Player = (Owner of uArcaneNovaC[Temp_Int])
          • Set Temp_Goup = (Units within 450.00 of Temp_Point matching (((Owner of (Matching unit)) is an enemy of Temp_Player) Equal to True))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Set Temp_Unit = (Picked unit)
              • Unit - Set mana of Temp_Unit to ((Mana of Temp_Unit) - ((Max mana of Temp_Unit) x 0.09))
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Set Temp_Goup = (Units within 450.00 of Temp_Point matching (((Owner of (Matching unit)) is an ally of Temp_Player) Equal to True))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Set Temp_Unit = (Picked unit)
              • Set rHeal = (((Real((Intelligence of uArcaneNovaC[Temp_Int] (Include bonuses)))) x 0.40) / (Real((Number of units in Temp_Goup))))
              • Unit - Set life of Temp_Unit to ((Life of Temp_Unit) + rHeal)
              • Set rHeal = 0.00
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Custom script: call RemoveLocation(udg_Temp_Point)
 
Ok done but how should I count the allies in the group?

  • Arcane pulse loop Copy Copy
    • Events
      • Time - Every 0.75 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to iArcanePulseIndex, do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of uArcaneNovaC[Temp_Int])
          • Set Temp_Player = (Owner of uArcaneNovaC[Temp_Int])
          • Set Temp_Goup = (Units within 450.00 of Temp_Point matching ((((Triggering unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Set Temp_Unit = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Temp_Unit is A structure) Equal to False
                  • ((Owner of Temp_Unit) is an enemy of Temp_Player) Equal to True
                • Then - Actions
                  • Unit - Set mana of Temp_Unit to ((Mana of Temp_Unit) - ((Max mana of Temp_Unit) x 0.09))
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Triggering unit) is A structure) Equal to False
                  • ((Owner of Temp_Unit) is an ally of Temp_Player) Equal to True
                • Then - Actions
                  • Set rHeal = (((Real((Intelligence of uArcaneNovaC[Temp_Int] (Include bonuses)))) x 0.40) / (Real((Number of units in Temp_Goup))))
                  • Unit - Set life of Temp_Unit to ((Life of Temp_Unit) + rHeal)
                  • Set rHeal = 0.00
                • Else - Actions
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Custom script: call RemoveLocation(udg_Temp_Point)
 
first change ur original thing to this. since u already take out the units that are structures when making the group do it this way.
this way u only use 1 ITE and its more efficient since ur not checking the conditions that arent needed.
  • Arcane pulse loop Copy Copy
    • Events
      • Time - Every 0.75 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to iArcanePulseIndex, do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of uArcaneNovaC[Temp_Int])
          • Set Temp_Player = (Owner of uArcaneNovaC[Temp_Int])
          • Set Temp_Goup = (Units within 450.00 of Temp_Point matching ((((Triggering unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Set Temp_Unit = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of Temp_Unit) is an enemy of Temp_Player) Equal to True
                • Then - Actions
                  • Unit - Set mana of Temp_Unit to ((Mana of Temp_Unit) - ((Max mana of Temp_Unit) x 0.09))
                • Else - Actions
                  • Set rHeal = (((Real((Intelligence of uArcaneNovaC[Temp_Int] (Include bonuses)))) x 0.40) / (Real((Number of units in Temp_Goup))))
                  • Unit - Set life of Temp_Unit to ((Life of Temp_Unit) + rHeal)
                  • Set rHeal = 0.00
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Custom script: call RemoveLocation(udg_Temp_Point)
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
That may not be the best thing to do. "(((Real((Intelligence of uArcaneNovaC[Temp_Int] (Include bonuses)))) x 0.40) / (Real((Number of units in Temp_Goup))))" also counts with enemy units.
What he probably wants is the amount healed to be divided by number of allies. E.g. heals for 300, has 6 allies nearby, so it heals each ally for 50.
The thing you posted will count with enemies, so if the heal amount is 300 and there is 6 allies and 6 enemies, it would heal allies for 25 only, halving the total heal amount.

I didn't realize he wanted to divide heal amount by number of allies - in the end it may be better for him to create 2 groups like he did previously.
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,993
That may not be the best thing to do. "(((Real((Intelligence of uArcaneNovaC[Temp_Int] (Include bonuses)))) x 0.40) / (Real((Number of units in Temp_Goup))))" also counts with enemy units.
What he probably wants is the amount healed to be divided by number of allies. E.g. heals for 300, has 6 allies nearby, so it heals each ally for 50.
The thing you posted will count with enemies, so if the heal amount is 300 and there is 6 allies and 6 enemies, it would heal allies for 25 only, halving the total heal amount.

I didn't realize he wanted to divide heal amount by number of allies - in the end it may be better for him to create 2 groups like he did previously.
I agree. NightSkyAurora, remove this:
  • Set rHeal = 0.00
not really necessary to that be there.
 
Ok thanks guys, everything works now. I should have no problem with special effects.
  • Arcane pulse spell Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane pulse
    • Actions
      • Set iArcanePulseIndex = (iArcanePulseIndex + 1)
      • Set uArcaneNovaC[iArcanePulseIndex] = (Triggering unit)
      • Set iPulseCount[iArcanePulseIndex] = 10
      • Trigger - Turn on Arcane pulse loop Copy <gen>
  • Arcane pulse loop Copy
    • Events
      • Time - Every 0.75 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to iArcanePulseIndex, do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of uArcaneNovaC[Temp_Int])
          • Set Temp_Player = (Owner of uArcaneNovaC[Temp_Int])
          • Set Temp_Goup = (Units within 450.00 of Temp_Point matching (((Owner of (Matching unit)) is an enemy of Temp_Player) Equal to True))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Set Temp_Unit = (Picked unit)
              • Unit - Set mana of Temp_Unit to ((Mana of Temp_Unit) - ((Max mana of Temp_Unit) x 0.09))
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Set Temp_Goup = (Units within 450.00 of Temp_Point matching (((Owner of (Matching unit)) is an ally of Temp_Player) Equal to True))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Set Temp_Unit = (Picked unit)
              • Set rHeal = (((Real((Intelligence of uArcaneNovaC[Temp_Int] (Include bonuses)))) x 0.40) / (Real((Number of units in Temp_Goup))))
              • Unit - Set life of Temp_Unit to ((Life of Temp_Unit) + rHeal)
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Custom script: call RemoveLocation(udg_Temp_Point)
          • Set iPulseCount[Temp_Int] = (iPulseCount[Temp_Int] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (iPulseCount[Temp_Int] Equal to 0) or ((uArcaneNovaC[Temp_Int] is dead) Equal to True)
            • Then - Actions
              • Set uArcaneNovaC[Temp_Int] = uArcaneNovaC[iArcanePulseIndex]
              • Set uArcaneNovaC[iArcanePulseIndex] = No unit
              • Set iArcanePulseIndex = (iArcanePulseIndex - 1)
              • Set Temp_Int = (Temp_Int - 1)
            • Else - Actions
      • If (iArcanePulseIndex Equal to 0) then do (Trigger - Turn off (This trigger)) else do (Do nothing)
+rep
 
Last edited:
o_O I've found that when a second unit is casting the ability while the trigger is running, then the second caster's pulses gets unlimited :(

Here is the latest trigger:
  • Arcane pulse spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane pulse
    • Actions
      • Set iArcanePulseIndex = (iArcanePulseIndex + 1)
      • Set uArcaneNovaC[iArcanePulseIndex] = (Triggering unit)
      • Set iPulseCount[iArcanePulseIndex] = 10
      • If (iArcanePulseIndex Equal to 1) then do (Trigger - Turn on Arcane pulse loop <gen>) else do (Do nothing)
  • Arcane pulse loop
    • Events
      • Time - Every 0.75 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to iArcanePulseIndex, do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of uArcaneNovaC[Temp_Int])
          • Set Temp_Player = (Owner of uArcaneNovaC[Temp_Int])
          • Set Temp_Goup = (Units within 300.00 of Temp_Point matching (((Owner of (Matching unit)) is an enemy of Temp_Player) Equal to True))
          • Special Effect - Create a special effect at Temp_Point using war3mapImported\FreezingRing.mdx
          • Special Effect - Destroy (Last created special effect)
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Set Temp_Unit = (Picked unit)
              • If ((Temp_Unit is an illusion) Equal to True) then do (Unit - Kill Temp_Unit) else do (Do nothing)
              • Unit - Set mana of Temp_Unit to ((Mana of Temp_Unit) - ((Max mana of Temp_Unit) x 0.07))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Mana of Temp_Unit) Equal to 0.00
                • Then - Actions
                  • Unit - Cause uArcaneNovaC[Temp_Int] to damage Temp_Unit, dealing 60.00 damage of attack type Spells and damage type Normal
                  • Special Effect - Create a special effect attached to the overhead of Temp_Unit using Abilities\Weapons\DragonHawkMissile\DragonHawkMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
                  • Special Effect - Create a special effect attached to the overhead of Temp_Unit using Abilities\Weapons\WingedSerpentMissile\WingedSerpentMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Set Temp_Goup = (Units within 300.00 of Temp_Point matching (((Owner of (Matching unit)) is an ally of Temp_Player) Equal to True))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Set Temp_Unit = (Picked unit)
              • Set rHeal = (((Real((Intelligence of uArcaneNovaC[Temp_Int] (Include bonuses)))) x 0.80) / (Real((Number of units in Temp_Goup))))
              • Unit - Set life of Temp_Unit to ((Life of Temp_Unit) + rHeal)
              • Special Effect - Create a special effect attached to the overhead of Temp_Unit using Abilities\Weapons\GargoyleMissile\GargoyleMissile.mdl
              • Special Effect - Destroy (Last created special effect)
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Custom script: call RemoveLocation(udg_Temp_Point)
          • Set iPulseCount[Temp_Int] = (iPulseCount[Temp_Int] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (iPulseCount[Temp_Int] Equal to 0) or ((uArcaneNovaC[Temp_Int] is dead) Equal to True)
            • Then - Actions
              • Set uArcaneNovaC[Temp_Int] = uArcaneNovaC[iArcanePulseIndex]
              • Set uArcaneNovaC[iArcanePulseIndex] = No unit
              • Set iArcanePulseIndex = (iArcanePulseIndex - 1)
              • Set Temp_Int = (Temp_Int - 1)
            • Else - Actions
      • If (iArcanePulseIndex Equal to 0) then do (Trigger - Turn off (This trigger)) else do (Do nothing)
Please help
 
Like this?
  • Arcane pulse loop
    • Events
      • Time - Every 0.75 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to iArcanePulseIndex, do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of uArcaneNovaC[Temp_Int])
          • Set Temp_Player = (Owner of uArcaneNovaC[Temp_Int])
          • Set Temp_Goup = (Units within 300.00 of Temp_Point matching (((Owner of (Matching unit)) is an enemy of Temp_Player) Equal to True))
          • Special Effect - Create a special effect at Temp_Point using war3mapImported\FreezingRing.mdx
          • Special Effect - Destroy (Last created special effect)
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Set Temp_Unit = (Picked unit)
              • If ((Temp_Unit is an illusion) Equal to True) then do (Unit - Kill Temp_Unit) else do (Do nothing)
              • Unit - Set mana of Temp_Unit to ((Mana of Temp_Unit) - ((Max mana of Temp_Unit) x 0.07))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Mana of Temp_Unit) Equal to 0.00
                • Then - Actions
                  • Unit - Cause uArcaneNovaC[Temp_Int] to damage Temp_Unit, dealing 60.00 damage of attack type Spells and damage type Normal
                  • Special Effect - Create a special effect attached to the overhead of Temp_Unit using Abilities\Weapons\DragonHawkMissile\DragonHawkMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
                  • Special Effect - Create a special effect attached to the overhead of Temp_Unit using Abilities\Weapons\WingedSerpentMissile\WingedSerpentMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Set Temp_Goup = (Units within 300.00 of Temp_Point matching (((Owner of (Matching unit)) is an ally of Temp_Player) Equal to True))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Set Temp_Unit = (Picked unit)
              • Set rHeal = (((Real((Intelligence of uArcaneNovaC[Temp_Int] (Include bonuses)))) x 0.80) / (Real((Number of units in Temp_Goup))))
              • Unit - Set life of Temp_Unit to ((Life of Temp_Unit) + rHeal)
              • Special Effect - Create a special effect attached to the overhead of Temp_Unit using Abilities\Weapons\GargoyleMissile\GargoyleMissile.mdl
              • Special Effect - Destroy (Last created special effect)
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Custom script: call RemoveLocation(udg_Temp_Point)
          • Set iPulseCount[Temp_Int] = (iPulseCount[Temp_Int] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (iPulseCount[Temp_Int] Equal to 0) or ((uArcaneNovaC[Temp_Int] is dead) Equal to True)
            • Then - Actions
              • Set uArcaneNovaC[Temp_Int] = uArcaneNovaC[iArcanePulseIndex]
              • Set uArcaneNovaC[iArcanePulseIndex] = No unit
              • Set iArcanePulseIndex = (iArcanePulseIndex - 1)
              • Set iPulseCount[Temp_Int] = iPulseCount[iArcanePulseIndex]
              • Set iPulseCount[iArcanePulseIndex] = 0
              • Set Temp_Int = (Temp_Int - 1)
            • Else - Actions
      • If (iArcanePulseIndex Equal to 0) then do (Trigger - Turn off (This trigger)) else do (Do nothing)
But it still doesn't work
 
Now a funny thing happens; When a second caster pulse, the first caster loses a pulse count
  • Arcane pulse loop
    • Events
      • Time - Every 0.75 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to iArcanePulseIndex, do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of uArcaneNovaC[Temp_Int])
          • Set Temp_Player = (Owner of uArcaneNovaC[Temp_Int])
          • Set Temp_Goup = (Units within 300.00 of Temp_Point matching (((Owner of (Matching unit)) is an enemy of Temp_Player) Equal to True))
          • Special Effect - Create a special effect at Temp_Point using war3mapImported\FreezingRing.mdx
          • Special Effect - Destroy (Last created special effect)
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Set Temp_Unit = (Picked unit)
              • If ((Temp_Unit is an illusion) Equal to True) then do (Unit - Kill Temp_Unit) else do (Do nothing)
              • Unit - Set mana of Temp_Unit to ((Mana of Temp_Unit) - ((Max mana of Temp_Unit) x 0.07))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Mana of Temp_Unit) Equal to 0.00
                • Then - Actions
                  • Unit - Cause uArcaneNovaC[Temp_Int] to damage Temp_Unit, dealing 60.00 damage of attack type Spells and damage type Normal
                  • Special Effect - Create a special effect attached to the overhead of Temp_Unit using Abilities\Weapons\DragonHawkMissile\DragonHawkMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
                  • Special Effect - Create a special effect attached to the overhead of Temp_Unit using Abilities\Weapons\WingedSerpentMissile\WingedSerpentMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Set Temp_Goup = (Units within 300.00 of Temp_Point matching (((Owner of (Matching unit)) is an ally of Temp_Player) Equal to True))
          • Unit Group - Pick every unit in Temp_Goup and do (Actions)
            • Loop - Actions
              • Set Temp_Unit = (Picked unit)
              • Set rHeal = (((Real((Intelligence of uArcaneNovaC[Temp_Int] (Include bonuses)))) x 0.80) / (Real((Number of units in Temp_Goup))))
              • Unit - Set life of Temp_Unit to ((Life of Temp_Unit) + rHeal)
              • Special Effect - Create a special effect attached to the overhead of Temp_Unit using Abilities\Weapons\GargoyleMissile\GargoyleMissile.mdl
              • Special Effect - Destroy (Last created special effect)
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Custom script: call RemoveLocation(udg_Temp_Point)
          • Set iPulseCount[Temp_Int] = (iPulseCount[Temp_Int] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (iPulseCount[Temp_Int] Equal to 0) or ((uArcaneNovaC[Temp_Int] is dead) Equal to True)
            • Then - Actions
              • Set iPulseCount[Temp_Int] = iPulseCount[iArcanePulseIndex]
              • Set iPulseCount[iArcanePulseIndex] = 0
              • Set iArcanePulseIndex = (iArcanePulseIndex - 1)
              • Set uArcaneNovaC[Temp_Int] = uArcaneNovaC[iArcanePulseIndex]
              • Set uArcaneNovaC[iArcanePulseIndex] = No unit
              • Set Temp_Int = (Temp_Int - 1)
            • Else - Actions
      • If (iArcanePulseIndex Equal to 0) then do (Trigger - Turn off (This trigger)) else do (Do nothing)
 
u should use 0.03 not .75
we use .03 because u cant really notice it. what is probably happening is that u make a new instance of the spell in between the .75 and it looks wrong because one lasts from .01 to .74 difference in time. which is a pretty big difference.

also u never changed it like i said. ur de-indexing the wrong thing thats y its bugging up. fix it the way i said in the above post
 
uhm... I was making a new spell based on arcanic pulse. The spell isn't finish yet but I've found two problems that just dosn't make any sense!

  • Arcane leaf spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane leaf
    • Actions
      • Set iArcaneLeafindex = (iArcaneLeafindex + 1)
      • Set uArcaneLeafC[iArcaneLeafindex] = (Triggering unit)
      • Set uArcaneLeafT[iArcaneLeafindex] = (Target unit of ability being cast)
      • Set iArcaneLeafCount[iArcaneLeafindex] = 7
      • Set iArcaneLeafPeriod[iArcanePulseIndex] = 25
      • If (iArcaneLeafindex Equal to 1) then do (Trigger - Turn on Arcane leaf loop <gen>) else do (Do nothing)
  • Arcane leaf loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to iArcaneLeafindex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • iArcaneLeafPeriod[Temp_Int] Equal to 0
              • (uArcaneLeafT[Temp_Int] is paused) Equal to False
            • Then - Actions
              • Set iArcaneLeafCount[Temp_Int] = (iArcaneLeafCount[Temp_Int] - 1)
              • Set iArcaneLeafPeriod[Temp_Int] = 25
              • Set Temp_Player = (Owner of uArcaneLeafC[Temp_Int])
              • Set Temp_Point = (Position of uArcaneLeafT[Temp_Int])
              • Set Temp_Goup = (Units within 500.00 of Temp_Point matching (((Owner of (Matching unit)) is an ally of Temp_Player) Equal to True))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in Temp_Goup) Greater than 0
                • Then - Actions
                  • Set uLifeRayT = (Random unit from Temp_Goup)
                  • Unit - Create 1 Life seed for Temp_Player at Temp_Point facing Default building facing degrees
                • Else - Actions
              • Custom script: call DestroyGroup(GetLastCreatedGroup())
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (uArcaneNovaC[Temp_Int] is paused) Equal to False
                • Then - Actions
                  • Set iArcaneLeafPeriod[Temp_Int] = (iArcaneLeafPeriod[Temp_Int] - 1)
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (iArcaneLeafCount[Temp_Int] Equal to 0) or ((uArcaneLeafC[Temp_Int] is dead) Equal to True)
            • Then - Actions
              • Set Temp_Int = (Temp_Int - 1)
            • Else - Actions
1. The loop should only do it's actions when the period = 0. In the actions I set the period back to 25 but in the very next second it does the same actions.

2. It should only create ONE life ray. I can't figure out how much of these are created but it is defenitly not one.

I will change the loop to .04 in the future. I only made it 1 so I can atleast cast the spell without an infinite lag to see what happens.

Please help
 
Status
Not open for further replies.
Top