Tutorial: Dialoged Revival Systems

2evil

New Member
Reaction score
16
Hi, this is my first tutorial EVER, so please help me and comment on what i can do to make it better! :D

Index
1. Introduction
1.1 - What is a dialoged revival system?​
1.2 - Why would I want to use one?​
2. Basic Concepts Needed
2.1 - Basic Triggering​
2.2 - Coloring Names​
3. The Variables Involved
3.1 - What is a Variable?​
3.2 - Information on Variables Used​
3.3 - In-Depth Coverage of the Used Variables​
4. The Actual Triggers
4.1 - Storing Hero Information Upon Death​
4.2 - Recalling Stored Information Upon Dialog's Request​
4.3 - Revival of Hero upon Dialog Event​
4.4 - Other Involved Triggers​
5. Manipulating for Your Uses

6. Troubleshooting


1. Introduction
1.1 - What is this anyways?
A dialoged revival system is a method to allow players to store and later revive multiple heroes cleanly and efficiently. Here is a screenshot of what it can look like, but it is flexible enough that you can customize it to suit yourself.
ResMenu.jpg

1.2 - Why use it?
Dialoged systems are all in the background, taking no map space while other methods, like using altars, do. It can also let you set the revival price using mathematical equations, giving you, the mapmaker, more power in providing a specific gameplay style to the people playing your map.


2. Basic Concepts Needed
As most editors know, one can not just begin using world editor and suddenly be able to pick up on any tutorial posted online. For that reason, I have created this section to give you a feel for where this triggering is, skill wise, and as an indicator whether you can do it.

2.1 - Basic Triggering
This trigger uses a lot of math and variables put into equations. For that reason, you MUST understand the following commonly used functions and how to use them efficiently.
Math: For loop integer A/B
Math: Arithmetic
Player: Convert Player to Integer
Variables - Discussed Later

2.2 - Player Colors
This tutorial also includes optional color schemes and player colors. Here are the color codes that I used, assigned to a size 12 string array (if you have no clue what that is, go to the variable section) These are all set in the initialization of the map. If you do not wish to use the color codes for names and such, many strings are simplified some, but this tutorial will cover using them mainly.


3. The Variables
3.1 - What is a Variable?
If you have taken basic algebra before, then you probably know what a variable is. It just something that stands for another object, or in many cases, a value. These are especially important in Warcraft 3 because you can store all sorts of information in the background to be later recalled, or manipulated. For more information on variables, check out Mr Apple's Tutorial on Variables.

3.2 - The Variables Used
Ahh, so now we actually start getting into the trigger some. This trigger uses quite a few variables to store various data. Here I will tell you the
variables, about what type they are, and how they are used in the actual trigger. Also, all of these variables are made for 10 human players, 2
computers. If you want to add 2 more human players to the mix, just add 20 to every size 100 array and 2 to every size 10 array.
an artifact from the past
When I first made this tutorial, I was trying to make each player have 10 slots for revivable heroes. However, this of course did not work out for some odd reason, I think that it turns out to be too many call functions later in the trigger for Warcraft 3 to do at once. For this reason, only 7 out of the 10 slots are used, a small inefficiency. If you want to remove this, just turn every 10 into a 7 and every 100 into a 70.

3.3 - In Depth
Slain_Heros - Unit Array, size 100
This is where all the killed heroes reside as one of their last resting spots. This is the main variable in this trigger, as it stores all of the heroes available for resurrection by the players. Slots 1-10 are for player 1, 11-20 for player 2, and so on. Later, that is reduced down to the formula of ((10(player number-1))+1) through ((10(player number-1))+10).​
Slain_Hero_Gold - Integer Array, Size 100
This is the exactly same thing as Slain_Heros, except it stores how much gold it takes to revive a specific hero. Slot x in this corresponds to slot x on Slain_Heros.​
Slain_Heros_Total - Integer Array, Size 10
Think of this variable as an index. It tells the trigger how many heroes each player has, preventing too many or too few buttons.​
Res_hero_diag/Res_hero_diag_button - Dialog/Dialog Button Variables, button array size 10
Temp_Point - Point Variable
This variable is solely for removing those pesky leaks. For more
information on leaks, read
emjlr3's Memory
Leak / Custom Script Guide
.


4. The Triggers
To define variable terms from now on, PLEASE read the following or you WILL get lost!
player number of owner of hero/unit = Player #

4.1 - Storing Hero Information Upon Death
First of all, we need something to store the information of a hero upon its death. So lets make a new trigger and call it 'Hero Death'. This will trigger upon a death of a hero, with a check making sure that the hero has no item that can revive it. So this is what it should look like so far:
Code:
Hero Death
    Events
        Unit - A unit Dies
    Conditions
        ((Triggering unit) has an item of type Ankh of Reincarnation) Equal to False
        ((Triggering unit) is A Hero) Equal to True
    Actions
Now we need to make all of the hero's data store in the variables. It is very important to pay very careful attention to this because one wrong number and the whole system is shot. So going back to the variables we have:
Slain_Hero_Total - need to set slot x (where x=Player #) to slot x+1. Essentially we are just telling it that one more hero died and the new total for slot x should equal the total number of dead heroes for player x.
Slain_Heros_Gold - need to set slot x (where x=10(Player #-1)+(Slain_Hero_Total[Player #]) to the amount of the revive cost. Slot x is one of the 100 unique spots in the array that correspond to the hero in Slain_Heros.
Slain_Heros - need to set slot x (where x=10(Player #-1)+(Slain_Hero_Total[Player #]) to the dying unit. This is so the hero can be saved and then revived later.​
So now with those additions, your trigger should look a little like this:
Code:
Hero Death
    Events
        Unit - A unit Dies
    Conditions
        ((Triggering unit) has an item of type Ankh of Reincarnation) Equal to False
        ((Triggering unit) is A Hero) Equal to True
    Actions
        [b]Set Slain_Hero_Total[(Player number of (Owner of (Triggering unit)))] = (Slain_Hero_Total[(Player number of (Owner of (Triggering unit)))] + 1)[/b]
        Game - Display to (Player group((Owner of (Triggering unit)))) for 5.00 seconds the text: Your hero has been ...
        [b]Set Slain_Heros[(Slain_Hero_Total[(Player number of (Owner of (Triggering unit)))] + (((Player number of (Triggering player)) - 1) x 10))] = (Triggering unit)[/b]
        [b]Set Slain_Heros_Gold_array[(Slain_Hero_Total[(Player number of (Owner of (Triggering unit)))] + (((Player number of (Triggering player)) - 1) x 10))] = (((Hero level of (Triggering unit)) x 100) + 50)[/b]
        Set Temp_Point = (Center of Spawn Revive or New Choosers <gen>)
        Unit - Create 1 Hero Respawn Chooser for (Owner of (Triggering unit)) at Temp_Point facing 180.00 degrees
        Camera - Pan camera for (Owner of (Triggering unit)) to Temp_Point over 2.00 seconds
        Custom script:   call RemoveLocation (udg_Temp_Point)
        Unit - Change ownership of (Triggering unit) to Neutral Passive and Retain color
The last action may look to serve no purpose, but it removes the hero from the side of the player's screen. You can not altogether remove the unit though, as removing it will null the slot that it is set to and get rid of the hero from the entire game. Of course, we have to add the where the new chooser spawns so the player can select whether to revive or pick a new hero. Since these are not hard, they have already been added in the step ahead and are not bold. So now that trigger is finished and all of the heroes are stored upon death. So now we move on to the hardest part: the dialog creation.


4.2 - Recalling Stored Information Upon Dialog's Request
For almost all of you out there, this is going to be confusing, just because the sheer volume of information put into one single action. I have condensed what could easily be anywhere from 10-100 separate triggers into one through the use of a loop and event responses. If you have never created a dialog before, then this may be difficult, but I will try to explain as much as possible.

So first we start out with a basic dialog button trigger, which uses the variable Res_hero_diag_button for the buttons and Res_hero_diag for the dialog. That is pretty simple, so here is the trigger, with the part that actually creates and names the buttons. The italicized part is what we will work on next.
Code:
Res Hero Dialog
    Events
        Unit - A unit enters Revive Hero <gen>
    Conditions
    Actions
        Dialog - Clear Res_hero_diag
        Dialog - Change the title of Res_hero_diag to ((|c + (Player_Colors[(Player number of (Triggering player))] + Your|r)) +  dead Heroes)
        [i]For each (Integer A)[/i]
        Dialog - Create a dialog button for Res_hero_diag labelled Exit
        Set Res_hero_diag_button[0] = (Last created dialog Button)
        Dialog - Show Res_hero_diag for (Owner of (Triggering unit))
        Unit - Explode (Triggering unit)

So now we just have make it display our buttons. For each player, there can be up to x buttons (where x less than or equal to 7) and thus there must be a loop that goes from 1 to x. However, since the variable that the heroes and all their data is stored on has 100 slots, with player y's info stored on slots 10(y-1)+1 though 10(y-1)+x, we must adjust the loop. So here is what your final loop should look like. It is currently missing any actions.
Code:
For each (Integer A) from ((((Player number of (Triggering player)) - 1) x 10) + 1) to ((((Player number of (Triggering player)) - 1) x 10) + Slain_Hero_Total[(Player number of (Owner of (Triggering unit)))]), do (Actions)
    Loop - Actions

Now to finally make that dialog button. You can have it say anything in the world you want, but WE has a character limit on copying triggers our of the map, so you may want to inspect the one i made. But here is the structure for recalling information from any of the arrays (gold amount, hero stats/info)
Integer A will always refer to the slot where the hero resides in, as we adjusted it in the trigger above. This way, you can simply recall data with the all the hero functions (proper name of hero, level, etc) and then point them to hero Slain_Heros[integer a]. Have fun with this and create your own style. If you are too lazy though, or need an example, check out the map.

Finally, we must set that last created dialog button to the variable array Res_hero_diag_button. This could be a simple 10-size button array, but if two people had the same dialog open at once, they may be reviving each other's heroes. Which would not be good. So we must make this a 100-size array and because it is not the same size of loop a, we must define it with the same loop function that we did the dialog button creation but add 10(Player #-1). So just have it set variable Res_hero_diag_button[integer a + 10(Player #-1)]=last created dialog button. This is that final trigger now:
Code:
Res Hero Dialog
    Events
        Unit - A unit enters Revive Hero <gen>
    Conditions
    Actions
        Dialog - Clear Res_hero_diag
        Dialog - Change the title of Res_hero_diag to ((|c + (Player_Colors[(Player number of (Triggering player))] + Your|r)) +  dead Heroes)
        For each (Integer A) from ((((Player number of (Triggering player)) - 1) x 10) + 1) to ((((Player number of (Triggering player)) - 1) x 10) + Slain_Hero_Total[(Player number of (Owner of (Triggering unit)))]), do (Actions)
            Loop - Actions
                Dialog - Create a dialog button for Res_hero_diag labelled (((|c + Player_Colors[(Player number of (Owner of (Triggering unit)))]) + (Proper name of Slain_Heros[(Integer A)])) + (|r - |c00B3EE3ALevel  + ((String((Hero level of Slain_Heros[(Integer A)]))) + (  + ((Name of Slain_Heros[(Integer A)]) + (|r + ( |n|c00DAA5
                Set Res_hero_diag_button[((Integer A) - (((Player number of (Triggering player)) - 1) x 10))] = (Last created dialog Button)
        Dialog - Create a dialog button for Res_hero_diag labelled Exit
        Set Res_hero_diag_button[0] = (Last created dialog Button)
        Dialog - Show Res_hero_diag for (Owner of (Triggering unit))
        Unit - Explode (Triggering unit)


4.3 - Revival of Hero upon Dialog Event
So now that you have gotten the trigger up above, give yourself a pat on the back. But now heres another trigger which can be confusing. Hopefully I can break it up enough that anyone out there can receive it. Luckily though, I have just reworked most of the trigger to remove the 10(Player #-1) function, which saves much time and makes everything a lot more simple looking.

4.3.1 - The loop
Since each player can press one of up to 7 (or 10) buttons, a question is presented to us: how can we consolidate 7-10 event responses into one trigger that automatically sorts it and executes the correct actions? The answer is simple: one loop with the range of 1+10(Player #-1) to Slain_Hero_Total[Player #]+10(Player #-1). This way it will run the trigger with all possible buttons the player could have pressed, identifying them with conditions. So heres our code so far:
Code:
Res Loop
    Events
        Dialog - A dialog button is clicked for Res_hero_diag
    Conditions
    Actions
        For each (Integer A) from (1 + (((Player number of (Triggering player)) - 1) x 10)) to (Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10)), do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Clicked dialog button) Equal to Res_hero_diag_button[(Integer A)]
                    Then - Actions

4.3.2 - The actions
So now, lets figure out what we need the rest of the trigger to do. First of all, we need it to check if the player has enough money to revive the hero. Since the revival is all triggered, so is the money transaction. Theres also the following major actions that must be done
Change ownership of hero, revive
Subtract gold
Reset variables/Consolidation
Remove leaks​
4.3.3 - Changing Ownership, Reviving
Since we changed the unit into a neutral passive one in the trigger that stored the hero, we must now change it back to the triggering player's control and revive it. This is pretty simple, containing only two triggers.
Code:
Unit - Change ownership of Slain_Heros[(Integer A)] to (Triggering player) and Retain color
Hero - Instantly revive Slain_Heros[(Integer A)] at Temp_Point, Show revival graphics

4.3.4 - Subtracting the moolah!
Now for the part that the players hate: the dropping of their cash to low amounts! Since WE does not give us a simple way to subtract gold from a player, we just have to add (0-[amount]) to a player's amount. This is simple, just subtracting the value from the array like so:
Code:
Player - Add (0 - Slain_Heros_Gold_array[(Integer A)]) to (Triggering player) Current gold

4.3.5 - Resetting the variables/Consolidation
However, once a hero is revived, we still need to go and reset the variables so the hero is not reused. But here we run into a problem because if we just set the slot that that particular hero was in, the next dead hero will not go in the correct slot. Refer to the table below:
Slot 1 - Archmage
Slot 2 -
Slot 3 - Paladin
Slot 4 - Mountain King
Slot 5 - Blood Mage
Slot 6 -
Total Amount:4
Since the next hero goes in slot (total amount+1), the Blood Mage would get overwritten. Therefore, we must consolidate the array, moving the Blood Mage into Slot 2. The same must be done with the currency. So heres the trigger for that, its pretty pretty easy, code wise:
Code:
[b]consolidation[/b] Set Slain_Heros[(Integer A)] = Slain_Heros[(Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10))]
[b]nullification[/b] Set Slain_Heros[(Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10))] = No unit
[b]consolidation[/b] Set Slain_Heros_Gold_array[(Integer A)] = Slain_Heros_Gold_array[(Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10))]
[b]nullification[/b] Set Slain_Heros_Gold_array[(Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10))] = 0

4.3.6 - Leak removal
This is pretty easy. I you look, you would notice that all location variables are already set to [Temp_Point]. So in the beginning of the trigger, just set [Temp_Point] to the location that you want the spawn in and then clear it in the end. Basic leak removal, heres the resulting trigger so far:

Code:
Res Loop
    Events
        Dialog - A dialog button is clicked for Res_hero_diag
    Conditions
    Actions
        For each (Integer A) from (1 + (((Player number of (Triggering player)) - 1) x 10)) to (Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10)), do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Clicked dialog button) Equal to Res_hero_diag_button[(Integer A)]
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) Current gold) Greater than or equal to Slain_Heros_Gold_array[(Integer A)]
                            Then - Actions
                                Set Temp_Point = (Center of Spawn Heros <gen>)
                                Unit - Change ownership of Slain_Heros[(Integer A)] to (Triggering player) and Retain color
                                Hero - Instantly revive Slain_Heros[(Integer A)] at Temp_Point, Show revival graphics
                                Camera - Pan camera for (Triggering player) to Temp_Point over 2.00 seconds
                                Player - Add (0 - Slain_Heros_Gold_array[(Integer A)]) to (Triggering player) Current gold
                                Set Slain_Heros[(Integer A)] = Slain_Heros[(Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10))]
                                Set Slain_Heros[(Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10))] = No unit
                                Set Slain_Heros_Gold_array[(Integer A)] = Slain_Heros_Gold_array[(Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10))]
                                Set Slain_Heros_Gold_array[(Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10))] = 0
                                Set Slain_Hero_Total[(Player number of (Triggering player))] = (Slain_Hero_Total[(Player number of (Triggering player))] - 1)
                                Dialog - Hide Res_hero_diag for (Triggering player)
                                Custom script:   call RemoveLocation (udg_Temp_Point)

4.3.7 - The remainder of the trigger
Okay so we are almost done with this trigger now. All we have to do is make it so if the player clicks on button #0 (exit) or does not have enough money, they get their chooser back. This is just create unit in location X for player X and display a message to player X. The triggers look like this:
If a player does not have the money
Code:
Else - Actions
    Set Temp_Point = (Center of Spawn Revive or New Choosers <gen>)
    Unit - Create 1 Hero Respawn Chooser for (Triggering player) at Temp_Point facing Default building facing degrees
    Game - Display to (Player group((Triggering player))) for 4.00 seconds the text: (You need |c00DAA520 + ((String(Slain_Heros_Gold_array[(Integer A)])) + ( gold|r to revive this hero. + ( You only have |c00DAA520 + ((String(((Triggering player) Current gold))) +  gold|r)))))
    Custom script:   call RemoveLocation (udg_Temp_Point)
If a player presses Button 0
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        (Clicked dialog button) Equal to Res_hero_diag_button[0]
    Then - Actions
        Set Temp_Point = (Center of Spawn Revive or New Choosers <gen>)
        Dialog - Hide Res_hero_diag for (Triggering player)
        Unit - Create 1 Hero Respawn Chooser for (Triggering player) at Temp_Point facing Default building facing degrees
        Camera - Pan camera for (Triggering player) to Temp_Point over 0.50 seconds
        Custom script:   call RemoveLocation (udg_Temp_Point)
    Else - Actions

4.3.8 - The finished trigger
Finished!!
Code:
Res Loop
    Events
        Dialog - A dialog button is clicked for Res_hero_diag
    Conditions
    Actions
        For each (Integer A) from (1 + (((Player number of (Triggering player)) - 1) x 10)) to (Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10)), do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Clicked dialog button) Equal to Res_hero_diag_button[(Integer A)]
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) Current gold) Greater than or equal to Slain_Heros_Gold_array[(Integer A)]
                            Then - Actions
                                Set Temp_Point = (Center of Spawn Heros <gen>)
                                Unit - Change ownership of Slain_Heros[(Integer A)] to (Triggering player) and Retain color
                                Hero - Instantly revive Slain_Heros[(Integer A)] at Temp_Point, Show revival graphics
                                Camera - Pan camera for (Triggering player) to Temp_Point over 2.00 seconds
                                Player - Add (0 - Slain_Heros_Gold_array[(Integer A)]) to (Triggering player) Current gold
                                Set Slain_Heros[(Integer A)] = Slain_Heros[(Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10))]
                                Set Slain_Heros[(Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10))] = No unit
                                Set Slain_Heros_Gold_array[(Integer A)] = Slain_Heros_Gold_array[(Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10))]
                                Set Slain_Heros_Gold_array[(Slain_Hero_Total[(Player number of (Triggering player))] + (((Player number of (Triggering player)) - 1) x 10))] = 0
                                Set Slain_Hero_Total[(Player number of (Triggering player))] = (Slain_Hero_Total[(Player number of (Triggering player))] - 1)
                                Dialog - Hide Res_hero_diag for (Triggering player)
                                Custom script:   call RemoveLocation (udg_Temp_Point)
                            Else - Actions
                                Set Temp_Point = (Center of Spawn Revive or New Choosers <gen>)
                                Unit - Create 1 Hero Respawn Chooser for (Triggering player) at Temp_Point facing Default building facing degrees
                                Game - Display to (Player group((Triggering player))) for 4.00 seconds the text: (You need |c00DAA520 + ((String(Slain_Heros_Gold_array[(Integer A)])) + ( gold|r to revive this hero. + ( You only have |c00DAA520 + ((String(((Triggering player) Current gold))) +  gold|r)))))
                                Custom script:   call RemoveLocation (udg_Temp_Point)
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Clicked dialog button) Equal to Res_hero_diag_button[0]
            Then - Actions
                Set Temp_Point = (Center of Spawn Revive or New Choosers <gen>)
                Dialog - Hide Res_hero_diag for (Triggering player)
                Unit - Create 1 Hero Respawn Chooser for (Triggering player) at Temp_Point facing Default building facing degrees
                Camera - Pan camera for (Triggering player) to Temp_Point over 0.50 seconds
                Custom script:   call RemoveLocation (udg_Temp_Point)
            Else - Actions


4.4 - Other involved triggers
In many maps, you may want to provide an alternative to only allowing someone to revive a hero. In this case, you must also add the option to select a hero. This is already built into the test map and is really quite simple. All you must do is create another trigger where if the chooser goes into region [new_hero] then a new dialog comes up, asking them to affirm their action. And then have a check to see if the player has already maxed out on heroes (remember the array can only hold 7 per player). So those two triggers look like this:
Upon Entry
Code:
New Hero
    Events
        Unit - A unit enters New Hero <gen>
    Conditions
    Actions
        Dialog - Clear New_H_diag_main
        Dialog - Change the title of New_H_diag_main to New Hero?
        Dialog - Create a dialog button for New_H_diag_main labelled Yes
        Set New_H_diag_buttons[1] = (Last created dialog Button)
        Dialog - Create a dialog button for New_H_diag_main labelled No
        Set New_H_diag_buttons[2] = (Last created dialog Button)
        Dialog - Show New_H_diag_main for (Owner of (Triggering unit))
        Unit - Explode (Triggering unit)
Upon Confirmation
Code:
New Loop
    Events
        Dialog - A dialog button is clicked for New_H_diag_main
    Conditions
    Actions
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player number of (Triggering player)) Equal to (Integer A)
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Clicked dialog button) Equal to New_H_diag_buttons[1]
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        Slain_Hero_Total[(Integer A)] Less than or equal to 7
                                    Then - Actions
                                        Set Temp_Point = (Center of Spawn Hero Choosers <gen>)
                                        Dialog - Hide New_H_diag_main for (Triggering player)
                                        Unit - Create 1 Hero Chooser for (Triggering player) at Temp_Point facing Default building facing degrees
                                        Camera - Pan camera for (Triggering player) to Temp_Point over 1.00 seconds
                                        Custom script:   call RemoveLocation (udg_Temp_Point)
                                    Else - Actions
                                        Set Temp_Point = (Center of Spawn Revive or New Choosers <gen>)
                                        Dialog - Hide New_H_diag_main for (Triggering player)
                                        Unit - Create 1 Hero Respawn Chooser for (Triggering player) at Temp_Point facing Default building facing degrees
                                        Camera - Pan camera for (Triggering player) to Temp_Point over 0.50 seconds
                                        Game - Display to (Player group((Triggering player))) for 5.00 seconds the text: |c00CC3300You alrea...
                                        Custom script:   call RemoveLocation (udg_Temp_Point)
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Clicked dialog button) Equal to New_H_diag_buttons[2]
                            Then - Actions
                                Set Temp_Point = (Center of Spawn Revive or New Choosers <gen>)
                                Dialog - Hide New_H_diag_main for (Triggering player)
                                Unit - Create 1 Hero Respawn Chooser for (Triggering player) at Temp_Point facing Default building facing degrees
                                Camera - Pan camera for (Triggering player) to Temp_Point over 0.50 seconds
                                Custom script:   call RemoveLocation (udg_Temp_Point)
                            Else - Actions
                    Else - Actions


5. Manipulating for your uses
Now this tutorial would not do any good here if it taught you how to make one fixed variation of this, so heres how you can manipulate all of this for your purposes.

5.1 Different Amounts of People
This is probably the simplest of all the changes you can make to a map. All of the arrays are created using either of two formulas:
slots=10(amount of players)
slots=(amount of players)
so if some array is currently a size 100 (configured for 10 people) and you only want to have 4 people in the game, simply make the array into a size 40 array. Easy, eh?

5.2 Different Amounts of Stored heroes
As I mentioned earlier, there are limitations to this system. I have been able to get success when theres only 7 or less heroes per person, otherwise it starts drawing blanks. However, as also mentioned earlier, I never changed back the demonstration system, as this tutorial was already written. But anyways, there are two ways of changing the amount of stored heroes:
The simple way - This is the way I elected to do when I found out that the limit was 7 heroes. You don't mess with any arrays; you just make it so that a player cannot get a new hero if the variable Slain_Heros_Total is greater than your desired amount. True, it leave some variables behind that take up space, but not much at all.
The not so simple way - You do the same thing as you did in the simple way, but you edit all the arrays as well and change the numbers that define the slots [10(Player #-1)]. In this case the 10 would change to the amount of slots you want per player.

5.3 Different Purposes Altogether
The concepts covered in this can be made to create almost any system where variables define each other, and as people ask questions on other applications, i will post other methods here


6 Troubleshooting
This will be updated as others have problems :D



Thank You, and Good Luck!!
-2evil
 

Attachments

  • Revival Dialog Tutorial.w3x
    26.4 KB · Views: 116

Chocobo

White-Flower
Reaction score
409
Slain_Heros - Unit Array, size 100

This is where all the killed heroes reside as one of their last resting spots. This is the main variable in this trigger, as it stores all of the heroes available for resurrection by the players. Slots 1-10 are for player 1, 11-20 for player 2, and so on. Later, that is reduced down to the formula of ((10(player number-1))+1) through ((10(player number-1))+10).

Slain_Hero_Gold - Integer Array, Size 100

This is the exactly same thing as Slain_Heros, except it stores how much gold it takes to revive a specific hero. Slot x in this corresponds to slot x on Slain_Heros.

Slain_Heros_Total - Integer Array, Size 10

Think of this variable as an index. It tells the trigger how many heroes each player has, preventing too many or too few buttons.

Res_hero_diag/Res_hero_diag_button - Dialog/Dialog Button Variables, button array size 10
Temp_Point - Point Variable
This variable is solely for removing those pesky leaks. For more
information on leaks, read​


No size required.


For each (Integer A)

???


2.1 - Basic Triggering
This trigger uses a lot of math and variables put into equations. For that reason, you MUST understand the following commonly used functions and how to use them efficiently.
Math: For loop integer A/B
Math: Arithmetic
Player: Convert Player to Integer
Variables - Discussed Later

You forget 3 Dimentional Arrays you used (maybe you didn't see).


an artifact from the past
When I first made this tutorial, I was trying to make each player have 10 slots for revivable heroes. However, this of course did not work out for some odd reason, I think that it turns out to be too many call functions later in the trigger for Warcraft 3 to do at once. For this reason, only 7 out of the 10 slots are used, a small inefficiency. If you want to remove this, just turn every 10 into a 7 and every 100 into a 70.

Depends. RoC oldest versions are 5 dialog buttons.​
 

2evil

New Member
Reaction score
16
You were asking about the 'For each (Integer A)' function chocobo?
Where in the tutorial is it hazy, I use it so many times lol

and for those that do not know 'For each (Integer A)'='loop integer A' function


I fixed that fact that i forgot to mention 3-d arrays, and I am not sure if this works in RoC, I use the TFT editor

-2evil
 

Chocobo

White-Flower
Reaction score
409
You were asking about the 'For each (Integer A)' function chocobo?
Where in the tutorial is it hazy, I use it so many times lol

and for those that do not know 'For each (Integer A)'='loop integer A' function


I fixed that fact that i forgot to mention 3-d arrays, and I am not sure if this works in RoC, I use the TFT editor

-2evil

If arrays exist in RoC, 3D or 4D exists for sure, since they are only called obviously 2D depending on their usage.

Bah? RoC do not handle multiple functions inside a For Loop.


For Each Integer A from X to Y = Loop starting from X, every loop, X is set to X+1, and if X is equal to Y, the loop ends. All actions inside the loop is looped until the X = Y.
 
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

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top