Need guidance with my triggers.

Cookie!

Member
Reaction score
0
I started making maps for Warcraft sometime ago, but I've never had anyone take a look at my triggers to tell me if they're any good (or absolute rubbish :eek:), so, well, here goes.

These triggers are supposed to detect if a Hero dies, wait for a period of time, and then revive the Hero back at his/her base; it's the typical revive system you see in most AoS style maps.

I'd like to know...
1) Is it any good at all?
2) Is it leak-free?
3) Is it MUI?
4) Any improvements?

(It does work, if that's any help :p)



Variables used:
Dead_Heroes - Unit[16]
Hero_Is_Dead - Boolean[16]
Seconds_To_Revive - Integer[16]
Num_Dead_Heroes - Integer
Hero_Revive_Timer - Timer[16]
Hero_Revive_Timer_Window - Timer Window[16]

temp_int, temp_unit_group etc are all exactly what they say.

Trigger # 1, Always ON.
Trigger:
  • Hero Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • Set Dead_Heroes[((Player number of (Owner of (Dying unit))) - 1)] = (Dying unit)
      • Set Hero_Is_Dead[((Player number of (Owner of (Dying unit))) - 1)] = True
      • Set Seconds_To_Revive[((Player number of (Owner of (Dying unit))) - 1)] = (((Hero level of (Dying unit)) / 3) + 10)
      • Set Num_Dead_Heroes = (Num_Dead_Heroes + 1)
      • Countdown Timer - Start Hero_Revive_Timer[((Player number of (Owner of (Dying unit))) - 1)] as a One-shot timer that will expire in (Real(Seconds_To_Revive[((Player number of (Owner of (Dying unit))) - 1)])) seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title Hero Respawns In
      • Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
      • Set Hero_Revive_Timer_Window[((Player number of (Owner of (Dying unit))) - 1)] = (Last created timer window)
      • Trigger - Turn on Revive Hero <gen>


Trigger # 2, initially OFF.
Trigger:
  • Revive Hero
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer temp_int) from 0 to 15, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Hero_Is_Dead[temp_int] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Seconds_To_Revive[temp_int] Greater than 0
                • Then - Actions
                  • Set Seconds_To_Revive[temp_int] = (Seconds_To_Revive[temp_int] - 1)
                • Else - Actions
                  • Countdown Timer - Hide Hero_Revive_Timer_Window[temp_int] for (Player((temp_int + 1)))
                  • Countdown Timer - Destroy Hero_Revive_Timer_Window[temp_int]
                  • Set temp_unit_group = (Units owned by (Player((temp_int + 1))) matching (((Matching unit) is A structure) Equal to True))
                  • Set temp_point = (Position of (First unit of group temp_unit_group))
                  • Hero - Instantly revive Dead_Heroes[temp_int] at temp_point, Show revival graphics
                  • Set Hero_Is_Dead[temp_int] = False
                  • Set Num_Dead_Heroes = (Num_Dead_Heroes - 1)
                  • Selection - Select Dead_Heroes[temp_int] for (Player((temp_int + 1)))
                  • Camera - Pan camera for (Player((temp_int + 1))) to temp_point over 0.50 seconds
            • Else - Actions
              • Do nothing
      • Unit Group - Destroy unit group temp_unit_group
      • Point - Remove temp_point
      • If (Num_Dead_Heroes Less than 1) then do (Trigger - Turn off (This trigger)) else do (Do nothing)


Every player has only one Hero, and only one building, by the way.

So, have a look, and give me your opinion :).
 

M0RBiD

New Member
Reaction score
0
you would better to use somthing like this

Event
------- Unit owning by player 1 Dies
Action
------- Wait x Seconds
------- Revive at (Any Location)


Event
------- Unit owning by player 2 Dies
Action
------- Wait x Seconds
------- Revive at (Any Location)

and for each player use one triger . . .
it was my idea and used it in my own map . . .
sry if is not good . . .
 

vypur85

Hibernate
Reaction score
803
Code:
Revive Hero
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        For each (Integer temp_int) from 0 to 15, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Hero_Is_Dead[temp_int] Equal to True
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Seconds_To_Revive[temp_int] Greater than 0
                            Then - Actions
                                Set Seconds_To_Revive[temp_int] = (Seconds_To_Revive[temp_int] - 1)
                            Else - Actions
                                Countdown Timer - Hide Hero_Revive_Timer_Window[temp_int] for (Player((temp_int + 1)))
                                Countdown Timer - Destroy Hero_Revive_Timer_Window[temp_int]
                                Set temp_unit_group = (Units owned by (Player((temp_int + 1))) matching (((Matching unit) is A structure) Equal to True))
                                Set temp_point = (Position of (First unit of group temp_unit_group))
                                Hero - Instantly revive Dead_Heroes[temp_int] at temp_point, Show revival graphics
                                Set Hero_Is_Dead[temp_int] = False
                                Set Num_Dead_Heroes = (Num_Dead_Heroes - 1)
                                Selection - Select Dead_Heroes[temp_int] for (Player((temp_int + 1)))
                                Camera - Pan camera for (Player((temp_int + 1))) to temp_point over 0.50 seconds
                                [B]Unit Group - Destroy unit group temp_unit_group
                                Point - Remove temp_point[/B]
                    Else - Actions
                        Do nothing
        If (Num_Dead_Heroes Less than 1) then do (Trigger - Turn off (This trigger)) else do (Do nothing)

Change to the bolded ones above. Haven't checked thoroughly though.
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
besides the stuff vypur85 already mentioned (moving the "remove location" action inside the loop) there are no major flaws i can see with these triggers.
but, in the first trigger i would definitely declare a temp_int variable for ((Player number of (Owner of (Dying unit))) - 1), it would make things alot easier to read and to understand, and of course the most important, to change.
another thing is that you ask us if your trigger is MUI, it is not, but as you already said it isnt meant to be in the first place.
MUI would mean it will work for any unit on the whole map (as long as it reaches certain conditions), your trigger is designed to work only for a single unit of each player, this is called MPI.
 

Cookie!

Member
Reaction score
0
MUI would mean it will work for any unit on the whole map (as long as it reaches certain conditions), your trigger is designed to work only for a single unit of each player, this is called MPI.

Ah, I see. Had those two confused with each other :eek:.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top