• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

-switch command

Status
Not open for further replies.

mik

mik

Level 4
Joined
Dec 13, 2007
Messages
59
Heya,

I wanted to include a -switch command into my map, like it is in DotA.

It completely exchanges Gold/Wood amounts, Units, player colors, alliences etc. between 2 players. Anyone know how this could work?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789

Can everyone stop saying "like in DotA"?
Not everyone knows how the f*ck DotA works, DotA is overrated, explain your problem, as you should!


But, on that short info you've given there, maybe it's something like this:

  • Switch
    • Events
      • Player - Player 1 (Red) types a chat message containing -switch as An exact match
      • Player - Player 2 (Blue) types a chat message containing -switch as An exact match
      • Player - Player 3 (Teal) types a chat message containing -switch as An exact match
      • ...
    • Conditions
    • Actions
      • Player - Set Player 1 (Red) Current lumber to (([Other Player] Current lumber) + (Player 1 (Red) Current lumber))
      • Player - Set Player 1 (Red) Current gold to ([Other Player] Current gold) + (Player 1 (Red) Current gold))
      • Set Group = (Units owned by [Other Player])
      • Unit Group - Pick every unit in Group and do (Unit - Change ownership of (Picked unit) to Player 1 (Red) and Change color)
      • Custom script: call DestroyGroup(udg_Group)
      • For each (Integer A) from 1 to [Number of Players], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ([Other Player] is an ally of (Player((Integer A)))) Equal to True
            • Then - Actions
              • Player - Make Player 1 (Red) treat (Player((Integer A))) as an Ally with shared vision
            • Else - Actions
It does:
It gives all gold/lumber/units from one player to another, if the player has an alliance with someone, it is also given.
Or, as you say it: "it exchanges all gold/lumber/units/alliances between 2 players".
Unless with "exchange" you mean that they both must have the same amount of gold/units/lumber.

If it isn't, then blame yourself for not giving enough information.
 

mik

mik

Level 4
Joined
Dec 13, 2007
Messages
59
Hmm i thought i gave all information that is needed, i was just mentioning that DotA also has such a system. Somehow it can change the playercolor too, is that possible?
 

mik

mik

Level 4
Joined
Dec 13, 2007
Messages
59
Youre in a snit just because a mentioned the D word? I know its overrated, yet most people have played the map...

So, how is it possible to completely change players in their color slots..?


edit: thanks :p


Ah, one more question. If i exchange, lets say, teal and blue with your color trigger. Will the GUI code that is referreing to "player2(blue)" then refer to the "old" blue, who is now teal, or to the new blue, who was teal before..?
 

mik

mik

Level 4
Joined
Dec 13, 2007
Messages
59
Ah, one more question. If i exchange, lets say, teal and blue with your color trigger. Will the GUI code that is referreing to "player2(blue)" then refer to the "old" blue, who is now teal, or to the new blue, who was teal before..?

I think this was lost in edits.. :p
 
Level 11
Joined
Dec 31, 2007
Messages
780
  • Player - Set Player 1 (Red) Current lumber to (([Other Player] Current lumber) + (Player 1 (Red) Current lumber))
  • Player - Set Player 1 (Red) Current gold to ([Other Player] Current gold) + (Player 1 (Red) Current gold))
you should switch also the gold from the other player... in order to do that you should also store its values into a variable before assigning to player 1 player's 2 gold etc etc

edit: here you are adding to player's 1 gold player's 2 gold ... he wants to switch players gold amounts (i didnt read it carefully the first time :p)
 

mik

mik

Level 4
Joined
Dec 13, 2007
Messages
59
Yea, i understand how i can switch the resources, its not really what i wanted to do now...

Okay, i explain some more about what i want to do.

I want to do a tournament 8 player map, where the first round red plays vs. blue, teal vs. purple, yellow vs. orange and green vs. pink. Then we got 4 winners, so in the second round the winners play 2 games (semifinals), and accordingly both winners play against each other for the win.

A completey switch seemed to me like a very easy solution for that. Lets say, red and yellow win. Now, i could just switch blue and orange and "reset" the map to start again.

  • Player - Change color of (Triggering player) to (Color of [Other Player]), Changing color of existing units

My question is: Will, if i swap Blue and Orange the World editor see things that refer to "player2(blue)" to the old blue (now orange), or to the new blue who was orange before.
 
Status
Not open for further replies.
Top