• 🏆 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!

[Trigger] How to make a player select a hero by commanding it?

Status
Not open for further replies.
Level 6
Joined
Feb 10, 2005
Messages
223
Hello everyone,

I know different kinds of way to make a hero be created for a special player, like when you enter a region and such. But in my map I want to do something different, cause of the main reason I simply dont got space to make a place where you can walk upon a powerfield to select a hero.

What I want is this: When the game begins after the small intro you have to typ like <class><faction> (without the "<" and ">") to create your hero at a certain spot. However, I dont want that 2 forces can summon each others units. Like a horde player cant summon a human paladin.

I first thought of something like:

Event - Player X types a chat messing containing the text <class><faction> as an excact matc
Condition - Matching player equal to random player from player group - player X
Action - Create unit X (the unit you want to be made for you) at region X


But my suspecions are that the event is like when that happens, and not if you can do it, like it has to be triggered to make him summoned. But sowhevere, can you help me with this?

Yours sincerely,

Nazghul_Master
 
Level 4
Joined
May 23, 2007
Messages
94
what? it seemes like u already figured it out
exe.
Event- Player 1 types a message containing the text paladin human as an exact match
condition- matching player equal to random player from player group - team 1
action- create 1 human paladin in the center of region hero spawn point

wats the problem?
 
The problem is that it does not work, properly. The condition will generate a random player and if, by chance, the player who typed the message is the "random player", it will continue.

The condition could be this one:
  • Conditions
    • (Player number of (Triggering Player)) greater than or equal to 1
    • (Player number of (Triggering Player)) less than or equal to 6
    • -------- Assuming that the horde/human faction is from player 1 to 6 --------
and for the other faction...
  • Conditions
    • (Player number of (Triggering Player)) greater than or equal to 7
    • (Player number of (Triggering Player)) less than or equal to 12
(I'm sure that you could change the numbers by yourself, but I like using Trigger Tags xD)

I think this should work better =D
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
i personally would do it like this. i would put all the players into two seperature player groups first as this is useful and you will probably use it later in other triggers

  • Oh Noes
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Add Player 1 (Red) to Alliance
      • Player Group - Add Player 2 (Blue) to Alliance
      • Player Group - Add Player 3 (Teal) to Alliance
      • Player Group - Add Player 4 (Purple) to Alliance
      • Player Group - Add Player 5 (Yellow) to Alliance
      • Player Group - Add Player 6 (Orange) to Alliance
      • Player Group - Add Player 7 (Green) to Horde
      • Player Group - Add Player 8 (Pink) to Horde
      • Player Group - Add Player 9 (Gray) to Horde
      • Player Group - Add Player 10 (Light Blue) to Horde
      • Player Group - Add Player 11 (Dark Green) to Horde
      • Player Group - Add Player 12 (Brown) to Horde
i would then automatically spawn the hero based on what was entered, so long as that player does not already have a hero by comparing to the boolean variable, playerhashero, which is set to true when a hero is spawned:

  • Oh Noes2
    • Events
      • Player - Player 1 (Red) types a chat message containing Human Paladin as A substring
      • Player - Player 1 (Red) types a chat message containing Human Mage as A substring
      • Player - Player 1 (Red) types a chat message containing Human Rogue as A substring
    • Conditions
      • PlayerHasHero[(Player number of (Triggering player))] Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) is in Alliance) Equal to True
        • Then - Actions
          • Unit - Create 1 (Unit-type((Entered chat string))) for (Triggering player) at (Center of SpawnRegion) facing Default building facing degrees
          • Set PlayerHasHero[(Player number of (Triggering player))] = True
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) the text: You Cannot Play Tha...
this would be the opposite for horde.
 
Level 6
Joined
Feb 10, 2005
Messages
223
i personally would do it like this. i would put all the players into two seperature player groups first as this is useful and you will probably use it later in other triggers

  • Oh Noes
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Add Player 1 (Red) to Alliance
      • Player Group - Add Player 2 (Blue) to Alliance
      • Player Group - Add Player 3 (Teal) to Alliance
      • Player Group - Add Player 4 (Purple) to Alliance
      • Player Group - Add Player 5 (Yellow) to Alliance
      • Player Group - Add Player 6 (Orange) to Alliance
      • Player Group - Add Player 7 (Green) to Horde
      • Player Group - Add Player 8 (Pink) to Horde
      • Player Group - Add Player 9 (Gray) to Horde
      • Player Group - Add Player 10 (Light Blue) to Horde
      • Player Group - Add Player 11 (Dark Green) to Horde
      • Player Group - Add Player 12 (Brown) to Horde
i would then automatically spawn the hero based on what was entered, so long as that player does not already have a hero by comparing to the boolean variable, playerhashero, which is set to true when a hero is spawned:

  • Oh Noes2
    • Events
      • Player - Player 1 (Red) types a chat message containing Human Paladin as A substring
      • Player - Player 1 (Red) types a chat message containing Human Mage as A substring
      • Player - Player 1 (Red) types a chat message containing Human Rogue as A substring
    • Conditions
      • PlayerHasHero[(Player number of (Triggering player))] Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) is in Alliance) Equal to True
        • Then - Actions
          • Unit - Create 1 (Unit-type((Entered chat string))) for (Triggering player) at (Center of SpawnRegion) facing Default building facing degrees
          • Set PlayerHasHero[(Player number of (Triggering player))] = True
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) the text: You Cannot Play Tha...
this would be the opposite for horde.


sounds cool, now I got to find all those stuff :p

P.S. could you add a map in it so i can copy it? checking variables and such
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
not really, i didnt save it and the information is all there, it would take me the same time to rebuild it as it would for you to make it, sorry. one note, i put as a substring, it should be as an exact match. you can use as a substring to try and isolate the two different entered word but i dont know how to do thi im afraid, otherwise you could save yourself masses of hassle and make the trigger more efficient.
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
playerhashero is a boolean variable that is set to false by deafult and changed to true when the player spawns a hero. the variable is an array of 12 so there is one for each person. the condition makes sure this is false so it knows there isnt already a hero for the triggering person.

the variables alliance and horde are boolean also determin what team the person typing the message is on and check if the person typing the message is allowed that hero. btw i would group them together and use true as alliance and false as horde to maximise efficiency.

thats the variables explained, the rest is all up there.

ps 2,222 posts :)
 
Level 6
Joined
Feb 10, 2005
Messages
223
hmm, but that variable is not selectable in my condition list :S besides can you be more excact please on the Alliance and Horde variables?

Again this is what I want in my trigger:

A player got the possibility to spawn only 1 hero (!!!!!!), but can only pick from the heroes that are available for those players! So it's like every player from a group can summon whatever hero they can choose from, however if you already summoned a shaman you cant summon a paladin anymore, aswell as an Alliance player cant summon an undead rogue.
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
you need to make the variables first, then you need to make a condition that is boolean and then you need to select the variable from the variable type in the boolean condition. if you make a boolean condition you should see it in the options.

a boolean variable basically mean, is statement X = true or false. the alliance and horde variables simply state is triggering person in alliance = true or false and is triggering person in horde = true or false. what you can do is have only one variable where you set a player = true for alliance and false for horde instead of having two seperate variables. i hope this makes sense, im not great at explainging this.
 
Level 3
Joined
May 28, 2007
Messages
57
GST_Nemisis variables are
Variable Name: Alliance
Variable Type: Player Group

and then put in your condition
If - Conditions
((Triggering player) is in Alliance) Equal to True

and so on
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
oke but wasnt I supposed to put false or something on it?

it doesnt matter, by the time the system uses it the variable would have changed if the player is on alliance or stayed as false if on horde. this is because the variable is changed instantly on map startup and the comparison is only done when the user types in the unit they want to spawn.

i am sorry if i have confused you on the way, i have tried to explain how i would do it and what is easiest at the same time which has conflicted. read what Final_Nova said and apply it to the trigger i made above. that is the easiest, but not the most efficient, way of doing this.
 
Level 6
Joined
Feb 10, 2005
Messages
223
Oke, I will try it this day. Still I got 1 remark on your trigger, when I tried without variables and I typed for example Human Paladin (just an example!!) it didnt spawn + it immediately gave me the message that a player of my typ couldnt spawn that character (like I requested with the horde and alliance thingy)


And btw, when I make that Alliance variable with condition: Player group and array on 6 I still get that false thingy off, and do I have to change that false thingy to random player from playergroup player 1?

and If I do I get more like this:

(triggering Unit is in Alliance [index(what I got to put in here? if I do nothing it will become 0!!])

thanks for your time and patience,

Nazghul_Master
 
Level 5
Joined
May 2, 2007
Messages
141
>_>

Why do it the hard way?

Go and create 2 forces, Alliance and Horde. . . set the Race for all the Alliance players to Human, and all the Horde players to Orc. . .

Then use the 'Player Race = Human' condition so that only ppl in the Alliance can get Alliance Heroes and then do the same for the Horde
 
Level 3
Joined
May 28, 2007
Messages
57
Your variable Alliance should not have an array because right now you are saying there are 6 dirrerent alliance groups not 6 players in the alliance group just remove the array and then finish off the trigger done by GST_Nemisis and everything should be fine.
 
Level 6
Joined
Feb 10, 2005
Messages
223
My way is easier. . .

sounds good, you jsut forgot something, with your way I can summon as much heroes as I want! not a maximum of 1

P.S. how to make this trigger work correct:

when you finally made the comment and all works that you got like:

create 1 unit of X order (how to make it work?? I mean some player 1's want to play priests, others want to play warriors, how to make it fit well to whatever anyone wants? Ofcourse I can make like 10 different triggers for player 1 for ehach selectable class but that will just take too much space!
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
sounds good, you jsut forgot something, with your way I can summon as much heroes as I want! not a maximum of 1

ok have you got it working? if you have dont worry about any of this or changing it.

basically Red Orca is describing what i would do and in my trigger whcih i made instead of using "((Triggering player) is in Alliance) Equal to True" i would use "((Triggering player) is an Ally of Player 1 (Red)) Equal to True" with "((Triggering player) is an Ally of Player 7 (Green)) Equal to True" . this would save you using a variable and save you making an extra trigger but you would have to set the two forces. because i dont know the details of your map i dont know who is allied with who or how you have your foces set up so i didnt put forward this idea. if you have it working as it is, just use it, else modify my trigger to have it set to allies if you understand this.
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
..........send me your map and i will do it all for you and optimise it so it works very efficiently too, if you dont have a problem with that. i have already explained how to fix this problem so i may as well do it for you.

EDIT:

ive done some reasearch and it turns out you cannot spawn a unit with a custom name using the "unit-type from string" function. this is weird because even if you change the name of a footman to mage (or whatever) and you type "spawn mage" nothing will happen, but if you type "spawn footman" it will spawn a footman even though you have changed its name to mage! it makes no sense, the game must have a second naming system which works underneath the standard unit name. if anyone knows how to fix this please say.
 
Last edited:
  • Create Human Hero
    • Events
      • Player - Player 1 (Red) types a chat message containing Human Paladin as A substring
      • -------- Etc Etc Etc --------
    • Conditions
      • PlayerHasHero[(Player number of (Triggering Player))] equal to false
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Race of (Triggering Player)) equal to Human [i]-------- Red Orca's way[/i]
        • Then - Actions
          • -------- Repeat this IF for each hero --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Substring ((Entered Chat String), 7, (String Lenght (Entered Chat String))) equal to Paladin
            • Then - Actions
              • Set PlayerHasHero[(Player number of (Triggering Player))]
              • Unit - Create 1 Paladin to (Triggering Player) ...
            • Else - Actions
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) the text: Error text
Almost the same for Horde, but change the condition to "Orc".
I see no easier way to do it xD
Maybe because I need to sleep a little hehehe =P

@GST_Nemisis: this may be because the BASE unit is the Footman (the code of the base: hfoo). I do not understand this very well, but if you hit Ctrl + D in the custom unit, you'll see in front of its Raw Code something like the base unit's one.
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
@GST_Nemisis: this may be because the BASE unit is the Footman (the code of the base: hfoo). I do not understand this very well, but if you hit Ctrl + D in the custom unit, you'll see in front of its Raw Code something like the base unit's one.

yeh i thought it would be because of something like this, thanks for the info, im gunna have to play around with that a bit and see what i can do for fun.

so Nazghul_Master that was the problem, use the trigger by Marcelo Hossomi, it looks good :)
 
Use Dialogs

I suggest that you use Dialogs! Before you make this thing make 2 dialogs in variables, one named AllianceDialog and another named HordeDialog.
Create as much dialog buttons as you have classes for each race.
Lastly, Create P*Hero where * = the number of the player (Create each player). This will check if you have made a hero yet

  • Events
    • Map initialization
  • Conditions
  • Actions
    • Dialog - Create a dialog button for AllianceDialog titled AllianceClass1
    • Set AClass1 = [Last Created Dialog Button]
    • Dialog - Create a dialog button for AllianceDialog titled AllianceClass2
    • Set AClass2 = [Last Created Dialog Button]
    • Dialog - Create a dialog button for AllianceDialog titled AllianceClass3
    • Set AClass3 = [Last Created Dialog Button]
    • Dialog - Create a dialog button for HordeDialog titled HordeClass1
    • Set HClass1 = [Last Created Dialog Button]
    • Dialog - Create a dialog button for HordeDialog titled HordeClass2
    • Set HClass2 = [Last Created Dialog Button]
    • Dialog - Create a dialog button for HordeDialog titled HordeClass3
    • Set HClass3 = [Last Created Dialog Button]
    • Player Group - Pick every player in (All Allies of (Player 1 (Red)) and do Dialog - Show AllianceDialog for (Picked Player)
    • Player Group - Pick every player in (All Allies of (Player 7 (Green)) and do Dialog - Show HordeDialog for (Picked Player)
Lol
Someone finish it for me i can't be bothered =[ Sorry
 
Last edited by a moderator:
Level 2
Joined
Jun 3, 2007
Messages
20
Yeah I would also do it through dialogues. That way new people to the map don't have to stumble through word combinations either, they get buttons and they can just go oohhh paladin they sound cool...
 
Status
Not open for further replies.
Top