Snippet Unit Exchange System

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Unit Exchange System
By Gtam

This is a nice system that would fit maps like Footman Wars, Footman Frenzy or any map with lagre armies.

What is made from:

Blood, Sweat and tears
GUI
MUI
Jass Snippet made by Rainther.( not Released)
And Some help by Yoshi.

What This system does is allows people to select a group of their units and give it to another player.
This system will not allow the the user to give away Heroes.
When the player types -Switch this systen will display the units he has selected and how many of each type thats selected. After that it will set a boolean to true allowing him to switch the next time he types
Then he types e.g. -Switch 2 then this system will give the selected untis to player 2.

Trigger:
  • Exchange
    • Events
      • Player - Player 1 (Red) types a chat message containing - as A substring
      • Player - Player 2 (Blue) types a chat message containing - as A substring
      • Player - Player 3 (Teal) types a chat message containing - as A substring
      • Player - Player 4 (Purple) types a chat message containing - as A substring
      • Player - Player 5 (Yellow) types a chat message containing - as A substring
      • Player - Player 6 (Orange) types a chat message containing - as A substring
      • Player - Player 7 (Green) types a chat message containing - as A substring
      • Player - Player 8 (Pink) types a chat message containing - as A substring
      • Player - Player 9 (Gray) types a chat message containing - as A substring
      • Player - Player 10 (Light Blue) types a chat message containing - as A substring
      • Player - Player 11 (Dark Green) types a chat message containing - as A substring
      • Player - Player 12 (Brown) types a chat message containing - as A substring
    • Conditions
    • Actions
      • Set Selected_G = (Units currently selected by (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Substring((Entered chat string), 2, 7)) Equal to Switch
        • Then - Actions
          • Unit Group - Pick every unit in Selected_G and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • ((Picked unit) is A Hero) Equal to True
                • Then - Actions
                  • Unit Group - Remove (Picked unit) from Selected_G
                  • Game - Display to (All players) the text: |cffff0000No Heroes...
                  • Skip remaining actions
                • Else - Actions
                  • Set Exchange[(Player number of (Triggering player))] = True
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HeIsSure[(Player number of (Triggering player))] Equal to False
                      • Exchange[(Player number of (Triggering player))] Equal to True
                    • Then - Actions
                      • Custom script: call UnitCount(udg_Selected_G, GetTriggerPlayer())
                      • Set HeIsSure[(Player number of (Triggering player))] = True
                    • Else - Actions
                      • Unit Group - Pick every unit in Selected_G and do (Actions)
                        • Loop - Actions
                          • Unit - Change ownership of (Picked unit) to (Player((Integer((Substring((Entered chat string), 8, 10)))))) and Change color
                          • Set HeIsSure[(Player number of (Triggering player))] = False
                          • Set Exchange[(Player number of (Triggering player))] = False
          • Custom script: call DestroyGroup(udg_Selected_G)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Entered chat string) Equal to -DontSwitch
              • Exchange[(Player number of (Triggering player))] Equal to True
              • HeIsSure[(Player number of (Triggering player))] Equal to True
            • Then - Actions
              • Set Exchange[(Player number of (Triggering player))] = False
              • Set HeIsSure[(Player number of (Triggering player))] = False
            • Else - Actions


Credits to:
Rainther for snippet
Yoshi for trigger help

Credits is not needed when system used.

Code:
Changelog
v1.00 Released
v1.00b Leak Fix
 

Attachments

  • UES v1.00.w3x
    22.4 KB · Views: 304
  • UES v1.00b.w3x
    22.5 KB · Views: 264

Romek

Super Moderator
Reaction score
963
Credits to:
Rainther for snippet
Yoshi for trigger help
So, you didn't make this?
 

Romek

Super Moderator
Reaction score
963
How exactly did you contribute to the snippet?

(It's difficult to believe that a 3-man-team was needed to make something like this).
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
OK Rainther did the Jass part and Yoshi helped in my triggering problem
 

Romek

Super Moderator
Reaction score
963
There is no JASS part..?
And you haven't given particularly much detail about how he helped you.
 

Rainther

I guess I should write something of value here...
Reaction score
61
I recall it to be a function where you put in unit group and received back all the unit types in unit group and the amount of them aswell.
I didn't know you'd use it, however I am grateful for the credits. :D
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
There is a jass snippet Rainther created in the map tham my system uses hence the call UnitCount function
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
Looks like it leaks a unit group there as well.
 

Sevion

The DIY Ninja
Reaction score
413
Sec, would this allow me to easily exchange say 2000 units at a time. Doubtufl. Then again, I'm sure it'd lag anyways. And most pc's probablyt couldn't handle it. But I'm curious as to say what the maximum units transferable at a time is for this.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
yes its 12 since i couldnt think of a way to do more at a time
 

Sevion

The DIY Ninja
Reaction score
413
The way I'm doing it in Physics Wars, I can transfer 250+ units laglessly instantly at a time.

Which is needed for when players leave or are defeated and still have units on the map. They get spread evenly through out the remaining team.

And with a max of 250 units, that's 250*6=1500 units a a time on the map maximum + hidden units for interface etc.

This method that you use would make it impossible for me to do that.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
this is made for during the game not when a player leaves. This is made for if you see you ally was just attacked and need some units you can give him yours.
 

emolilolee

New Member
Reaction score
1
I'd tried this out, am sure I did it totally right but it gives an error at
call UnitCount(udg_Selected_G, GetTriggerPlayer()) :confused:
 

Komaqtion

You can change this now in User CP.
Reaction score
469
You should move leakfix out side the whole "If" ... As it's supposed to be destryed, even if the condition's aren't met, since it's created without them being met...

Trigger:
  • Custom script: call DestroyGroup(udg_Selected_G)


That's what I'm talking about...
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
emolily did you also copy the map header part dont think so. Other wise that error wouldnt occur so go look im my maps header and copy that code to yours
 

Tru_Power22

You can change this now in User CP.
Reaction score
144
The way I'm doing it in Physics Wars, I can transfer 250+ units laglessly instantly at a time.

Which is needed for when players leave or are defeated and still have units on the map. They get spread evenly through out the remaining team.

And with a max of 250 units, that's 250*6=1500 units a a time on the map maximum + hidden units for interface etc.

This method that you use would make it impossible for me to do that.

I;m pretty sure your map is going to break the warcraft 3 engine. I find it works poorly when you start getting near 400 units.
 

Sevion

The DIY Ninja
Reaction score
413
Actually, no one I've tested with has been able to run the map :| Only me. Everyone else gets white screen and lags insanely XD

Anywho, this system is not really useful IMO. :-/
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top