• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Swapping heroes

Status
Not open for further replies.
Level 2
Joined
Apr 9, 2008
Messages
8
Okay, so here's the deal, I want a player to be able to type -swap and then for him to receive a cancel/player1/player2/player3 dialog, pressing any of the later 3 will send a dialog to the player pressed, in turn giving them a no/yes dialog. If they accept, unit ownership is swapped.

Now I got this half working once, everything up until ownership changing worked fine (one person ended up with both heroes...) Though I accidentally saved over it with some dog's breakfast of code. Though I realised that I most likely had to rework a lot of the code anyway, at which point I am now having a lot of trouble with.

One of the big problems is that there are 4 teams, and any of them could execute -swap. Thus I believe I need to isolate certain things (this is where I am having trouble).

This is seriously warping my mind, every time I look at it, I am deducing something new...crap :cry:

Any help would be greatly appreciated.
 
Level 4
Joined
Sep 9, 2004
Messages
112
Well other than all the Dialog stuff, try this for the transfer of units..
Uses 2 variables
PlayersTrading - Player variable (Array [2])
PlayersHeros - Unit variable (Array[2])
  • Transfer Units
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units owned by PlayersTrading[1]) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
            • Then - Actions
              • Set PlayersHero[1] = (Picked unit)
            • Else - Actions
              • Do nothing
      • Unit Group - Pick every unit in (Units owned by PlayersTrading[2]) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
            • Then - Actions
              • Set PlayersHero[2] = (Picked unit)
            • Else - Actions
              • Do nothing
      • Unit - Change ownership of PlayersHero[1] to PlayersTrading[2] and Change color
      • Unit - Change ownership of PlayersHero[2] to PlayersTrading[1] and Change color
You would have to set the PlayersTrading[1] in the trigger for initiating the trade.. just set it as (Triggering Player) for whoever typed "-swap".

and set PlayersTrading[2] to the (Triggering Player) who clicked "Yes" to accept the trade.
 
Status
Not open for further replies.
Top