- Joined
- Apr 16, 2010
- Messages
- 584
Hello. Today i uploaded system but user mnib noticed a crash when you type -duel and color of player or any other number where are no players. So if you type -duel 17 it'll crash, same as you'll type -duel red.
Any suggestions??
Here's the trigger:
Any suggestions??
Here's the trigger:
-
CDS Ask for Duel
-
Events
- Player - Player 1 (Red) types a chat message containing -duel as A substring
- Player - Player 2 (Blue) types a chat message containing -duel as A substring
- Player - Player 3 (Teal) types a chat message containing -duel as A substring
- Player - Player 4 (Purple) types a chat message containing -duel as A substring
- Player - Player 5 (Yellow) types a chat message containing -duel as A substring
- Player - Player 6 (Orange) types a chat message containing -duel as A substring
- Player - Player 7 (Green) types a chat message containing -duel as A substring
- Player - Player 8 (Pink) types a chat message containing -duel as A substring
- Player - Player 9 (Gray) types a chat message containing -duel as A substring
- Player - Player 10 (Light Blue) types a chat message containing -duel as A substring
- Player - Player 11 (Dark Green) types a chat message containing -duel as A substring
- Player - Player 12 (Brown) types a chat message containing -duel as A substring
- Conditions
-
Actions
- -------- Start the timer --------
- Countdown Timer - Start CDS_Timer as a One-shot timer that will expire in CDS_Seconds seconds
- -------- If duel is in progress inform the player --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- CDS_On Equal to True
-
Then - Actions
- Game - Display to (Player group((Triggering player))) the text: |cfffed312Duel is i...
-
Else - Actions
- -------- Setting variables --------
-
If - Conditions
- Trigger - Turn on CDS Vote Yes <gen>
- Trigger - Turn on CDS Vote No <gen>
- Set CDS_Player[1] = (Integer((Substring((Entered chat string), 7, (Length of (Entered chat string))))))
- Set CDS_Player[2] = (Player number of (Triggering player))
- -------- Chek if both players are enemies --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
- CDS_On Equal to False
- ((Player(CDS_Player[1])) is an enemy of (Player(CDS_Player[2]))) Equal to True
-
Conditions
-
And - All (Conditions) are true
-
Then - Actions
- -------- If they are enemies we turn on the duel --------
- Set CDS_On = True
- Game - Display to (Player group((Player(CDS_Player[1])))) the text: (|cfffed312 + ((String(CDS_Player[1])) + wants to fight with you in duel. If you want to fight type "-accept" or "-reject' to give up.))
- Game - Display to (Player group((Player(CDS_Player[2])))) the text: (|cfffed312You asked for duel with player + (Name of (Player(CDS_Player[1]))))
- -------- Now we must wait until second player accepts the duel offer or rejects --------
- Wait until (CDS_Accept Equal to True), checking every 1.00 seconds
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- CDS_Accept Equal to True
-
Then - Actions
- -------- If he accepted we set both units and move them to the Duel region. --------
- -------- We also set the life and mana before duel, so the winner will come out with previous life and mana. --------
-
Unit Group - Pick every unit in (Units owned by (Player(CDS_Player[1])) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
-
Loop - Actions
- Set CDS_Unit[1] = (Picked unit)
- Set CDS_Unit_Life[1] = (Life of CDS_Unit[1])
- Set CDS_Unit_Mana[1] = (Mana of CDS_Unit[1])
- Set CDS_Positions[1] = (Position of (Picked unit))
- Unit - Move CDS_Unit[1] instantly to ((Center of CDS_Region) offset by 300.00 towards 300.00 degrees)
- Unit Group - Add CDS_Unit[1] to CDS_Unit_Group
- Unit - Unpause CDS_Unit[1]
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Player(CDS_Player[2])) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
-
Loop - Actions
- Set CDS_Unit[2] = (Picked unit)
- Set CDS_Unit_Life[2] = (Life of CDS_Unit[2])
- Set CDS_Unit_Mana[2] = (Mana of CDS_Unit[2])
- Set CDS_Positions[2] = (Position of (Picked unit))
- Unit - Move CDS_Unit[2] instantly to ((Center of CDS_Region) offset by 300.00 towards 150.00 degrees)
- Unit Group - Add CDS_Unit[2] to CDS_Unit_Group
- Unit - Unpause CDS_Unit[2]
-
Loop - Actions
-
Player Group - Pick every player in (All players) and do (Actions)
-
Loop - Actions
- -------- Now we make other players to watch the duel so no one will cheat. --------
- Game - Display to (Player group((Picked player))) the text: (|cfffed312The duel between + ((Name of (Owner of CDS_Unit[1])) + ( and + ((Name of (Owner of CDS_Unit[2])) + has started.))))
- Camera - Pan camera for (Picked player) to (Center of CDS_Region) over 0.00 seconds
- Camera - Lock camera target for (Picked player) to (Random unit from (Units of type CDS_Dummy)), offset by (0.00, 0.00) using Default rotation
- Unit - Pause all units
- Unit - Unpause CDS_Unit[1]
- Unit - Unpause CDS_Unit[2]
-
Loop - Actions
- Else - Actions
-
If - Conditions
-
Else - Actions
- -------- If the player picked fight with ally he won't be able to fight with him. --------
- Game - Display to (Player group((Player(CDS_Player[2])))) the text: |cfffed312You can o...
-
If - Conditions
-
Events