HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

MUI in GUI?

10-27-2006, 06:33 AM#1
skatj
I read darkwulfv's tutorial which shows two methods of achieving this, making all variables arrays and using player numbers and using a custom script to trick the editor into making 1 variable local.

This works fine for one trigger, where I make the unit local and base all other variable's array numbers on the owner of that unit. However I also have 2 other triggers firing using the periodic event, and those aren't working. I set the unit variable to local for those triggers and I have no idea how that is supposed to work since I do not know jass, but is there a way to get MUI working over multiple triggers?

On a related note, if I get the array thing to work, how do I make the call RemoveLocation (udg_TempPoint) script to include the array?
10-27-2006, 06:54 AM#2
oNdizZ
call RemoveLocation(udg_yourPointArray[bj_forLoopAIndex]) exchange bj_forLoopAIndex if you have something else than IntegerA.

for the other part, post your triggers.
10-27-2006, 07:01 AM#3
skatj
Trigger:
Whirlwind Begin
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Whirlwind
Collapse Actions
Custom script: local unit udg_WhirlwindCaster
Set WhirlwindCaster = (Triggering unit)
Unit - Pause WhirlwindCaster
Animation - Change WhirlwindCaster's animation speed to 200.00% of its original speed
Trigger - Turn on Whirlwind Looping <gen>
Trigger - Turn on Whirlwind Move <gen>
Set WhirlwindTravelPoint[(Player number of (Owner of WhirlwindCaster))] = ((Position of WhirlwindCaster) offset by (Random real number between 50.00 and 200.00) towards (Random real number between 0.00 and 360.00) degrees)
Set WhirlwindTempPoint[(Player number of (Owner of WhirlwindCaster))] = (Position of WhirlwindCaster)
Unit - Create 1 WhirlwindDummy for (Owner of WhirlwindCaster) at (Position of WhirlwindCaster) facing Default building facing (270.0) degrees
Set WhirlwindDummy[(Player number of (Owner of WhirlwindCaster))] = (Last created unit)
Wait 7.00 seconds
Trigger - Turn off Whirlwind Looping <gen>
Trigger - Turn off Whirlwind Move <gen>
Unit - Kill WhirlwindDummy[(Player number of (Owner of WhirlwindCaster))]
Animation - Reset WhirlwindCaster's animation
Animation - Change WhirlwindCaster's animation speed to 100.00% of its original speed
Unit - Unpause WhirlwindCaster
Custom script: set udg_WhirlwindCaster = null

Trigger:
Whirlwind Looping
Collapse Events
Time - Every 0.40 seconds of game time
Conditions
Collapse Actions
Custom script: local unit udg_WhirlwindCaster
Animation - Set current animation for WhirlwindCaster to its 6th animation
Game - Display to (All players) the text: whirlwind looping w...
Custom script: set udg_WhirlwindCaster = null
Trigger:
Whirlwind Move
Collapse Events
Time - Every 0.01 seconds of game time
Conditions
Collapse Actions
Custom script: local unit udg_WhirlwindCaster
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Is WhirlwindCaster near WhirlwindTravelPoint[(Player number of (Owner of WhirlwindCaster))] and within a range of 15.00) Equal to True
Collapse Then - Actions
Set WhirlwindTravelPoint[(Player number of (Owner of WhirlwindCaster))] = ((Position of WhirlwindCaster) offset by (Random real number between 50.00 and 200.00) towards (Random real number between 0.00 and 360.00) degrees)
Collapse Else - Actions
Do nothing
Set WhirlwindTempPoint[(Player number of (Owner of WhirlwindCaster))] = (Position of WhirlwindCaster)
Unit - Move WhirlwindCaster instantly to (WhirlwindTempPoint[(Player number of (Owner of WhirlwindCaster))] offset by (((Distance between WhirlwindTempPoint[(Player number of (Owner of WhirlwindCaster))] and WhirlwindTravelPoint[(Player number of (Owner of WhirlwindCaster))]) + 1.00) + 0.00) towards
Unit - Move WhirlwindDummy[(Player number of (Owner of WhirlwindCaster))] instantly to (WhirlwindTempPoint[(Player number of (Owner of WhirlwindCaster))] offset by (((Distance between WhirlwindTempPoint[(Player number of (Owner of WhirlwindCaster))] and WhirlwindTravelPoint[(Player number of (Owner of WhirlwindCaster))]) + 1.00) + 0.00) towards


For the custom script thing, the integers i'm using is the owner of WhirlwindCaster's player number (tho that isn't carrying over to the other 2 triggers)
10-27-2006, 08:23 AM#4
Anitarf
Of course the value doesn't carry over, that's what local variables are, local.

If you want your spell to be MUI, then your periodic trigger must be capable of handling more units at the same time anyway, so attempting this with a single unit variable is wrong. You need a global unit group to which you add all units casting the spell, and then have your periodic triggers do stuff for each unit in the group.
10-27-2006, 10:48 AM#5
The)TideHunter(
Yes, Anitarf is very right, notice you are declaring a local, a local is something that can only be used in that function (if your not too good with jass think a function as a event function, condition function or a action function), your declaring it in the action function of your first trigger, so it will only be usable in that trigger, this is where the global array comes in, set the array to the triggering unit, array count is players number, and grab the unit in the other trigger/function to get it back.
10-27-2006, 05:28 PM#6
skatj
Quote:
Originally Posted by Anitarf
Of course the value doesn't carry over, that's what local variables are, local.

If you want your spell to be MUI, then your periodic trigger must be capable of handling more units at the same time anyway, so attempting this with a single unit variable is wrong. You need a global unit group to which you add all units casting the spell, and then have your periodic triggers do stuff for each unit in the group.

Well I tried the unit group idea. Two problems, the animation trigger works fine but it turns off as soon as the first hero is done with his spell. Second the move trigger isnt working, I added a debug message to the beginning of the trigger so it is firing but nothing is happening.

Trigger:
Whirlwind Move
Collapse Events
Time - Every 0.01 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in WhirlwindGroup and do (Actions)
Collapse Loop - Actions
Set WhirlwindTempPoint[(Player number of (Owner of (Picked unit)))] = (Position of (Picked unit))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Is (Picked unit) near WhirlwindTravelPoint[(Player number of (Owner of (Picked unit)))] and within a range of 15.00) Equal to True
Collapse Then - Actions
Set WhirlwindTravelPoint[(Player number of (Owner of (Picked unit)))] = ((Position of (Picked unit)) offset by (Random real number between 50.00 and 200.00) towards (Random real number between 0.00 and 360.00) degrees)
Collapse Else - Actions
Do nothing
Unit - Move (Picked unit) instantly to (WhirlwindTempPoint[(Player number of (Owner of (Picked unit)))] offset by (Distance between WhirlwindTempPoint[(Player number of (Owner of (Picked unit)))] and WhirlwindTravelPoint[(Player number of (Owner of (Picked unit)))]) towards (Angle from WhirlwindTe
Unit - Move WhirlwindDummy[(Player number of (Owner of (Picked unit)))] instantly to (WhirlwindTempPoint[(Player number of (Owner of (Picked unit)))] offset by (Distance between WhirlwindTempPoint[(Player number of (Owner of (Picked unit)))] and WhirlwindTravelPoint[(Player number of (Owner of (Picked unit)))]) towards (Angle from WhirlwindTe
10-27-2006, 05:41 PM#7
Anitarf
Quote:
Originally Posted by skatj
Well I tried the unit group idea. Two problems, the animation trigger works fine but it turns off as soon as the first hero is done with his spell.
Well, duh, you shouldn't turn the trigger off at all, or only turn it off if the unit group is empty.