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
When a player type "-Duel" and Duel place is free then create a dialog window with user players and create a countdowntimer window
if duel hosting player select his opponent then create trigger a dialog window for selected player
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
if selected player not response the dueling will refused
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)
if a dueling hero dye then will be revived and add +1 killing point to killer and +death point to dying hero
here trigger create a multiboard window and fill out with text, and set width
if a dueling unit escape from arena then dueling will be finished
if u want then cannot leave dueling unit during dueling if u use this trigger
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
The Map
http://shadowvzs87.uw.hu/DuelSystem.w3x
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)
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