• 🏆 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] MUI Method in GUI

Which is The Best Method?


  • Total voters
    30
Status
Not open for further replies.
Level 10
Joined
Jun 1, 2008
Messages
485
ok, I'm just want to start 'survey' about your MUI method in GUI.
I've see some MUI GUI spell in Spell section and I want to ask which MUI method is the best for making a MUI GUI spell.
I find some method that i will describe below:

1. Local Variable
Insert a custom script to make a global variable local.
  • Local Variable
    • Events
    • Conditions
    • Actions
      • Custom script: local effect udg_SFX
      • Special Effect - Create a special effect at Point[1] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
      • Set SFX = (Last created special effect)
      • Wait 2.00 seconds
      • Special Effect - Destroy SFX
Can't be put on separated trigger and only one of type variable can localized.

2. Indexing system
Add array then index it, so on for each trigger triggered on same time, it have different array.
  • Paladon Indexing System
    • Events
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MS_Integer[1] Equal to (==) 0
        • Then - Actions
          • Trigger - Turn on Paladon Indexing System Periodic <gen>
        • Else - Actions
      • Set MS_Integer[1] = (MS_Integer[1] + 1)
      • Set MS_Integer[2] = (MS_Integer[2] + 1)
      • Set Unit[MS_Integer[2]] = No unit
      • Set Integer[MS_Integer[2]] = 0
  • Paladon Indexing System Periodic
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer MS_Integer[3]) from 1 to MS_Integer[2], do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Unit[MS_Integer[3]] Not equal to (!=) No unit
            • Then - Actions
              • Trigger - Insert some Action
Edit: This just an example of Indexing system, they're other indexing system, but i made this to example because this easier to understand and added.

The best method i think. but need a loop on separate trigger to know which array belongs to it.

3. Custom Value
Give 'different' custom value to learner, then refer that number when using array.
  • Custom Value Add
    • Events
      • Unit - A unit Learns a skill
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of (Triggering unit)) Less than or equal to (<=) 0
        • Then - Actions
          • Set MUI_Integer = (MUI_Integer + 1)
          • Unit - Set the custom value of (Triggering unit) to MUI_Integer
        • Else - Actions
  • Custom Value Example Start
    • Events
    • Conditions
    • Actions
      • Set Unit[(Custom value of (Triggering unit))] = (Triggering unit)
      • Set Integer[(Custom value of (Triggering unit))] = 0
Some old method, simple and nice, but add custom value to learner that can inherit other spell that using custom value too, but in different way.

4. Dynamic Trigger (Using No waits)
The worst methods i think. the idea is make the action to run with no delay. usually using by one trigger only. can be upgraded to "Object Editor Manipulation Methods". Trigger that run immediately is MUI, because other unit can't cast it at same time (because its immediately run).
  • FlashCut by Kisame
  • Events
  • Unit - A unit Starts the effect of an ability
  • Conditions
  • (Ability being cast) Equal to |cff0000FFFlash Cut|r
  • Actions
  • Custom script: local unit udg_FUnit1
  • Custom script: local unit udg_FUnit2
  • Custom script: local location udg_FPoint1
  • Custom script: local location udg_FPoint2
  • Custom script: local integer udg_FLevel
  • Set FUnit1 = (Casting unit)
  • Set FUnit2 = (Target unit of ability being cast)
  • Set FPoint1 = (Position of FUnit2)
  • Set FPoint2 = (FPoint1 offset by 90.00 towards ((Facing of FUnit2) + 180.00) degrees)
  • Set FLevel = (Level of |cff0000FFFlash Cut|r for FUnit1)
  • Unit - Move FUnit1 instantly to FPoint2
  • Animation - Play FUnit1's Spell Slam animation
  • Special Effect - Create a special effect at FPoint1 using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
  • Special Effect - Destroy (Last created special effect)
  • Unit - Cause FUnit1 to damage FUnit2, dealing ((Real(FLevel)) x 50.00) damage of attack type Hero and damage type Normal
  • Custom script: call RemoveLocation(udg_FPoint1)
  • Custom script: call RemoveLocation(udg_FPoint2)
in fact, example spell not needed of localizing system and variable.

Worst methods, most used to dynamic spell. can't be used to complex spell without upgrading it to "Object Editor Manipulation" system.

5. Object Editor Manipulation
"New" methods i find that used by Squiggy. With the manipulation and delayed use spell, it can make a "simple" but nice spell. If you're tricky enough, you can even make a complex spell.
  • Flashlight by Squiggy
    • Events
      • Unit - A unit stars the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Flashlight
    • Actions
      • Set dummy_pt = (Position of (Triggering unit))
      • Set tar_u = (Target unit of ability being cast)
      • Set tar_pt = (Position of tar_u)
      • Set dist = 522.00
      • Set exp_r = 0.20
      • Set lvl = (Level of Flashlight for (Triggering unit))
      • Unit - Create 1 dummy1 for (Owner of (Triggering unit)) at dummy_pt facing tar_pt
      • Set dum_u = (Last created unit)
      • Unit - Order dum_u to Orc-Farseer - 'chain lightning' tar_u
      • Unit - Add a exp_r seconds Generic expiration timer to dum_u
      • Unit - Create 1 dummy1 for (Owner of (Triggering unit)) at tar_pt facing tar_pt
      • Unit - Add a exp_r second Generic expiration timer to dum_u
      • Set dum_u = (Last created unit)
      • Unit - Order dum_u to Human-Mountain King - 'Stormbolt' tar_u
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Asctions
          • Set tar_pt2 = (tar_pt offset by dist towards ang degrees)
          • Unit - Create 1 dummy2 for (Owner of (Triggering unit)) at tar_pt facing tar_pt2
          • Set dum_u = (Last created unit)
          • Unit - Add a (exp_r + 1.30) second Standard expiration timer to dum_u
          • Unit - Order dum_u to Move to tar_pt2
          • Unit - Create 1 dummy3 for (Owner of (Triggering unit)) at tar_pt2 facing tar_pt
          • Set dum_u = (Last created unit)
          • Unit - Set level of CL for dum_u to lvl
          • Unit - Add a (exp_r + 1.30) seconds Generic expiration timer to dum_u
          • Unit - Order dum_u to Orc-Farseer - 'chain lightning' tar_u
          • Set ang = (ang + 36.00)
          • Custom script: call RemoveLocation(udg_tar_pt2)
      • Set ang = 0.00
      • Custom script: call RemoveLocation(udg_dummy_pt)
      • Custom script: call RemoveLocation(udg_tar_pt)
I quote post by Squiggy
Here, I avoid a wait of 1 second (which should stop the spell process while the dummies move outwards) by preplacing the dummies and setting a delay of 1s to cast chain lightning

Nice and simple methods, but hard to import because you need other object editor ability.

That all method i see used on MUI GUI spell.

I want to ask for you opinion which is the best method to use on spell?
and if there's another way to make GUI MUI Spell, post here and describe it.
 
Last edited:
Level 30
Joined
Dec 6, 2007
Messages
2,228
Indexing is (meh, of course) the best way, Kingz is currently writing a tutorial about it (with my permission).
The local varis don´t work if a spell needs more than one trigger, and the custom values interrupt other spells and triggers using them as well, just as you mentioned.

I would vote for my systems anyway. So i don´t vote.
 
Level 10
Joined
Jun 1, 2008
Messages
485
Indexing is (meh, of course) the best way, Kingz is currently writing a tutorial about it (with my permission).
The local varis don´t work if a spell needs more than one trigger, and the custom values interrupt other spells and triggers using them as well, just as you mentioned.
wow... what a fast reply,
and are you sure there is no other way to make GUI MUI?

and when i use the indexing method, it just to me or happen to somebody else, but when using loop, the times GUI looping it is increasing more and more.

I mean, first time it looping as your set it, but on second, looping as your set but +1 times, on third looping by your set +2 times, and so on...
 
Level 30
Joined
Dec 6, 2007
Messages
2,228
I honestly don´t care about other ways.
Develope your own, just as i did.

And the indexing is of course not steadily increasing. You forgot to notice that i´m steadily reducing the "blabla_Integer[1]" variable.
If the trigger is not longer needed, that means that the "blabla_Integer[1]" is 0, everything resets and turns off again.
 
Level 10
Joined
Jun 1, 2008
Messages
485
~Bump~

Sorry for bumping. but now I've get the result:
5 people here make GUI MUI with Indexing System
1 people here make GUI MUI with Custom Value System
1 people here make GUI MUI with Other System.

I check it every 5 days (maybe, if i have time)

thanks for surveying!

and sorry for late reply.

P.S: for Paladon, i not mean your indexing system, but a "loop" function in GUI. i try to make the loop when use spell, then make it says the Integer number they looping. the number is increasing more and more.
and, i think there was a weakness on your indexing system, let's say there are three unit with same spell that use your indexing system. one unit cast spell, and give the array number "1". second unit cast it, and given array number "2". when first unit end the spell, the current array number for given to other unit is "current number - 1" that's mean "2". and when the third unit cast it, when the second unit still use it, then the array will be mixed each other.
that's just what i think will happen, haven't test it in-game. or i wrong about that?

P.S: For Squiggy, can you describe what system you use for your spell to make it GUI MUI? well, if you don't want, don't mind.
 

Rmx

Rmx

Level 19
Joined
Aug 27, 2007
Messages
1,164
Mage Goo i will defend on Paladon they will not mix Because those indexes ur talking about are not the Main index when those reaches 0 The main index will be set to 0 thos making it abel to use again I tried casting 100 times still nothing wrong for me ^^ Paladon System RULES
 
Level 10
Joined
Jun 1, 2008
Messages
485
have you tried to do as i tell?
well, maybe you're right. Paladon system doesn't have weakness for make a GUI MUI.

and, as i see, most of the MUI GUI spell use indexing system, (let's say Desert Ant, Geyser, Ring Of Fire, etc.)
I can't find other system other than i post on first post. if you can, then tell me.

well, it's just for me to develop new MUI system (sorry for selfish). if you don't want, then don't mind. this thread purpose is just to know your GUI MUI system, maybe more but not less.
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
Meh.. I'll show it:
  • Flashlight
    • Events
      • Unit - A unit stars the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Flashlight
    • Actions
      • Set dummy_pt = (Position of (Triggering unit))
      • Set tar_u = (Target unit of ability being cast)
      • Set tar_pt = (Position of tar_u)
      • Set dist = 522.00
      • Set exp_r = 0.20
      • Set lvl = (Level of Flashlight for (Triggering unit))
      • Unit - Create 1 dummy1 for (Owner of (Triggering unit)) at dummy_pt facing tar_pt
      • Set dum_u = (Last created unit)
      • Unit - Order dum_u to Orc-Farseer - 'chain lightning' tar_u
      • Unit - Add a exp_r seconds Generic expiration timer to dum_u
      • Unit - Create 1 dummy1 for (Owner of (Triggering unit)) at tar_pt facing tar_pt
      • Unit - Add a exp_r second Generic expiration timer to dum_u
      • Set dum_u = (Last created unit)
      • Unit - Order dum_u to Human-Mountain King - 'Stormbolt' tar_u
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Asctions
          • Set tar_pt2 = (tar_pt offset by dist towards ang degrees)
          • Unit - Create 1 dummy2 for (Owner of (Triggering unit)) at tar_pt facing tar_pt2
          • Set dum_u = (Last created unit)
          • Unit - Add a (exp_r + 1.30) second Standard expiration timer to dum_u
          • Unit - Order dum_u to Move to tar_pt2
          • Unit - Create 1 dummy3 for (Owner of (Triggering unit)) at tar_pt2 facing tar_pt
          • Set dum_u = (Last created unit)
          • Unit - Set level of CL for dum_u to lvl
          • Unit - Add a (exp_r + 1.30) seconds Generic expiration timer to dum_u
          • Unit - Order dum_u to Orc-Farseer - 'chain lightning' tar_u
          • Set ang = (ang + 36.00)
          • Custom script: call RemoveLocation(udg_tar_pt2)
      • Set ang = 0.00
      • Custom script: call RemoveLocation(udg_dummy_pt)
      • Custom script: call RemoveLocation(udg_tar_pt)
Here, I avoid a wait of 1 second (which should stop the spellprocess while the dummies move outwards) by preplacing the dummies and setting a delay of 1s to cast chainblightning
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Using the custom value as the index to an array is the best method... It's got the speed of custom values (allowing random access) but also the "extensibility" of arrays (allowing multiple spells use the same custom value which functions as index of whatever array the spell uses)
 
Level 14
Joined
Jan 15, 2007
Messages
349
The costum value to save the index of arrays is surely the fastest method of all and also it doesn't need loops to work. But I just would use this method in own maps and not for spells you submit for e.g. hive, because if a guy maybe want to use your spell or system but a system in his map use this method already there could appear bugs. This is particularly bad for newbies who don't have a clue about it and just want to use those resources. Well it's ok to use this method but it should be mentioned somewhere, for example inside the demo map.

My favorite is still the Indexing System. The only weakness of this system is that it just can used for looping things like motions. But else the system is in my opinion perfect.
 

Kyrbi0

Arena Moderator
Level 45
Joined
Jul 29, 2008
Messages
9,495
I always go for maximizing the Object Editor, but since you can't edit the poll, I went for my second choice, Local Variables.

I really appreciate you setting up this poll, though; I had no idea about all the different methods, and more importantly how to use them. For example, I've heard of indexing, but never actually tried it or whatever.

I would probably use Custom Value, also, but I like to use those for other spells, so that's a no-go right there.
 
Level 10
Joined
Jun 1, 2008
Messages
485
hmm...
seemed like the "Custom Value" System is nice too, but as mentioned by Hanky, it can cause bug if you use it on map that using custom value too, but on different way.

Kyrbi0,
thank you. And, you're right, i can't edit the poll, sadly.

and, I've an idea for another MUI System=Indexing combined with Custom Value system.
gonna make and test it anyway.

Thanks to all voter who vote here!
 

Kyrbi0

Arena Moderator
Level 45
Joined
Jul 29, 2008
Messages
9,495
Multi-Unit Instanceability.

If you cast a spell, and a trigger (activated when the spell casts) creates a dummy caster and tells it to "attack Target Unit of Ability Being Cast", alright then. But what if 2 units cast that spell in quick succession? Then the game glitches on who to target, and someone is missed. MUI means it can be cast by any number of units at it'll always work right.

(in a nutshell)
 
Level 8
Joined
Aug 6, 2008
Messages
451
This made me curious.

How well can you control loops in GUI?

Jass has exitwhen, but I remember that GUI loops were something like: 'do these actions X times' or something like that

Is it possible to loop actions for some unit array and stop the loop when you find an array member who is null? ( or something like that )
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Localling and indexing serves different types of spells
for spells with timers you need indexing for basic spells with "Wait" you need localling
And I never encountered a good usage of Custom Value with spell making
 
Level 13
Joined
May 11, 2008
Messages
1,198
Multi-Unit Instanceability.

If you cast a spell, and a trigger (activated when the spell casts) creates a dummy caster and tells it to "attack Target Unit of Ability Being Cast", alright then. But what if 2 units cast that spell in quick succession? Then the game glitches on who to target, and someone is missed. MUI means it can be cast by any number of units at it'll always work right.

(in a nutshell)

if i'm not mistaken, doesn't enfos use a good method of MUI? they do a set of triggers where they add the event to such a trigger that is the trigger for the spell from the trigger for making the hero when it is selected for the player.

i've been using it in my map and it works a lot better than the complicated mui systems that people have recommended.

here's an example from an enfos map:

  • chooseTempest
    • Events
      • Unit - A unit comes within 80.00 of Circle of Power 0083 <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (==) Hero Selector
    • Actions
      • Unit - Create 1 Tempest for (Owner of (Triggering unit)) at (Center of PlayerSpawnLocation[(Player number of (Owner of (Triggering unit)))]) facing 270.00 degrees
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • FLAG_RandomHero[(Player number of (Owner of (Triggering unit)))] Equal to (==) True
          • Then - Actions
            • Hero - Create Potion of Healing and give it to (Last created unit)
          • Else - Actions
      • Set UNIT_Heroes[(Player number of (Owner of (Triggering unit)))] = (Last created unit)
      • Trigger - Add to Paeldryths Wrath <gen> the event (Unit - (Last created unit) Starts the effect of an ability)
      • Set L_POINT = (Position of (Last created unit))
      • Camera - Pan camera for (Owner of (Triggering unit)) to L_POINT over 0.30 seconds
      • Special Effect - Create a special effect at L_POINT using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
      • Trigger - Run Func SFX <gen> (ignoring conditions)
      • Custom script: call RemoveLocation( udg_L_POINT )
      • Set L_POINT = (Position of (Triggering unit))
      • Special Effect - Create a special effect at L_POINT using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
      • Trigger - Run Func SFX <gen> (ignoring conditions)
      • Custom script: call RemoveLocation( udg_L_POINT )
      • Unit - Remove (Triggering unit) from the game
  • Paeldryths Wrath
    • Events
    • Conditions
      • (Ability being cast) Equal to (==) Paeldryth's Wrath (Tempest)
    • Actions
      • Set L_POINT = (Position of (Target unit of ability being cast))
      • Unit - Make (Triggering unit) face (Target unit of ability being cast) over 0.00 seconds
        • Do Multiple ActionsFor each (Integer A) from 1 to (5 + (Level of (Ability being cast) for (Triggering unit))), do (Actions)
          • Loop - Actions
            • Unit Group - Pick every unit in (Units within 400.00 of L_POINT) and do (Actions)
              • Loop - Actions
                • Custom script: local location udg_L_POINT
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to (==) True
                      • ((Picked unit) is alive) Equal to (==) True
                      • (Unit-type of (Picked unit)) Not equal to (!=) Hav'roth
                      • (Unit-type of (Picked unit)) Not equal to (!=) Sidhlot
                      • (Unit-type of (Picked unit)) Not equal to (!=) Uthmor
                      • (Unit-type of (Picked unit)) Not equal to (!=) Arhat
                    • Then - Actions
                      • Unit - Set life of (Picked unit) to (0.90 x (Life of (Picked unit)))
                      • Set L_POINT = (Position of (Picked unit))
                      • Unit - Move (Picked unit) instantly to (L_POINT offset by 80.00 towards (Facing of (Casting unit)) degrees)
                      • Custom script: call RemoveLocation( udg_L_POINT )
                      • Set L_POINT = (Position of (Picked unit))
                      • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Undead\ReplenishMana\SpiritTouchTarget.mdl
                      • Trigger - Run Func SFX <gen> (ignoring conditions)
                      • Custom script: call RemoveLocation( udg_L_POINT )
                    • Else - Actions
      • Custom script: call RemoveLocation( udg_L_POINT )
so the game automatically makes that last created unit or last replaced unit or whatever you called it at the time you added it to the event, the hero the spell is for, it was selected by the player and you added that event, this unit starts the effect of an ability. and so your triggered ability has an event to work off of. and any enfos player knows that you can select the same hero as someone else, and casting spells isn't a problem, so this appears to be what is the mui system for enfos, and it is simple and seems to work just fine.

edit: maybe i just don't understand how mui works...maybe what i'm talking about what enfos uses is the local variable method...at any rate though maybe everyone already knew about this thing that i'm talking about but i certainly didn't until i started reading through the triggers of the map myself.
 
Level 10
Joined
Jun 1, 2008
Messages
485
ok, ok, sorry for late reply

if i'm not mistaken, doesn't enfos use a good method of MUI? they do a set of triggers where they add the event to such a trigger that is the trigger for the spell from the trigger for making the hero when it is selected for the player.
he add event when hero is chosen, that's doesn't make it MUI, because, when two unit that have been 'registered' to trigger cast it at same time, both can interrupt the trigger. AFAIK, it use adding event to prevent lag.

edit: maybe i just don't understand how mui works...maybe what i'm talking about what enfos uses is the local variable method...at any rate though maybe everyone already knew about this thing that i'm talking about but i certainly didn't until i started reading through the triggers of the map myself.

let me quote some post from above
If you cast a spell, and a trigger (activated when the spell casts) creates a dummy caster and tells it to "attack Target Unit of Ability Being Cast", alright then. But what if 2 units cast that spell in quick succession? Then the game glitches on who to target, and someone is missed. MUI means it can be cast by any number of units at it'll always work right.
when you create spell like above, and trigger use wait and save the target as variable with no array, it will glitches and only the target will change into the last triggering unit target. but, if you use some methods i posted on first post, it prevent glitches. That's how MUI works.

Localling and indexing serves different types of spells
for spells with timers you need indexing for basic spells with "Wait" you need localling
And I never encountered a good usage of Custom Value with spell making
exactly, both methods is good if you use that right. And, for information, if you want to see some nice spell that using Custom Value, then see here.
edit: sorry, that link is hard to search. see here

well, nice to see some JASSer post here too.

the poll result:
11 people use Indexing System for GUI MUI
1 people use Custom Value system for GUI MUI
1 people use Localizing System for GUI MUI
3 people use Another System (well, this count Object Editor Manipulation too) for GUI MUI

thanks for voting :grin:
 
Level 12
Joined
Mar 26, 2005
Messages
790
I dont know, but can be that custom script to make global=local used at the same time in more triggers? (not the same variable of course, like in triger one, the variable is like TempUnit, and in second like TempLocation)



And this MUI option

E:whatever
C: -!!-
A:set INTEGER=INTEGER+1 (initial value=0)
Set Casting unit=CASTER_ARRAY(INTEGER)

wait x sec

From Integer A 1 to x (i dont know, 100?)
If CASTER_ARRAY(Integer A) not equal to No unit
Then Some action with CASTER_ARRAY(INTEGER)

From Integer A 1 to (INTEGER)
Set No unit=CASTER_ARRAY(Integer A)

so?
 
Level 10
Joined
Jun 1, 2008
Messages
485
well, for more information to "develop" your indexing system, [thread=96460]PurplePoot have made nice tutorial here.[/thread]

@Restor
i think it can. haven't test it yet, but i believe it can. Some test can proof it.
 
Level 12
Joined
Mar 26, 2005
Messages
790
You can't use more than one "local global" variable in one trigger.


I dont know if i typed it in chinese, BUT I asked if more local variables can be used in MORE triggers (That means more than one) at the same time




Ok, that trigger i wrote there will not work good. It has error.


E:whatever
C: -!!-
A:set INTEGER=INTEGER+1 (initial value=0)
Set Casting unit=CASTER_ARRAY(INTEGER)

wait x sec

From Integer A 1 to x (i dont know, 100?)
If CASTER_ARRAY(Integer A) not equal to No unit
Then Some action with CASTER_ARRAY(INTEGER)

That mean if X cast something in 25.48 sec, and the Y in 26.12, effects of both spell will go at 26.48
 
ok, so the local global variable can only be one on one trigger, or it's only one per type?
Only 1 per trigger, no matter what type they are.

I dont know if i typed it in chinese, BUT I asked if more local variables can be used in MORE triggers (That means more than one) at the same time
I was replying to Mage_Goo. But of course you can use local global variables in more than one trigger at the same time or they wouldn't make it MUI would they?
 
Level 12
Joined
Mar 26, 2005
Messages
790
So, If you can use more locals, where is the problem?

triger1
E:unit cast a spell
C:ability is XY
A:set casting unit=CASTER
set target of ability being cast=TARGET
Run trigger2
set CASTER=local variable
wait x sec
Some action with CASTER


triger2
E:
C:
A:set TARGET=local variable
wait x sec
Some action with TARGET


and where is the problem?
 
Level 12
Joined
Mar 26, 2005
Messages
790
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set CASTER = (Casting unit)
      • Set TARGET = (Target unit of ability being cast)
      • Trigger - Run Untitled Trigger 001 <gen> (ignoring conditions)
      • Custom script: variable CASTER=local variable
      • Wait 2.00 seconds
      • -------- some action with CASTER --------
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Custom script: variable TARGET=local variable
      • Wait 2.00 seconds
      • -------- some action with TARGET --------
 
Problem 1: You declare locals wrong - the correct syntax is local + <type> + <name> and you don't need "= local variable" after it.

Problem 2: Declaring local variables must be the first thing you do in a trigger.

The corrected code is:

  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Custom script: local unit udg_CASTER=local variable
      • Set CASTER = (Casting unit)
      • Set TARGET = (Target unit of ability being cast)
      • Trigger - Run Untitled Trigger 001 <gen> (ignoring conditions)
      • Wait 2.00 seconds
      • -------- some action with CASTER --------
  • Untitled Trigger 001
  • Events
  • Conditions
  • Actions
    • Custom script: local unit udg_TARGET
    • Wait 2.00 seconds
    • -------- some action with TARGET --------
The problem though here is that you need to set TARGET in the second trigger before you can do anything with it.
 
Level 12
Joined
Mar 26, 2005
Messages
790
I didnt write the custom script properly, becouse I dont have to, this is not the trigger as it should look like, but as everybody can understand the meaning of it, and I dont have time to write everything properly.

Well, maybe more variables will be needed. But I think it will work




A:set variable CASTER=casting unit
set variable TARGET=target of ability being cast
run trigger2 ignoring cond.
custom script: make CASTER2=local variable
set variable CASTER2=CASTER
wait x sec
some actions with CASTER2

trigger2
A:custom script:make TARGET2=local variable
set variable TARGET2=TARGET
wait x sec
some actions with TARGET2
 
Level 10
Joined
Jun 1, 2008
Messages
485
  • Start Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Custom script: local unit udg_Caster
      • Set Caster = (Triggering unit)
      • Set Target = (Target unit of ability being cast)
      • Trigger - Run Target2 Action <gen> (ignoring conditions)
      • Wait 2.00 seconds
      • -------- Some Action with Caster --------
this is for first trigger
  • Target2 Action
    • Events
    • Conditions
    • Actions
      • Custom script: local unit udg_Target2
      • Set Target2 = Target
      • Wait 2.00 seconds
      • -------- Some Action with Target2 --------
this is for second trigger action
I've fixed your trigger. You don't need Caster2 variable if you don't want to transfer Caster variable to another trigger

the problem is:
1. You must declare local at very first of trigger, you can't declare it afterward.
2. The custom script syntax for local is
  • Custom script: local <variable type> udg_<your variable name>
maybe you just didn't want to write it properly, but do like this for your trigger.

well, all these problem have posted by Element of Water.
 
Level 12
Joined
Mar 26, 2005
Messages
790
Ok, I made one variable more than it was needed to, ok



But Why the hell are you comment that my custom script is incorrect? I KNOW it is incorrect, i think everybody understood the meaning, (same with E,C,A, everyone knows what the letters means)
 
Level 10
Joined
Jun 1, 2008
Messages
485
But Why the hell are you comment that my custom script is incorrect? I KNOW it is incorrect, i think everybody understood the meaning, (same with E,C,A, everyone knows what the letters means)
hmm? that will make other people read it easily. If you write it like that, some people will misunderstood and think you're wrong. then they'll comment it.
and, to some new-to-triggering people, when they see it, they won't understood it.

well, that's off topic. no offense.
 
Level 12
Joined
Mar 26, 2005
Messages
790
Well, I hope people here know what was intended by that incorrect line. The others have feeling to "correct" everything...


Anyway, of course I mean wait loops, A integer loops are de facto the same thing like normal triggers
 
Level 9
Joined
May 30, 2008
Messages
430
Custom Value System

Can some one tell me info about this where is based (is this the number of the player) how i can use it (it's not neccesary to tell me i just wonna know some more info about GUI)

And i prefer Indexing but in some i use Player number to set the index
 
Can some one tell me info about this where is based (is this the number of the player) how i can use it (it's not neccesary to tell me i just wonna know some more info about GUI)
You use Set Unit Custom Value to attach an array index to it.

And i prefer Indexing but in some i use Player number to set the index
That isn't proper indexing, it only makes the spell MPI, not MUI
 
Level 10
Joined
Jun 1, 2008
Messages
485
Can some one tell me info about this where is based (is this the number of the player) how i can use it (it's not neccesary to tell me i just wonna know some more info about GUI)
The idea is when unit learn ability, it increase the integer that sum the number unit learn it, then give unit custom value to that integer. So, when that unit cast spell, it refer to custom value for giving right array.

This system has weakness: Only give Custom Value to unit learn that ability, so, when there is a unit that already have the ability, it won't give the custom value.

And i prefer Indexing but in some i use Player number to set the index
It make MPI, to make MUI, you must give index number that different from other unit, for SUI(Same-unit-Instancebility) you must use JASS, or complex index that give different number in each cast. Though SUI are rare seen in GUI.
 
Status
Not open for further replies.
Top