[?]Random Integer Conditions Action Triggers

Z

Zerotech

Guest
I could use some help regarding Random Integer value conditions.

What I've done so far, theorectically speaking, about duel arenas. Based on the coding for Angel Arena maps they use the fixed integer functions so whoever has a highest kills in the team will be picked to participate in the match.

But what if I decided that I don't like that rule and I like to alter it? Based on random integer values so a no. from 1 to 6 for eg. if the no. is 4 for example then player 4 will be picked, but if that player is unavailable then it will continue to randomly pick in a loop until an available hero is playing.

Based on Angel Arena's Highest Kills Priority Coding

Code:
Start Duel
    Events
        Time - Duel expires
    Conditions
    Actions
        Unit - Pause all units
        Game - Display to (All players) the text: Two have been chose...
        Set bPasued = True
        Set bDuel = True
        Countdown Timer - Start DuelTime as a One-shot timer that will expire in 120.00 seconds
        Sound - Stop music After fading
        Wait 3.00 seconds
        Player Group - Pick every player in (All players) and do (Camera - Pan camera for (Picked player) to (Center of Duel Arena <gen>) over 1.00 seconds)
        For each (Integer A) from 1 to 12, do (Set HeroSavePoints[(Integer A)] = (Position of Heroes[(Integer A)]))
        For each (Integer A) from 1 to 12, do (Set HeroSaveDirection[(Integer A)] = (Facing of Heroes[(Integer A)]))
        For each (Integer A) from 1 to 12, do (Unit - Move Heroes[(Integer A)] instantly to (Center of HeroDuelSpots[(Integer A)]))
        For each (Integer A) from 1 to 12, do (Unit - Make Heroes[(Integer A)] face (Center of Duel Arena <gen>) over 0.00 seconds)
        For each (Integer A) from 1 to 12, do (Unit - Make Heroes[(Integer A)] Invulnerable)
        Set TempMaxKill = 0
        For each (Integer A) from 1 to 6, do (If ((Kills[(Integer A)] Greater than TempMaxKill) and (((Player((Integer A))) slot status) Equal to Is playing)) then do (Set TempMaxKill = Kills[(Integer A)]) else do (Do nothing))
        For each (Integer A) from 1 to 6, do (If ((Kills[(Integer A)] Equal to TempMaxKill) and (((Player((Integer A))) slot status) Equal to Is playing)) then do (Set Team1Leader = (Integer A)) else do (Do nothing))
        Set Team1LeaderHero = Heroes[Team1Leader]
        Unit - Move Team1LeaderHero instantly to (Center of Team One Dueler <gen>)
        Unit - Set life of Team1LeaderHero to 100.00%
        Unit - Set mana of Team1LeaderHero to 100.00%
        Unit - Make Team1LeaderHero Vulnerable
        Set TempMaxKill = 0
        For each (Integer A) from 7 to 12, do (If ((Kills[(Integer A)] Greater than TempMaxKill) and (((Player((Integer A))) slot status) Equal to Is playing)) then do (Set TempMaxKill = Kills[(Integer A)]) else do (Do nothing))
        For each (Integer A) from 7 to 12, do (If ((Kills[(Integer A)] Equal to TempMaxKill) and (((Player((Integer A))) slot status) Equal to Is playing)) then do (Set Team2Leader = (Integer A)) else do (Do nothing))
        Set Team2LeaderHero = Heroes[Team2Leader]
        Unit - Move Team2LeaderHero instantly to (Center of Team Two Dueler <gen>)
        Unit - Set life of Team2LeaderHero to 100.00%
        Unit - Set mana of Team2LeaderHero to 100.00%
        Unit - Make Team2LeaderHero Vulnerable
        Game - Display to (All players) the text: ((Name of (Player(Team1Leader))) + ( Vs  + (Name of (Player(Team2Leader)))))
        Wait 5.00 seconds
        Sound - Play Credits <gen>
        Game - Display to (All players) the text: 3!
        Wait 1.00 seconds
        Game - Display to (All players) the text: 2!
        Wait 1.00 seconds
        Game - Display to (All players) the text: 1!
        Wait 1.00 seconds
        Game - Display to (All players) the text: Let battle be joine...
        Unit - Unpause Team1LeaderHero
        Unit - Unpause Eye of Sauron 0235 <gen>
        Unit - Unpause Team2LeaderHero
        Unit - Unpause Eye of Sauron 0236 <gen>

And here I've rewritten the code using some modified random integer values

Code:
Activate Duel Arena
    Events
    Conditions
    Actions
        Set bDuelArena = True
        Set bMultiArena = False
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Player Group - Pick every player in Team1Players and do (Actions)
                    Loop - Actions
                        If ((Random integer number between 1 and 6) Equal to 0) then do (Do nothing) else do (Set TeamDuelUnit1 = HeroPlayer[(Integer A)])
                        Set Team1DuelPos = (Center of Team1 Duel Position <gen>)
                        Set CameraViewTarget = (Center of Center of Duel Arena <gen>)
                        Unit - Move TeamDuelUnit1 instantly to Team1DuelPos, facing CameraViewTarget
                        Custom script: call RemoveLocation(udg_Team1DuelPos)
                        Custom script: call RemoveLocation(udg_CameraViewTarget)
        For each (Integer A) from 7 to 12, do (Actions)
            Loop - Actions
                Player Group - Pick every player in Team1Players and do (Actions)
                    Loop - Actions
                        If ((Random integer number between 7 and 12) Equal to 0) then do (Do nothing) else do (Set TeamDuelUnit2 = HeroPlayer[(Integer A)])
                        Set Team2DuelPos = (Center of Team2 Duel Position <gen>)
                        Set CameraViewTarget = (Center of Center of Duel Arena <gen>)
                        Unit - Move TeamDuelUnit2 instantly to Team2DuelPos, facing CameraViewTarget
                        Custom script: call RemoveLocation(udg_Team2DuelPos)
                        Custom script: call RemoveLocation(udg_CameraViewTarget)
        Game - Display to (All players) for 5.00 seconds the text: ((Name of TeamDuelUnit1) + ( vs  + (Name of TeamDuelUnit2)))
        Sound - Play ArrangedTeamInvitation <gen>
        Unit - Set life of TeamDuelUnit1 to 100.00%
        Unit - Set mana of TeamDuelUnit1 to 100.00%
        Unit - Set life of TeamDuelUnit2 to 100.00%
        Unit - Set mana of TeamDuelUnit2 to 100.00%
        Wait 5.00 seconds
        Sound - Set music volume to 100.00%
        Sound - Play Credits <gen>
        Game - Display to (All players) for 5.00 seconds the text: Duel Arena begins i...
        Wait 3.00 seconds
        Game - Display to (All players) for 1.00 seconds the text: 3!
        Sound - Play BattleNetTick <gen>
        Wait 1.00 seconds
        Game - Display to (All players) for 1.00 seconds the text: 2!
        Sound - Play BattleNetTick <gen>
        Wait 1.00 seconds
        Game - Display to (All players) for 1.00 seconds the text: 1!
        Sound - Play BattleNetTick <gen>
        Wait 1.00 seconds
        Game - Display to (All players) for 1.00 seconds the text: Duel Arena has begu...
        Sound - Play mk_fight <gen>
        Unit Group - Pick every unit in (Units in Team1 Duel Position <gen>) and do (Unit - Make (Picked unit) Vulnerable)
        Unit Group - Pick every unit in (Units in Team1 Duel Position <gen>) and do (Unit - Unpause (Picked unit))
        Unit Group - Pick every unit in (Units in Team2 Duel Position <gen>) and do (Unit - Make (Picked unit) Vulnerable)
        Unit Group - Pick every unit in (Units in Team2 Duel Position <gen>) and do (Unit - Unpause (Picked unit))
        Countdown Timer - Start bDuelArenaTimer as a One-shot timer that will expire in 180.00 seconds
        Countdown Timer - Create a timer window for bDuelArenaTimer with title Battle Arena Countd...
        Countdown Timer - Show (Last created timer window)
        Trigger - Turn on End Duel Arena <gen>
        Trigger - Turn on Duel Arena Timer Expires <gen>
        Trigger - Turn off (This trigger)

I hope you can understand what I am trying to do, but it didnt equal to the results that I would have liked. And comparing to the Angel Arena coding there are some irregularities that I've observed and I haven't made any clear understandings of it.

My Variables Declared
bDuelArena - Boolean True/False comparison
bMultiArena - Boolean True/False comparison
Team1DuelPos - Point Variable
Team2DuelPos - Point Variable
CameraViewTarget - Point Variable
TeamDuelUnit1 - Unit Variable
TeamDuelUnit2 - Unit Variable
HeroPlayer - Unit Array Variable

No events were added onto my triiger as it was activated via previous Timer trigger event

If someone who have coded their map using Random Integer Values, please share your experiences. Your assistance is appreciated.
 

c-series

New Member
Reaction score
2
Well i usually use somekind like this

Code:
Duel
    Events
    Conditions
    Actions
        Game - Display to (All players) the text: Duel Time !!
        Unit - Pause all units
        -------- Duel Initialization --------
        Set Randomizer[1] = (Player number of (Random player from TeamPlayers[1]))
        Set Randomizer[2] = (Player number of (Random player from TeamPlayers[2]))
        Set Duelist[1] = Heroes[(Player number of (Random player from TeamPlayers[1]))]
        Set Duelist[2] = Heroes[(Player number of (Random player from TeamPlayers[2]))]
        Set DuelPos[1] = (Center of DuelPos1 <gen>)
        Set DuelPos[2] = (Center of DuelPos1 <gen>)
        Unit - Make Duelist[1] Invulnerable
        Unit - Make Duelist[2] Invulnerable
        Wait 2.00 seconds
        -------- Moving --------
        Unit - Move Duelist[1] instantly to DuelPos[1]
        Unit - Move Duelist[2] instantly to DuelPos[2]
        -------- Replenish HP n MP --------
        Unit - Set life of Duelist[1] to 100.00%
        Unit - Set mana of Duelist[1] to 100.00%
        Unit - Set life of Duelist[2] to 100.00%
        Unit - Set mana of Duelist[2] to 100.00%
        Camera - Pan camera as necessary for (Owner of Duelist[1]) to DuelPos[1] over 0.50 seconds
        Custom script:   call RemoveLocation (udg_DuelPos[1])
        Camera - Pan camera as necessary for (Owner of Duelist[2]) to DuelPos[2] over 0.50 seconds
        Custom script:   call RemoveLocation (udg_DuelPos[2])
        Wait 1.00 seconds
        -------- Okay Let's Get it ON --------
        Unit - Make Duelist[1] Vulnerable
        Unit - Make Duelist[2] Vulnerable
        Unit - Unpause Duelist[1]
        Unit - Unpause Duelist[1]
        Countdown Timer - Start DuelTimer as a One-shot timer that will expire in 60.00 seconds
        Countdown Timer - Create a timer window for DuelTimer with title Duel

I ussualy minimalized any loops in my map ... i don't like them ... :D , using integers save my time. for TeamPlayers, i separate them array index; reffering to each team, their set-ups are conditional (leaving player, empty slots, computer, etc doesn't counted in ). btw, that code isn't full ... but thats the core .... :p

somehow i feel something missing ... or just my feeling :confused:

Variables declared
separated by array index; reffering to each team

Unit Variable -- Duelist [2 array] -- The unit
Unit Variable -- Heroes [12 array -- Hero owned by each player (12 array for 12 players ), declared when
player choose a hero
Point Variable -- Duelpos [2 array] -- Position in the arena
Timer n Timer Window Variable -- DuelTimer and DuelTimerWin -- timer
PlayerGroup Variable -- TeamPlayers [2 array] -- Playing Players
 
Z

Zerotech

Guest
Thank you for the response, I will give this a try asap. And about the quote somthing seems missing I do apologize that I haven't explained it well enough, basically it's about the Angel Arena coding where the TempMaxKill Integer variable and the For A integer that every hero in the team (providing they have all at least one hero kill) have a value that equals or greater than the TempMaxKill variable.

It doesn't make sens to me that how on earth a value can equal to all the hero units, yet the higher one gets chosen apart from later trigger actions where it declares via if statement about integer comparisons, yet the higher kill hero gets picked when the updated version of worldedit it needs to be defined correctly to that particular player or else every hero will be picked.

I would probably say that the coding based on the older versions of warcraft may have been bugged thus map makers have exploited it and still works providing that you dont edit the map with the latest update.
 

Sim

Forum Administrator
Staff member
Reaction score
534
Code:
Start Duel
    Events
        Time - Duel expires
    Conditions
    Actions
        Unit - Pause all units
        Game - Display to (All players) the text: Two have been chose...
        Set bPasued = True
        Set bDuel = True
        Countdown Timer - Start DuelTime as a One-shot timer that will expire in 120.00 seconds
        Sound - Stop music After fading
        Wait 3.00 seconds
        Player Group - Pick every player in (All players) and do (Camera - Pan camera for (Picked player) to Duel_Point over 1.00 seconds)
        For each (Integer A) from 1 to 12, do (Set HeroSavePoints[(Integer A)] = (Position of Heroes[(Integer A)]))
        For each (Integer A) from 1 to 12, do (Set HeroSaveDirection[(Integer A)] = (Facing of Heroes[(Integer A)]))
        For each (Integer A) from 1 to 12, do (Unit - Move Heroes[(Integer A)] instantly to (Center of HeroDuelSpots[(Integer A)]))
        For each (Integer A) from 1 to 12, do (Unit - Make Heroes[(Integer A)] face Duel_Point over 0.00 seconds)
        For each (Integer A) from 1 to 12, do (Unit - Make Heroes[(Integer A)] Invulnerable)
        Set RandomDueler[1] = (Random player from Team1)
        Set Player_Numb[1] = (Player number of RandomDueler[1])
        Set Team1Dueler = Heroes[Player_Numb[1]]
        Unit - Move Team1Dueler instantly to (Center of Team One Dueler <gen>)
        Unit - Set life of Team1Dueler to 100.00%
        Unit - Set mana of Team1Dueler to 100.00%
        Unit - Make Team1Dueler Vulnerable
        Unit - Remove Stunned buff from Team1Dueler
        Set RandomDueler[2] = (Random player from Team2)
        Set Player_Numb[2] = (Player number of RandomDueler[2])
        Set Team2Dueler = Heroes[Player_Numb[2]]
        Unit - Move Team2Dueler instantly to (Center of Team Two Dueler <gen>)
        Unit - Set life of Team2Dueler to 100.00%
        Unit - Set mana of Team2Dueler to 100.00%
        Unit - Make Team2Dueler Vulnerable
        Unit - Remove Stunned buff from Team2Dueler
        Game - Display to (All players) the text: (PlayerNames[Player_Numb[1]] + ( VS  + PlayerNames[Player_Numb[2]]))
        Wait 4.00 seconds
        Sound - Play PH1 <gen>
        Sound - Set volume of (Last played sound) to 100.00%
        Game - Display to (All players) the text: 3!
        Wait 1.00 seconds
        Game - Display to (All players) the text: 2!
        Wait 1.00 seconds
        Game - Display to (All players) the text: 1!
        Wait 1.00 seconds
        Sound - Play O05Cenarius03 <gen>
        Game - Display to (All players) the text: Let battle be joine...
        Unit - Unpause Team1Dueler
        Unit - Unpause Eye of Sauron 0235 <gen>
        Unit - Unpause Team2Dueler
        Unit - Unpause Eye of Sauron 0236 <gen>
Code:
Should look like this. You can add your own modifications.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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