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

[Trigger] Help plz!!!

Status
Not open for further replies.
Level 5
Joined
Oct 30, 2007
Messages
91
i need to know how1 to make an attack all command or trigger with a spell to activate the attack all command. help!!:fp: ex: either you type in -attack (color) or use the spell attack blue and mass attack blue
 
Level 5
Joined
Dec 12, 2006
Messages
128
action player types -attack _______

condition player equal_____

Action Pick every unit in map <condtion> and do multiple action
condition: picked unit is owned by player 1 red
unit order picked unit to attack-move to center of region (player _______ base region)

Also you might want to check out the tutorials here on the Hive +

Welcome.
 
Level 3
Joined
Oct 23, 2007
Messages
36
Use array variables

First use this trigger to set the locations of the "castle" being built
  • Set Base Coordinates
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Castle
    • Actions
      • Set MainBaseLocation[(Player number of (Owner of (Triggering unit)))] = (Position of (Constructed structure))
Next use this to order the units
I'm going to assume that the commands use the players number rather than color for simplicity ("-attack 1")

  • Attack All Command
    • Events
      • Player - Player 1 (Red) types a chat message containing -attack as A substring
      • Player - Player 2 (Blue) types a chat message containing -attack as A substring
      • Player - Player 3 (Teal) types a chat message containing -attack as A substring
      • Player - Player 4 (Purple) types a chat message containing -attack as A substring
      • Player - Player 5 (Yellow) types a chat message containing -attack as A substring
      • Player - Player 6 (Orange) types a chat message containing -attack as A substring
      • Player - Player 7 (Green) types a chat message containing -attack as A substring
      • Player - Player 8 (Pink) types a chat message containing -attack as A substring
      • Player - Player 9 (Gray) types a chat message containing -attack as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -attack as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -attack as A substring
      • Player - Player 12 (Brown) types a chat message containing -attack as A substring
    • Conditions
    • Actions
      • Set PlayerNumber = (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string))))))
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
        • Loop - Actions
          • Set TempPoint = MainBaseLocation[PlayerNumber]
          • Unit - Order (Picked unit) to Attack-Move To TempPoint
          • Custom script: call RemoveLoc(udg_TempPoint)
The player number can be substituted with a string that identifies by color, but then you would have to make a conversion of string --> player number.

NOTE: the command is either "call RemoveLoc(udg_TempPoint)" or "call RemoveLocation(udg_TempPoint)" I can never remember
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
First its "call RemoveLocation(udg_Location) and second could do it like this if you want it to be based on colors

  • Unknown
    • Events
      • Player - Player 1 (Red) types a chat message containing -attack as A substring
      • Player - Player 2 (Blue) types a chat message containing -attack as A substring
      • Player - Player 3 (Teal) types a chat message containing -attack as A substring
      • Player - Player 4 (Purple) types a chat message containing -attack as A substring
      • Player - Player 5 (Yellow) types a chat message containing -attack as A substring
      • Player - Player 6 (Orange) types a chat message containing -attack as A substring
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Substring((Entered chat string), 9, 11)) Equal to red
        • Then - Actions
          • -------- Add here the remove unit group custom script, never remember it lol --------
          • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Red's Base
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Substring((Entered chat string), 9, 12)) Equal to blue
            • Then - Actions
              • -------- Add here the remove unit group custom script, never remember it lol --------
              • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
                • Loop - Actions
                  • Unit - Order (Picked unit) to Attack-Move To Blue's Base
            • Else - Actions
  • -------- Etc. for all players --------
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
If you mean the "MainBaseLocation" as you can see its a Position = Point variable.
With the harray just set it to 1 (default) which allows you to use infinite instances if the variable.

And as a second thought, if its possible to rebuild castels if they are destroyed or something like that, you should destroy the point when the castle gets destroyed with this custom script

Custom script: call RemoveLocation(udg_Location)

This will destroy the point called "Location".

For harray use this

Custom script: call RemoveLocation(udg_Location[1])
This will destroy the point called "Location[1]"
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
When a player write some text as a Substring it means its only a part of the whole string.

So you need to start it when a player types "-attack" and then you need to calculate what the player said AFTER the -attack.

the conditions of substrings you see do that.
For example the red one condition - (Substring((Entered chat string), 9, 11)) Equal to red - it checks that at the 9th character of the whole string there is a "r", then at the 10th there is a "e" and at the 11th there is a "d".

I made it 9-11 since "-attack" is 1-7, so the whole string would be "-attack red" and would include 11 characters (yes space is a charcater).

If you need more explaination I would be glad to explain.
 
Status
Not open for further replies.
Top