• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Creating MUI from Trigger

Status
Not open for further replies.
Level 3
Joined
Jun 9, 2009
Messages
38
First of all, I'd like to thank everyone who's been here to help. You guys are really good at all this coding, and I give you props for that. Been a really big help to me in my map making.

I'd like to make this trigger into a Multi-Instanced Trigger so that I can have multiple ones going at the same time.

  • Power Transfer
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Transfer Energy (Neutral Hostile)
    • Actions
      • Set turnoff = False
      • Set casting = (Casting unit)
      • Set casted = (Target unit of ability being cast)
      • For each (Integer A) from 1 to ((Integer((Mana of (Triggering unit)))) / 10), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • turnoff Equal to False
              • (Mana of casting) Greater than or equal to 5.00
            • Then - Actions
              • Lightning - Create a Chain Lightning - Secondary lightning effect from source (Position of casting) to target (Position of casted)
              • Unit - Set mana of casting to ((Mana of casting) - 5.00)
              • Unit - Set mana of casted to ((Mana of casted) + 5.00)
              • Wait 5.00 game-time seconds
              • Lightning - Destroy (Last created lightning effect)
            • Else - Actions
              • Lightning - Destroy (Last created lightning effect)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • turnoff Equal to True
        • Then - Actions
          • Custom script: call SetUnitPosition(GetTriggerUnit(), GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()))
          • Lightning - Destroy (Last created lightning effect)
        • Else - Actions
  • PTCancel
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Cancel Transfers
    • Actions
      • Set turnoff = True
What it does is transfer 5 mana from one building to another every five seconds. The second trigger turns off the first trigger and gets rid of the lightning effect.

Now I tried to understand the Stack technique in the MUI thread here. Unless there is a better way to explain, I'm not sure if I'm gonna understand it without one-on-one help. Is there another way to do this?
 
Level 8
Joined
Aug 4, 2008
Messages
279
Well, cant be MUI in the same trigger if it has the Wait.Try to create two triggers with the variables u want, create another variable named Integer Array
set this one as Integer[1] = Integer[1] + 1
Change all variables for the trigger that u have for Array.
In every index appeared, put the Integer[1].
In the next trigger, set the event to Every 1 sec
Actions -
for each (integer Integers[2] from 1 to Integers[1]
now here u do what u want.
I hope thats help.
 
Level 3
Joined
Jun 9, 2009
Messages
38
I don't understand what you mean by creating two triggers with the variables I want.

Two triggers with 'turnoff', 'casting', and 'casted'?

EDIT: Can you give an example as well please, it would make it alot more clear.
 
Level 8
Joined
Aug 4, 2008
Messages
279
  • Power Transfer
    • Events
    • Conditions
    • Actions
      • Set integers[1] = (integers[1] + 1)
      • Set turnoff[integers[1]] = False
      • Set casting[integers[1]] = (Triggering unit)
      • Set casted[integers[1]] = (Target unit of ability being cast)
      • Lightning - Create a Chain Lightning - Secondary lightning effect from source (Position of casted[integers[1]]) to target (Position of casting[integers[1]])
      • Set light[integers[1]] = (Last created lightning effect)
      • Trigger - Turn on Loop <gen>
  • Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • turnoff[integers[1]] Equal to False
      • (Mana of casting[integers[1]]) Greater than or equal to 5.00
    • Actions
      • For each (Integer integers[2]) from 1 to integers[1], do (Actions)
        • Loop - Actions
          • Unit - Set mana of casting[integers[2]] to ((Mana of casting[integers[2]]) - 5.00)
          • Unit - Set mana of casted[integers[2]] to ((Mana of casted[integers[2]]) + 5.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • turnoff[integers[2]] Equal to True
            • Then - Actions
              • Custom script: call SetUnitPosition(GetTriggerUnit(), GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()))
              • Lightning - Destroy light[integers[2]]
            • Else - Actions
Try that
 
Level 3
Joined
Jun 9, 2009
Messages
38
Sorry for my ignorance, but how do you get:

  • Set turnoff[integers[1]] = False
I don't see how to put the two variables next to each other.

On a side note, I couldn't get Brackets in my variable name either.
 
Level 3
Joined
Jun 9, 2009
Messages
38
Just set all your variables to array.

That makes more sense.

This is what I have now.

  • PT
    • Events
    • Conditions
      • ((Triggering unit) is A structure) Equal to True
    • Actions
      • Set integers[1] = (integers[1] + 1)
      • Set turnoff[integers[1]] = False
      • Set casting[integers[1]] = (Triggering unit)
      • Set casted[integers[1]] = (Target unit of ability being cast)
      • Lightning - Create a Chain Lightning - Secondary lightning effect from source (Position of casted[integers[1]]) to target (Position of casting[integers[1]])
      • Set lightning[integers[1]] = (Last created lightning effect)
      • Trigger - Turn on loop <gen>
  • loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • turnoff[integers[1]] Equal to False
      • (Mana of casting[integers[1]]) Greater than or equal to 5.00
    • Actions
      • For each (Integer integers[2]) from 1 to integers[1], do (Actions)
        • Loop - Actions
          • Unit - Set mana of casting[integers[2]] to ((Mana of casting[integers[2]]) - 5.00)
          • Unit - Set mana of casted[integers[2]] to ((Mana of casted[integers[2]]) + 5.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • turnoff[integers[2]] Equal to True
            • Then - Actions
              • Lightning - Destroy lightning[integers[2]]
              • Custom script: call SetUnitPosition(GetTriggerUnit(), GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()))
            • Else - Actions
Now when I cast the spell, it does an effect inside the target unit. No bridging of the lightning. Nor any mana transfer.

I copied that directly from WE. Did I miss something?
 
Level 3
Joined
Jun 9, 2009
Messages
38
You didn't put an event in your power transfer. I assume it is when a unit starts casting an ability.

Edit: Alright it works, but I think the cancel trigger now does not work. Any ideas on this one? I'm stumped.
 
Level 8
Joined
Aug 4, 2008
Messages
279
Of course, we donot have a trigger to stop it.
And the event is - Unit starts the effects of an ability.
  • PTCancel
  • Events
  • Unit - A unit Begins casting an ability
  • Conditions
  • (Ability being cast) Equal to Cancel Transfers
  • Actions
  • Set turnoff[integer[1]] = True
this will stop the unit =)
 
Level 3
Joined
Jun 9, 2009
Messages
38
Alright, thank you. One more thing though. If one has two units giving energy to two different units, and you try to cancel the first one, it will cancel the most recent one only. Not even if one recast cancel transfers.
 
Level 3
Joined
Jun 9, 2009
Messages
38
Yes I did. I'll go through what I did.

1)Create two links with two generators.
2)Check that both links are working.
3)Try to cancel 1st link.
4)Second link cancels.
5)Try to cancel 1st link again
6)Nothing happens.
 
Level 3
Joined
Jun 9, 2009
Messages
38
Well..I wanted it designed so that the connection is always there even if it is not supplying power.

Like the power towers map that I am basing it off of.

Thanks for the help though. You really got the trigger farther.
 
Status
Not open for further replies.
Top