• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[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?
 
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.
 
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.
 
  • 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
 
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.
 
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?
 
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.
 
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 =)
 
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.
 
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.
 
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.
Back
Top