[Solved] How can i make it properly?

Level 18
Joined
Jun 2, 2009
Messages
1,226
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Polymorph
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • player_transformed[(Player number of (Owner of (Target unit of ability being cast)))] Equal to True
      • Then - Actions
        • Unit - Order (Triggering unit) to Stop
      • Else - Actions
        • Set player_transformed[(Player number of (Owner of (Target unit of ability being cast)))] = True
        • Wait 5.00 seconds
        • Set player_transformed[(Player number of (Owner of (Target unit of ability being cast)))] = False
        • Game - Display to (All players) for 5.00 seconds the text: (Name of transformed_unit[(Player number of (Owner of (Target unit of ability being cast)))])
After 5 seconds wait, i want to change boolean. I have to make it under 1 trigger for a reason.
Can we do that under 1 trigger? As you can imagine trigger does not detect (Name of transformed_unit[(Player number of (Owner of (Target unit of ability being cast)))])
 

Uncle

Warcraft Moderator
Level 71
Joined
Aug 10, 2018
Messages
7,634
You can use the Shadowing technique for something like this. This turns a global variable into a local variable, but with some special rules and restrictions.

Here's a setup that makes the most sense to me.
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Polymorph
  • Actions
    • Custom script: local integer udg_poly_pn
    • Set poly_pn = (Player number of (Owner of (Target unit of ability being cast)))
    • Set player_transformed[poly_pn] = True
    • Wait 5.00 seconds
    • Set player_transformed[poly_pn] = False
  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • (Ability being cast) Equal to Polymorph
    • player_transformed[(Player number of (Owner of (Target unit of ability being cast)))] Equal to True
  • Actions
    • Unit - Order (Triggering unit) to Stop
poly_pn is a new Integer variable.
 
Level 18
Joined
Jun 2, 2009
Messages
1,226
Ok ok this time i will give it a try about this local udg_ because i have started to see this everywhere.
Now i have opened the map but i have realized there are many things.
Which ones i need to copy into my map for the make it work o do not understand. There are dozens of things in the map.
My map is beyond the limits and map starts not to work after few triggers. I am trying to shrink triggers nowadays.
 

Uncle

Warcraft Moderator
Level 71
Joined
Aug 10, 2018
Messages
7,634
Ok ok this time i will give it a try about this local udg_ because i have started to see this everywhere.
Now i have opened the map but i have realized there are many things.
Which ones i need to copy into my map for the make it work o do not understand. There are dozens of things in the map.
My map is beyond the limits and map starts not to work after few triggers. I am trying to shrink triggers nowadays.
It's nothing you have to import or download. This technique is one of the many ways to keep track of a variable after a Wait.

This is it:
  • Actions
    • Custom script: local integer udg_poly_pn
    • Set poly_pn = (Player number of (Owner of (Target unit of ability being cast)))
The Custom Script is turning your global variable into a local variable.

Local variables can be used after Waits because they only exist inside of the trigger that created them. In other words, local variables create a brand new variable each time the trigger runs instead of relying on an existing Global variable that is shared between all of your other triggers.

The only issue with this technique: You CANNOT use the local variable in your If Then Else actions!
 
Last edited:
Level 18
Joined
Jun 2, 2009
Messages
1,226
LoL not solved. Can you help me please :D Pyrogasm becomes happy when i decided to question and try to learn something new. @Uncle @Pyrogasm

I am testing it with Staff of Nature (item ability) but....

Update: Hold on. I will inform you about that. Wait for my update.
Update 2: Ok it seems i forgot to turn off this one.


  • Staff of Nature Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Staff of Nature // Aktif
          • (Ability being cast) Equal to Polymorph //
          • (Ability being cast) Equal to Useless Skink //
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Transformed_Hero[(Player number of (Owner of (Target unit of ability being cast)))] Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop
          • Game - Display to (Player group((Owner of (Triggering unit)))) for 3.00 seconds the text: Dönüstürülmüs ...
        • Else - Actions
          • Set Transformed_Hero[(Player number of (Owner of (Target unit of ability being cast)))] = True
          • Set UncleTheBest = (Target unit of ability being cast)
          • Set WandofMagicReady[(Custom value of UncleTheBest)] = False
          • Special Effect - Destroy WandofMagic_Effect[(Custom value of UncleTheBest)]
          • Set GST_Trigger = Staff of Nature End <gen>
          • Set GST_ParentKey = (Custom value of UncleTheBest)
          • Set GST_ChildKey = 0
          • Custom script: call GST_Unit(udg_UncleTheBest, false, 5.00)
  • Staff of Nature End
    • Events
    • Conditions
    • Actions
      • Set Transformed_Hero[(Custom value of GST_Unit1)] = False
But it was a good coincidence for the ask. This GST System and local_udg trigger both doing the same but local_udg more simple and effective? Can we say that? And it is a good usage for the GST system?
 

Attachments

  • what.png
    what.png
    60.8 KB · Views: 6
Last edited:
Level 24
Joined
Feb 27, 2019
Messages
790
But it was a good coincidence for the ask. This GST System and local_udg trigger both doing the same but local_udg more simple and effective? Can we say that? And it is a good usage for the GST system?
I would say that the GST system is more reliable and you should use that instead. The Shadowing trick (local udg_ variable) has the same limitations as regular local variables BUT since its a naughty trick the game wont tell you if these limitations are exceeded which it would do if you were using regular local variables.
 
Top