• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Help with a "-give X" command

Status
Not open for further replies.

Nzill

N

Nzill

Hey.
I'm trying to create a -give command, which is supposed to give the selected units of a player to another. It technically works. But it causes selection bugs, where you can end up giving a random unit. It also makes you unable to do anything sometimes. (Except for chatting) The picture should explain a lot as well.

Some help as to what's the problem is very appreciated.

n6FGRcX.png
 
Why do you have the condition If (Owner of (Picked unit)) Equal to (Triggering player) ?

If I were you, I give those all Heroes to Neutral Passive first, then later change ownership.

Take a look at this test map.

uhm im pretty sure hes not trying to build a hero selection.

but Nzill, i dont really get your problem. What exactly isnt working (explain the "where you can end up giving a random unit.").

If you plan on creating one trigger for every player (so that every player has access to all commands) you might wanna look for a better solution than creating 12 triggers manually.
 
LOL I misunderstood the topic =,="

He wanted to do a trigger that allows you to give your own units, to other players of your own selection, right ?

Example: -give 3

This will give your currently selected units to Player 3, right ?

It's better to use integer, rather than string, such as red/blue/yellow/etc.

Because Integer, you can relate with Player Number, more efficient.

EDIT:
Here's the edited test map.
 

Attachments

I'm not exactly the best concerning triggers by the way. :P
Muzzel: For example, after you typed the -give command, and gave something to someone, bugs would occur. If you for example typed "-give teal" you'd maybe give a random unit to teal, that you didn't even have selected.

Defskull: 10, 11 and 12 doesn't work for some reason. But besides that, I'd prefer to have a it you type red/blue/yellow/etc. It seems as if the colour name is the most used, and therefore seems more user-friendly.
Btw, your map crashes if you type "-give (anything but a number here)"
 
Well well. I found out, after some testing, that it still doesn't work proper. It does certainly seem to fail less often than before. Assume you have unit X and Y selected, but it might be that both are given and unit C is given as well.
 
I'm horrible at explaining... I'll try again.
Anyway, it's an example. Assume you have two units controlled, and you write the command. (-give blue, or whatever colour really.) And, what then might happen, is that the two units at given. But a random unit of yours, elsewhere on the map, might -also- be given to the player.
Does this make a bit more sense?
 
  • Give
    • Events
      • Player - Player 1 (Red) types a chat message containing -give as A substring
    • Conditions
      • (Integer((Substring((Entered chat string), 6, 8)))) Not equal to (Player number of (Triggering player))
    • Actions
      • Set SelectedGroup = (Units owned by (Triggering player) matching (((Matching unit) is selected by (Triggering player)) Equal to True))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SelectedGroup is empty) Equal to False
        • Then - Actions
          • Unit Group - Pick every unit in SelectedGroup and do (Actions)
            • Loop - Actions
              • Unit - Change ownership of (Picked unit) to (Player((Integer((Substring((Entered chat string), 6, 8)))))) and Change color
              • Custom script: call DestroyGroup(udg_SelectedGroup)
        • Else - Actions
Here. Tested and it seemed any random unit of mine wasn't given to the other player.
 
Last edited:
Msongyboi: The first trigger isn't relevant now. I'm using the one defskull made.

Wrda: I'll be testing yours to see if it works proper. I sure hope it does. :P
 
Status
Not open for further replies.
Back
Top