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

Another trigger problem. Dang.

Status
Not open for further replies.

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
I recently remade a spell I had in order to make it MUI, but, like most things I create, it doesn't work.

The spell is based on Tornado (Soulnado), and it damages enemy units' (HP%) instead of tossing them in the air. When the summon goes away, a dummy casts a spell (based on Inner Fire) on the caster, that has higher level depending on the number of damage ticks.

Or at least that's what it's supposed to do. However, not only is the HP not being drained, but the Inner Fire based spell never fires. (The dummy is created though.)

I tried using unit groups to hold the summoned units, but it didn't work. No idea why I thought it would either.

Here are the triggers.

  • Soulnado Switch On
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Soulnado
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MUISoulnado Greater than 100
        • Then - Actions
          • Set MUISoulnado = 1
        • Else - Actions
          • Set MUISoulnado = (MUISoulnado + 1)
      • Set SoulnadoCaster[MUISoulnado] = (Triggering unit)
      • Set SoulnadoUnit[MUISoulnado] = (Summoned unit)
  • Soulnado Ticker
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SoulnadoUnit[MUISoulnado] is alive) Equal to True
        • Then - Actions
          • Set SoulnadoUnitPos[MUISoulnado] = (Position of SoulnadoUnit[MUISoulnado])
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 512.00 of SoulnadoUnitPos[MUISoulnado] matching ((((Matching unit) has buff Invulnerable) Equal to False) and ((((Matching unit) has buff Divine Shield) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of SoulnadoCaster[MUISou and do (Actions)
            • Loop - Actions
              • Unit - Cause SoulnadoUnit[MUISoulnado] to damage (Picked unit), dealing ((Max life of (Picked unit)) / 50.00) damage of attack type Spells and damage type Normal
              • Set SoulnadoCounter[MUISoulnado] = (SoulnadoCounter[MUISoulnado] + 1)
          • Custom script: call RemoveLocation(udg_SoulnadoUnitPos[udg_MUISoulnado])
        • Else - Actions
          • Set SoulnadoCasterPos[MUISoulnado] = (Position of SoulnadoCaster[MUISoulnado])
          • Unit - Create 1 DUMMYCASTER 01 for (Owner of SoulnadoCaster[MUISoulnado]) at SoulnadoCasterPos[MUISoulnado] facing SoulnadoCasterPos[MUISoulnado]
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SoulnadoCounter[MUISoulnado] Greater than 50
            • Then - Actions
              • Unit - Set level of Soul Strength for (Last created unit) to 50
            • Else - Actions
              • Unit - Set level of Soul Strength for (Last created unit) to SoulnadoCounter[MUISoulnado]
          • Unit - Order (Last created unit) to Human Priest - Inner Fire SoulnadoCaster[MUISoulnado]
          • Custom script: call RemoveLocation(udg_SoulnadoCasterPos[udg_MUISoulnado])
          • Set SoulnadoUnit[MUISoulnado] = No unit
halp.

Any and all replies will be greatly appreciated.

EDIT: Just found out there's a function specifically for summoned units; incorporated it into the first trigger. Now the life drain is happening! However, part of the problem persists because the Inner Fire based spell still isn't being cast.

EDIT2: Cleaned some messes in the triggers.
 
Last edited:

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
Did you check this out

Dynamic Indexing

I'm taking a quick look at it now, and it seems interesting, but doesn't look like it's related to the problem I'm having, since I am using the arrays - just not replacing new ones with old ones. It resets at 100 instead.

I'll probably start doing this on my triggers if I find necessary though. going to take a better look at it later. Thanks!
 

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
You leak locations in your loop --> Then - Action block.

Why you set these two point variables in cast trigger?

Why you remove those 2 locations in your loop --> Elese - Actions?

You always check if "SoulnadoUnit[MUISoulnado]" is alive.. how is it supposed to die?

First 3 interrogatives - Alright, changed triggers, edited op. I thought it'd cover the leaks if I removed the locations on Else. Well, anyway, it's fixed now.

As for the last one, well, won't it be considered dead when the summoned timer ends or the channeling is interrupted (which also stops the tornado) ?

I could replace that with something else, but I doubt that is the problem since the dummy IS being summoned. Just not casting the spell. Weird.

Thanks for the reply.

EDIT: The problem is with the variables. It's unable to set the position of the caster and cast the spell because the caster variable is deemed as empty.
I'm a noob at this, so I don't know why. Does the specific array info not carry over to the "Else" part? It does to the "Then"...

And how should I work around this?
 
Level 5
Joined
Jan 27, 2014
Messages
164
Well, I believe you're doing your 'GUI-MUI indexing' method wrongly. I believe you need a integer loop somewhere in the periodic trigger. Then again, I'm not too familiar with the method you're using.

Example:
Your whole if then else should be within an integer loop.
For integer A 1 to MUISoulnado....
Then all your MUISoulnado should be changed to Integer A.
This is just a general idea though.


Also, in your periodic trigger, in the then block, the point removal should be outside of the unit group loop. Although it doesn't affect your current situation but, heck...
 
  • Like
Reactions: yip

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
Well, I believe you're doing your 'GUI-MUI indexing' method wrongly. I believe you need a integer loop somewhere in the periodic trigger. Then again, I'm not too familiar with the method you're using.

Example:
Your whole if then else should be within an integer loop.
For integer A 1 to MUISoulnado....
Then all your MUISoulnado should be changed to Integer A.
This is just a general idea though.


Also, in your periodic trigger, in the then block, the point removal should be outside of the unit group loop. Although it doesn't affect your current situation but, heck...

I'm not sure what that action is... but I tried doing what you suggested, then tried changing integer A to MUISoulnado, and no good. Can you explain a little better?

As for the other thing, yeah, small mistake. Fixed.

Thanks for replying.
 
Level 5
Joined
Jan 27, 2014
Messages
164
This is the simplified version of your trigger of what I have meant in the previous post:

  • Cast
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Footman
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • int Less than 10
        • Then - Actions
          • Set int = (int + 1)
        • Else - Actions
          • Set int = 0
      • Set caster[int] = (Triggering unit)
      • Set summoned[int] = (Summoned unit)
  • Periodic
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to int, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (summoned[(Integer A)] is alive) Equal to True
            • Then - Actions
              • Unit Group - Pick every unit in (Units within 300.00 of (Position of summoned[(Integer A)]) matching (((Matching unit) belongs to an enemy of (Owner of summoned[(Integer A)])) Equal to True)) and do (Actions)
                • Loop - Actions
                  • Unit - Cause summoned[(Integer A)] to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
            • Else - Actions
The above trigger is supposed to be GUI-MUI. Pretty inefficient method imo. With the introduction of hashtable, this method is relatively obsolete.

The problem with your trigger is MUISoulnado. You need to always keep track of this value. The only way to keep track is using a loop, which is not present in your trigger. Your trigger only works on the most current iteration of MUISoulnado.

With the above example, I hope you can get what I mean.
 

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
This is the simplified version of your trigger of what I have meant in the previous post:

  • Cast
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Footman
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • int Less than 10
        • Then - Actions
          • Set int = (int + 1)
        • Else - Actions
          • Set int = 0
      • Set caster[int] = (Triggering unit)
      • Set summoned[int] = (Summoned unit)
  • Periodic
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to int, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (summoned[(Integer A)] is alive) Equal to True
            • Then - Actions
              • Unit Group - Pick every unit in (Units within 300.00 of (Position of summoned[(Integer A)]) matching (((Matching unit) belongs to an enemy of (Owner of summoned[(Integer A)])) Equal to True)) and do (Actions)
                • Loop - Actions
                  • Unit - Cause summoned[(Integer A)] to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
            • Else - Actions
The above trigger is supposed to be GUI-MUI. Pretty inefficient method imo. With the introduction of hashtable, this method is relatively obsolete.

The problem with your trigger is MUISoulnado. You need to always keep track of this value. The only way to keep track is using a loop, which is not present in your trigger. Your trigger only works on the most current iteration of MUISoulnado.

With the above example, I hope you can get what I mean.

I do see where you are coming from. I can't say I understand it completely though, but that's probably lack of basic information on my part.

I don't get why my trigger keeps track of MUISoulnado in the 'Then' block, but not in the 'Else' block, and that's before the loop, when it sets the position of the summoned unit and the caster. The summoned unit is correctly registered and sets the position correctly, but not the caster.

I don't know much about hashtables, which is why I didn't use such method. I tried looking up a couple of other threads on the matter, and tried to use a unit handle for the caster (since I didn't need it for anything else, everything else is working). I'm a noob at this and I might be off, but I followed the tutorials and it looks like, even with hashes, the problem remains the exact same. The caster data doesn't carry over to the 'Else' part.

How do I solve that? With hashtables, indexing, a paper clip and a rubber band, anything.

Thanks for helping!
 
Level 5
Joined
Jan 27, 2014
Messages
164
> The caster data doesn't carry over...
Because 'Triggering unit' is in fact the 'Summoned unit'.
Use 'Summoning unit' instead.
This is a mistake on my part as well, for not checking out thoroughly.

Perhaps post your map with only the ability and only that trigger.
 

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
> The caster data doesn't carry over...
Because 'Triggering unit' is in fact the 'Summoned unit'.
Use 'Summoning unit' instead.
This is a mistake on my part as well, for not checking out thoroughly.

Perhaps post your map with only the ability and only that trigger.

I feel like a god damn idiot.

That's really misleading though, since the event reads 'Unit Spawns a summoned unit'. It'd be natural to consider the triggering unit the unit that did the summoning, and I always like to use Triggering Unit instead of the other options whenever possible.

It's working, so my method wasn't problematic, it was something else.

No need to post the map then, I guess? Unless you wanna see the spell or something.

Thanks for taking your time and the quick replies. You helped a lot.
 
Level 5
Joined
Jan 27, 2014
Messages
164
> It'd be natural to consider the triggering unit the unit that did the summoning...
True that. I thought the same too. The description for the event is misleading.

> It's working, so my method wasn't problematic
Have you tried casting more than 1 summoned unit and see if the damage is done accordingly? From what I see, it should not work, for the reason I've mentioned in post#8.

Then again, I'm not a fan of the array 'system'.
So I'm not too well verse in it.
Perhaps someone else can clarify this.
 

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
> It's working, so my method wasn't problematic
Have you tried casting more than 1 summoned unit and see if the damage is done accordingly? From what I see, it should not work, for the reason I've mentioned in post#8.

Then again, I'm not a fan of the array 'system'.
So I'm not too well verse in it.
Perhaps someone else can clarify this.

Now that I think of it, you're right. I tried reusing the old trigger and... the damage was being done correctly, what was not happening is, after the second summon faded, the second caster would not get the buff.

However, I did what you suggested on that post (Looping 'For each integer A...'), it's working perfectly.

I feel like a baby being looked after. Once again, thanks a lot.
 
Last edited:
Status
Not open for further replies.
Top