Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
You are using an out of date browser. It may not display this or other websites correctly. You should upgrade or use an alternative browser.
Triggers
Swap System by -Kobas- 1.2.w3x
Variables
Setup
Read Me
Swap Command
---------------------------
Swap Setup
---------------------------
Swap
Swap Loop
Enter map-specific custom script code below. This text will be included in the map script after variables are declared and before any trigger code.
Name
Type
is_array
initial_value
HSS_Player
player
Yes
HSS_Request
boolean
Yes
HSS_String
integer
No
First of all thanks for downloading my system!
As you can see it's very simple!
Still it can be easily edited!
Just check triggers you will see how it works!
Please do not upload system to another sites!
Credits are welcome :D
Basic thing used to show players aviable players to swap with in their team!
This trigger show list of all players used in your map that can play!
If they write "-swap" list of all players in their team that play game will be shown with right codes near them that show player what to write to request swap with them!
Swap Command
Events
Player - Player 1 (Red) types a chat message containing -swap (Unexpected type: 'stringnoformat') as An exact match
Player - Player 2 (Blue) types a chat message containing -swap (Unexpected type: 'stringnoformat') as An exact match
Player - Player 3 (Teal) types a chat message containing -swap (Unexpected type: 'stringnoformat') as An exact match
Player - Player 4 (Purple) types a chat message containing -swap (Unexpected type: 'stringnoformat') as An exact match
Player - Player 7 (Green) types a chat message containing -swap (Unexpected type: 'stringnoformat') as An exact match
Player - Player 8 (Pink) types a chat message containing -swap (Unexpected type: 'stringnoformat') as An exact match
Player - Player 9 (Gray) types a chat message containing -swap (Unexpected type: 'stringnoformat') as An exact match
Player - Player 10 (Light Blue) types a chat message containing -swap (Unexpected type: 'stringnoformat') as An exact match
Conditions
Actions
-------- ----------- --------
-------- Simple conditions that check if players play, show their numbers and so on! --------
-------- ----------- --------
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
((Triggering player) is an ally of (Player((Integer A))).) Equal to True
(Triggering player) Not equal to (Player((Integer A)))
Then - Actions
Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: (To Request Swap with + ((Name of (Player((Integer A)))) + ( write -swap + (String((Player number of (Player((Integer A)))))))))
Else - Actions
Check [Swap Setup Red] trigger for info!
Swap Setup
Events
Player - Player 1 (Red) types a chat message containing -swap (Unexpected type: 'stringnoformat') as A substring
Player - Player 2 (Blue) types a chat message containing -swap (Unexpected type: 'stringnoformat') as A substring
Player - Player 3 (Teal) types a chat message containing -swap (Unexpected type: 'stringnoformat') as A substring
Player - Player 4 (Purple) types a chat message containing -swap (Unexpected type: 'stringnoformat') as A substring
Player - Player 7 (Green) types a chat message containing -swap (Unexpected type: 'stringnoformat') as A substring
Player - Player 8 (Pink) types a chat message containing -swap (Unexpected type: 'stringnoformat') as A substring
Player - Player 9 (Gray) types a chat message containing -swap (Unexpected type: 'stringnoformat') as A substring
Player - Player 10 (Light Blue) types a chat message containing -swap (Unexpected type: 'stringnoformat') as A substring
Conditions
Actions
-------- ----------- --------
-------- Maybe silly but without this check game will be crashed if we write only "-swap " --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Entered chat string) Equal to -swap
Then - Actions
Else - Actions
-------- ----------- --------
-------- We add player that write command into variable! --------
Set Variable Set HSS_Player[1] = (Triggering player)
-------- ----------- --------
-------- We add requested player into variable as well! --------
Set Variable Set HSS_String = (Integer((Substring((Entered chat string), 6, 8))))
-------- ----------- --------
-------- Now we check number of requested player! --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
HSS_String Greater than or equal to 1
HSS_String Less than or equal to 4
Or - Any (Conditions) are true
Conditions
HSS_String Greater than or equal to 7
HSS_String Less than or equal to 10
Then - Actions
-------- ----------- --------
-------- Add Requested player into variable --------
Set Variable Set HSS_Player[2] = (Player(HSS_String))
Else - Actions
-------- ----------- --------
-------- Main part of problem, we need 3th neutral player, will explain below why! --------
Set Variable Set HSS_Player[3] = Neutral Passive
-------- ----------- --------
-------- Boolean variable used as vote system for user controled swap requests! --------
Set Variable Set HSS_Request[(Player number of HSS_Player[1])] = "true"
-------- ----------- --------
-------- This will check if you try to swap with yourself or hero from enemy team^^ --------
-------- ----------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
HSS_Player[1] Equal to HSS_Player[2]
(HSS_Player[1] is an ally of HSS_Player[2].) Equal to False
Then - Actions
Else - Actions
-------- ----------- --------
-------- Simpe display messages used to inform players that someone want to swap hero/es with them --------
-------- ----------- --------
Game - Display to (Player group(HSS_Player[1])) for 10.00 seconds the text: (You requested swap with + (Name of HSS_Player[2]))
Game - Display to (Player group(HSS_Player[2])) for 10.00 seconds the text: ((Name of HSS_Player[1]) + requested swap with you!)
-------- ----------- --------
-------- Now when all variables are set we can run main trigger to do main checking! --------
-------- ----------- --------
Trigger - Run Swap <gen> (checking conditions)
Trigger used to check conditions!
Bothering but still needed to work :D
Swap
Events
Conditions
Actions
-------- ----------- --------
-------- This check if player is controled by user or computer! --------
-------- If you requested to swap with CP main trigger actions will be activated, if not it must check request or approval from other player to run main swap trigger actions! --------
-------- ----------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(HSS_Player[2] controller) Equal to User
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HSS_Request[(Player number of HSS_Player[1])] Equal to True
HSS_Request[(Player number of HSS_Player[2])] Equal to True
Then - Actions
Set Variable Set HSS_Request[(Player number of HSS_Player[1])] = "false"
Set Variable Set HSS_Request[(Player number of HSS_Player[2])] = "false"
Trigger - Run Swap_Loop <gen> (ignoring conditions)
Else - Actions
Else - Actions
Trigger - Run Swap_Loop <gen> (ignoring conditions)
Main trigger actions created in another trigger to reduce large number of trigger actions in [Swap] trigger!
As you can see we finally use our neutral player!
Explanation, how work: X -> Y
X -> Z
Y -> X
Z -> Y
Simple as that ^^
Swap Loop
Events
Conditions
Actions
-------- ----------- --------
-------- Swap System --------
-------- ----------- --------
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units owned by HSS_Player[1] matching (((Matching unit) is A Hero) Equal to True).) and do (Actions)
Loop - Actions
Unit - Change ownership of (Picked unit) to HSS_Player[3] and Change color
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units owned by HSS_Player[2] matching (((Matching unit) is A Hero) Equal to True).) and do (Actions)
Loop - Actions
Unit - Change ownership of (Picked unit) to HSS_Player[1] and Change color
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units owned by HSS_Player[3] matching (((Matching unit) is A Hero) Equal to True).) and do (Actions)
Loop - Actions
Unit - Change ownership of (Picked unit) to HSS_Player[2] and Change color
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.