HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help shortening a trigger

06-30-2009, 03:56 AM#1
Ba1100n.Boi
Hidden information:
Trigger:
Maiden Upgrade
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Maiden
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Item-type of (Item being manipulated)) Equal to Rusted Sword
(Item-type of (Item being manipulated)) Equal to Rusted Shield
(Item-type of (Item being manipulated)) Equal to Rusted Armor
(Item-type of (Item being manipulated)) Equal to Wooden Bow
(Item-type of (Item being manipulated)) Equal to Rusted Arrows
(Item-type of (Item being manipulated)) Equal to Patched Cape
(Item-type of (Item being manipulated)) Equal to Patched Robe
(Item-type of (Item being manipulated)) Equal to Rusted Circlet
(Item-type of (Item being manipulated)) Equal to Rusted Ring
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Rusted Sword Equal to (Item-type of (Item being manipulated))
Rusted Shield Equal to (Item-type of (Item being manipulated))
Rusted Armor Equal to (Item-type of (Item being manipulated))
Collapse And - All (Conditions) are true
Collapse Conditions
((Item carried by (Triggering unit) of type Rusted Sword) is owned) Equal to True
((Item carried by (Triggering unit) of type Rusted Shield) is owned) Equal to True
((Item carried by (Triggering unit) of type Rusted Armor) is owned) Equal to True
Collapse Then - Actions
Set Integer_ReferenceX = 1
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Sword
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Shield
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Armor
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 2
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Sword
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Shield
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Armor
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 3
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Sword
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Shield
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Armor
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 4
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Sword
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Shield
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Armor
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 5
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Sword
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Shield
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Armor
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 6
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Sword
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Shield
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Armor
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set TempPoint = (Position of (Triggering unit))
Set Player_ReferenceX = (Owner of (Triggering unit))
Set Real_ReferenceX = (Facing of (Triggering unit))
Unit - Remove (Triggering unit) from the game
Unit - Create 1 Gladiatrix for Player_ReferenceX at TempPoint facing Real_ReferenceX degrees
Custom script: call RemoveLocation (udg_TempPoint)
Set Unit_ReferenceX = (Last created unit)
Special Effect - Create a special effect attached to the origin of Unit_ReferenceX using Abilities\Spells\Other\Levelup\LevelupCaster.mdl
Special Effect - Destroy (Last created special effect)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Wooden Bow Equal to (Item-type of (Item being manipulated))
Rusted Arrows Equal to (Item-type of (Item being manipulated))
Patched Cape Equal to (Item-type of (Item being manipulated))
Collapse And - All (Conditions) are true
Collapse Conditions
((Item carried by (Triggering unit) of type Wooden Bow) is owned) Equal to True
((Item carried by (Triggering unit) of type Rusted Arrows) is owned) Equal to True
((Item carried by (Triggering unit) of type Patched Cape) is owned) Equal to True
Collapse Then - Actions
Set Integer_ReferenceX = 1
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Wooden Bow
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Arrows
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Patched Cape
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 2
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Wooden Bow
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Arrows
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Patched Cape
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 3
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Wooden Bow
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Arrows
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Patched Cape
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 4
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Wooden Bow
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Arrows
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Patched Cape
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 5
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Wooden Bow
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Arrows
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Patched Cape
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 6
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Wooden Bow
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Arrows
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Patched Cape
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set TempPoint = (Position of (Triggering unit))
Set Player_ReferenceX = (Owner of (Triggering unit))
Set Real_ReferenceX = (Facing of (Triggering unit))
Unit - Remove (Triggering unit) from the game
Unit - Create 1 Amazon for Player_ReferenceX at TempPoint facing Real_ReferenceX degrees
Custom script: call RemoveLocation (udg_TempPoint)
Set Unit_ReferenceX = (Last created unit)
Special Effect - Create a special effect attached to the origin of Unit_ReferenceX using Abilities\Spells\Other\Levelup\LevelupCaster.mdl
Special Effect - Destroy (Last created special effect)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Patched Robe Equal to (Item-type of (Item being manipulated))
Rusted Circlet Equal to (Item-type of (Item being manipulated))
Rusted Ring Equal to (Item-type of (Item being manipulated))
Collapse And - All (Conditions) are true
Collapse Conditions
((Item carried by (Triggering unit) of type Patched Robe) is owned) Equal to True
((Item carried by (Triggering unit) of type Rusted Circlet) is owned) Equal to True
((Item carried by (Triggering unit) of type Rusted Ring) is owned) Equal to True
Collapse Then - Actions
Set Integer_ReferenceX = 1
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Patched Robe
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Circlet
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Ring
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 2
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Patched Robe
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Circlet
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Ring
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 3
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Patched Robe
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Circlet
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Ring
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 4
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Patched Robe
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Circlet
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Ring
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 5
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Patched Robe
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Circlet
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Ring
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 6
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Patched Robe
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Circlet
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Ring
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set TempPoint = (Position of (Triggering unit))
Set Player_ReferenceX = (Owner of (Triggering unit))
Set Real_ReferenceX = (Facing of (Triggering unit))
Unit - Remove (Triggering unit) from the game
Unit - Create 1 Coquette for Player_ReferenceX at TempPoint facing Real_ReferenceX degrees
Custom script: call RemoveLocation (udg_TempPoint)
Set Unit_ReferenceX = (Last created unit)
Special Effect - Create a special effect attached to the origin of Unit_ReferenceX using Abilities\Spells\Other\Levelup\LevelupCaster.mdl
Special Effect - Destroy (Last created special effect)
Else - Actions


Hello everyone. Could use a quick amount of help, just for the moment. Nothing real big or urgent, just... yeah.

I'm wondering if there is a way to make this trigger shorter & more concise? I prefer to use only GUI methods.

Basically, the trigger is supposed to transform a unit into one of other three units, depending on what items have been picked up; the trigger also saves miscellaneous items that were not needed, so that during the process items not needed are not permanently lost. I feel there's a more concise way to do it than the way I did, though--even though it seems that my way works properly.

I don't know how to manage GUI fully, so I don't know if there are any shortcuts to what I had just done; however, if there is, I'd like to know. Thanks ahead of time. :D
06-30-2009, 04:48 AM#2
Vexorian
Quote:
I prefer to use only GUI methods.
Too bad, cause this function you wrote here would look beautiful if implemented through a good Jass method, specially with patch 1.24 :( I doubt so much there's a GUI alternative that does not involve you doing something incredibly crazy like a linear loop and it will still look so bad, I also know blizz well enough to know they didn't made it possible to use item types as hashtable keys, so I can't think of a good idea to simplify this using only GUI.
06-30-2009, 08:43 AM#3
Michael Peppers
As Vexorian said, linear loops could shorten the code... in GUI, but I guess it'll become slower, longer and very, very crappy when the internal compiler converts it to JASS.

It's better for you to stick with what you've got, unless... not to sound unoriginal, "unless you learn JASS".
07-01-2009, 12:38 AM#4
Ba1100n.Boi
Thanks very much nonetheless. Very appreciated. I guess I'll just stick with what I have, and hope I won't have to make any future changes to the trigger... it involved a lot of copying & pasting, ahahahah. xD
07-01-2009, 04:48 AM#5
Here-b-Trollz
If I'm not mistaken, this:
Set Integer_ReferenceX = 1
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Sword
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Shield
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Armor
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 2
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Sword
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Shield
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Armor
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 3
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Sword
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Shield
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Armor
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 4
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Sword
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Shield
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Armor
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 5
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Sword
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Shield
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Armor
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Set Integer_ReferenceX = 6
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Sword
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Shield
(Item-type of (Item carried by (Triggering unit) in slot Integer_ReferenceX)) Not equal to Rusted Armor
Collapse Then - Actions
Hero - Drop the item from slot Integer_ReferenceX of (Triggering unit)
Else - Actions
Can be condensed to this:
Actions
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Not equal to (!=) Crown of Kings +5
(Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Not equal to (!=) Crown of Kings +5
(Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Not equal to (!=) Crown of Kings +5
Collapse Then - Actions
Hero - Drop the item from slot (Integer A) of (Hero manipulating item)
Else - Actions