[SYSTEM] Duel System with Dialog button

S

shadowvzs

Guest
Easily importing:
go to world editor->files->prefenrence->automatically create unknow variables must be on and copy all triggers and create regions and fix where i wrote my region :)

- Duel system with dialog buttons
- with multiboard
- camera fixing
- protected arena(Duel) place (only dueling unit can enter there)
- fixing leaver dueling unit bug
- Dueling commands
- Leakless triggers
- Easy editing

We need:

- 2 region


variables:
- ArenaStart (Boolean Array)
- DuelBoard (Multiboard)
- AcceptingDialog (Dialog)
- DuelDialog (Dialog)
- AccteptingButton (Dialog Button Array)
- DuelButton (Dialog Button Array)
- Point (Point)
- Player (Player)
- Number_of_Players (Integer)
- DuelPlayersNr (Integer Array)
- DuelKill (Integer Array)
- DualDeath (Integer Array)
- Timer (Timer)
- PlayerGroup (PlayerGroup)
- PlayerHeros (Unit Array)
- DuelingUnit (Unit Array)

Then the triggers:

Here create trigger 1 hero each players, clear duel death count and duel kill count variable, and store user player number to variable
Code:
Map Initialization
    Events
        Map initialization
    Conditions
    Actions
        For each (Integer A) from 1 to 2, do (Actions)
            Loop - Actions
                Set DualDeath[(Integer A)] = 0
                Set DuelKill[(Integer A)] = 0
        Set PlayerGroup = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))
        Player Group - Pick every player in PlayerGroup and do (Actions)
            Loop - Actions
                Set Number_of_Players = (Number_of_Players + 1)
                Set Point = (Random point in StartRegion <gen>)
                Unit - Create 1 Paladin for (Picked player) at Point facing Default building facing degrees
                Camera - Pan camera for (Picked player) to Point over 0.00 seconds
                Custom script:   call RemoveLocation(udg_Point)
                Set PlayerHeros[(Player number of (Picked player))] = (Last created unit)
        Custom script:   call DestroyForce(udg_PlayerGroup)
        Quest - Create a Required quest titled Duel Command with the description -Duel -start duel c..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp

When a player type "-Duel" and Duel place is free then create a dialog window with user players and create a countdowntimer window
Code:
Duel Selection
    Events
        Player - Player 1 (Red) types a chat message containing -Duel as An exact match
        Player - Player 2 (Blue) types a chat message containing -Duel as An exact match
        Player - Player 3 (Teal) types a chat message containing -Duel as An exact match
        Player - Player 4 (Purple) types a chat message containing -Duel as An exact match
        Player - Player 5 (Yellow) types a chat message containing -Duel as An exact match
        Player - Player 6 (Orange) types a chat message containing -Duel as An exact match
        Player - Player 7 (Green) types a chat message containing -Duel as An exact match
        Player - Player 8 (Pink) types a chat message containing -Duel as An exact match
        Player - Player 9 (Gray) types a chat message containing -Duel as An exact match
        Player - Player 10 (Light Blue) types a chat message containing -Duel as An exact match
        Player - Player 11 (Dark Green) types a chat message containing -Duel as An exact match
        Player - Player 12 (Brown) types a chat message containing -Duel as An exact match
    Conditions
        Number_of_Players Greater than 1
    Actions
        Set Player = (Triggering player)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ArenaStart[1] Equal to False
            Then - Actions
                Set DuelPlayersNr[1] = (Player number of Player)
                Countdown Timer - Create a timer window for Timer with title Duel Waiting...
                Countdown Timer - Start Timer as a One-shot timer that will expire in 30.00 seconds
                Set ArenaStart[1] = True
                Dialog - Clear DuelDialog
                Dialog - Change the title of DuelDialog to Choose your opponent
                For each (Integer A) from 1 to 12, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Player((Integer A))) slot status) Equal to Is playing
                                ((Player((Integer A))) controller) Equal to Computer
                                (Player((Integer A))) Not equal to (Triggering player)
                            Then - Actions
                                Dialog - Create a dialog button for DuelDialog labelled (Player + (String((Integer A))))
                                Set DuelButton[(Integer A)] = (Last created dialog Button)
                            Else - Actions
                                Do nothing
                Dialog - Show DuelDialog for (Triggering player)
            Else - Actions
                Set PlayerGroup = (Player group(Player))
                Game - Display to PlayerGroup the text: Now have a duel, tr...
                Custom script:   call DestroyForce(udg_PlayerGroup)

if duel hosting player select his opponent then create trigger a dialog window for selected player
Code:
Select a Player
    Events
        Dialog - A dialog button is clicked for DuelDialog
    Conditions
    Actions
        Set Player = (Triggering player)
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        DuelButton[(Integer A)] Equal to (Clicked dialog button)
                    Then - Actions
                        Dialog - Clear AcceptingDialog
                        Dialog - Change the title of AcceptingDialog to ((Name of Player) +  invite to a duel.)
                        Dialog - Create a dialog button for AcceptingDialog labelled Accept
                        Set AcceptingButton[1] = (Last created dialog Button)
                        Dialog - Create a dialog button for AcceptingDialog labelled Decline
                        Set AcceptingButton[2] = (Last created dialog Button)
                        Set DuelPlayersNr[2] = (Player number of (Player((Integer A))))
                        Dialog - Show AcceptingDialog for (Player(DuelPlayersNr[2]))
                    Else - Actions
                        Do nothing

this trigger see if selected player accept the duel or decline... if he accept then stop timer window and destroy it and move host and selected player heroes to duel place else take free the arena and clear death, kill counts variable
Code:
Accept Decline
    Events
        Dialog - A dialog button is clicked for AcceptingDialog
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                AcceptingButton[1] Equal to (Clicked dialog button)
            Then - Actions
                Countdown Timer - Pause Timer
                Countdown Timer - Destroy (Last created timer window)
                Set DuelingUnit[2] = PlayerHeros[(Player number of (Player(DuelPlayersNr[2])))]
                Set PlayerGroup = (Player group((Player(DuelPlayersNr[1]))))
                Game - Display to PlayerGroup the text: ((Name of (Player(DuelPlayersNr[2]))) +  accept your duel invitation.)
                Custom script:   call DestroyForce(udg_PlayerGroup)
                For each (Integer A) from 1 to 2, do (Actions)
                    Loop - Actions
                        Set Point = (Random point in Arena <gen>)
                        Unit - Move DuelingUnit[(Integer A)] instantly to Point
                        Set DuelingUnit[(Integer A)] = PlayerHeros[(Player number of (Player(DuelPlayersNr[(Integer A)])))]
                        Camera - Pan camera for (Player(DuelPlayersNr[(Integer A)])) to Point over 0.00 seconds
                        Custom script:   call RemoveLocation(udg_Point)
                Trigger - Run MultiBoardCreating <gen> (ignoring conditions)
            Else - Actions
                Set ArenaStart[1] = False
                Set PlayerGroup = (Player group((Player(DuelPlayersNr[1]))))
                Game - Display to PlayerGroup the text: ((Name of (Player(DuelPlayersNr[2]))) +  refused your duel invitation.)
                Custom script:   call DestroyForce(udg_PlayerGroup)
                Set DuelPlayersNr[2] = 0
                Set DuelPlayersNr[1] = 0
        Dialog - Clear DuelDialog

if selected player not response the dueling will refused
Code:
TimeOver
    Events
        Time - Timer expires
    Conditions
        ArenaStart[1] Equal to True
    Actions
        Game - Display to (All players) the text: Dueling Canceled....
        Set ArenaStart[1] = False
        Dialog - Hide AcceptingDialog for (Player(DuelPlayersNr[2]))
        Dialog - Clear AcceptingDialog
        For each (Integer A) from 1 to 2, do (Actions)
            Loop - Actions
                Set DuelingUnit[(Integer A)] = No unit
                Set DuelPlayersNr[(Integer A)] = 0

when player typer "-Over" then put the 2 heroes to starting region and clear the variables and set duel place to free (arenastart(1)=false => nobody not use arena)
Code:
DuelOver
    Events
        Player - Player 1 (Red) types a chat message containing -Over as An exact match
        Player - Player 2 (Blue) types a chat message containing -Over as An exact match
        Player - Player 3 (Teal) types a chat message containing -Over as An exact match
        Player - Player 4 (Purple) types a chat message containing -Over as An exact match
        Player - Player 5 (Yellow) types a chat message containing -Over as An exact match
        Player - Player 6 (Orange) types a chat message containing -Over as An exact match
        Player - Player 7 (Green) types a chat message containing -Over as An exact match
        Player - Player 8 (Pink) types a chat message containing -Over as An exact match
        Player - Player 9 (Gray) types a chat message containing -Over as An exact match
        Player - Player 10 (Light Blue) types a chat message containing -Over as An exact match
        Player - Player 11 (Dark Green) types a chat message containing -Over as An exact match
        Player - Player 12 (Brown) types a chat message containing -Over as An exact match
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Player(DuelPlayersNr[1])) Equal to (Triggering player)
                (Player(DuelPlayersNr[2])) Equal to (Triggering player)
    Actions
        Player - Make (Player(DuelPlayersNr[1])) treat (Player(DuelPlayersNr[2])) as an Neutral
        Player - Make (Player(DuelPlayersNr[2])) treat (Player(DuelPlayersNr[1])) as an Neutral
        Game - Display to (All players) the text: Duel Finished.
        For each (Integer A) from 1 to 2, do (Actions)
            Loop - Actions
                Set Point = (Random point in StartRegion <gen>)
                Unit - Move DuelingUnit[(Integer A)] instantly to Point
                Custom script:   call RemoveLocation(udg_Point)
        Set ArenaStart[1] = False
        For each (Integer A) from 1 to 2, do (Actions)
            Loop - Actions
                Set DuelingUnit[(Integer A)] = No unit
                Set DuelPlayersNr[(Integer A)] = 0

if a dueling hero dye then will be revived and add +1 killing point to killer and +death point to dying hero
Code:
Dueling Unit Dying
    Events
        Unit - A unit Dies
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Dying unit) Equal to DuelingUnit[1]
                (Dying unit) Equal to DuelingUnit[2]
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Killing unit) Equal to DuelingUnit[1]
            Then - Actions
                Set DuelKill[1] = (DuelKill[1] + 1)
                Set DualDeath[2] = (DualDeath[2] + 1)
                Multiboard - Set the text for DuelBoard item in column 2, row 1 to (String(DuelKill[1]))
                Multiboard - Set the text for DuelBoard item in column 3, row 2 to (String(DualDeath[2]))
            Else - Actions
                Set DuelKill[2] = (DuelKill[2] + 1)
                Set DualDeath[1] = (DualDeath[1] + 1)
                Multiboard - Set the text for DuelBoard item in column 2, row 2 to (String(DuelKill[2]))
                Multiboard - Set the text for DuelBoard item in column 3, row 1 to (String(DualDeath[1]))
        Wait 2.00 seconds
        Set Point = (Random point in Arena <gen>)
        Hero - Instantly revive (Dying unit) at Point, Show revival graphics
        Camera - Pan camera for (Owner of (Triggering unit)) to Point over 0.00 seconds
        Custom script:   call RemoveLocation(udg_Point)
        For each (Integer A) from 1 to 2, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        DuelKill[(Integer A)] Equal to 10
                    Then - Actions
                        Game - Display to (All players) the text: ((Name of (Player(DuelPlayersNr[(Integer A)]))) +  win the duel.)
                        Trigger - Run DuelOver <gen> (ignoring conditions)
                    Else - Actions
                        Do nothing

here trigger create a multiboard window and fill out with text, and set width
Code:
MultiBoardCreating
    Events
    Conditions
    Actions
        Multiboard - Create a multiboard with 3 columns and 2 rows, titled Duel Multiboard (Na...
        Set DuelBoard = (Last created multiboard)
        For each (Integer A) from 1 to 2, do (Actions)
            Loop - Actions
                Multiboard - Set the width for DuelBoard item in column 1, row (Integer A) to 10.00% of the total screen width
                Multiboard - Set the width for DuelBoard item in column 2, row (Integer A) to 4.00% of the total screen width
                Multiboard - Set the width for DuelBoard item in column 3, row (Integer A) to 4.00% of the total screen width
                Multiboard - Set the text for DuelBoard item in column 1, row (Integer A) to (Name of DuelingUnit[(Integer A)])
                Multiboard - Set the text for DuelBoard item in column 2, row (Integer A) to 0
                Multiboard - Set the text for DuelBoard item in column 3, row (Integer A) to 0
        Multiboard - Show DuelBoard

if a dueling unit escape from arena then dueling will be finished
Code:
Leave Dueling Unit
    Events
        Unit - A unit leaves Arena <gen>
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Leaving unit) Equal to DuelingUnit[1]
                (Leaving unit) Equal to DuelingUnit[2]
    Actions
        Trigger - Run DuelOver <gen> (ignoring conditions)
if u want then cannot leave dueling unit during dueling if u use this trigger
Code:
Leave Dueling Unit Repick
    Events
        Unit - A unit leaves Arena <gen>
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Leaving unit) Equal to DuelingUnit[1]
                (Leaving unit) Equal to DuelingUnit[2]
    Actions
        Set Point = (Random point in Arena <gen>)
        Unit - Move (Leaving unit) instantly to Point
        Camera - Pan camera for (Owner of (Leaving unit)) to Point over 0.00 seconds
        Custom script:   call RemoveLocation(udg_Point)

if in your map have reveal and blink ability, or something then units can enter with teleportation to arena
and this trigger put unit back to start region else u dont can use this trigger
Code:
Enter another unit to arena
    Events
        Unit - A unit enters Arena <gen>
    Conditions
        (Entering unit) Not equal to DuelingUnit[1]
        (Entering unit) Not equal to DuelingUnit[2]
    Actions
        Set Point = (Random point in StartRegion <gen>)
        Unit - Move (Entering unit) instantly to Point
        Camera - Pan camera for (Owner of (Entering unit)) to Point over 0.00 seconds
        Custom script:   call RemoveLocation(udg_Point)

The Map
http://shadowvzs87.uw.hu/DuelSystem.w3x
 
S

shadowvzs

Guest
if somebody found a leak pls write me here :) with comment sure
 

Happy

Well-Known Member
Reaction score
71
Novi....congratulations to necro a more than dead thread. last post was on 30th of may !2007!...
 

Happy

Well-Known Member
Reaction score
71
then do one on your own or reuest one on the hive....but dont necro dead threads -.-*
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • 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 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