• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

how to make these commands???

Status
Not open for further replies.
Level 5
Joined
Jan 30, 2013
Messages
123
I need to make some commands (it is rather like DotA), please help me:
1. -ms: when a player types "-ms", there will be a text (be only shown for that player) that show his hero's movement speed.
2. -random: everyone may know this command clearly =]]
when a player types "-random", +300 gold for him and automatically give him a hero. During the random-time, hide all the heroes in the taverns (be only hidden with him, not others)
thanks!
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Basically DOTA uses some kind of string analysis, because game modes are mixed within the comands, are not harcoded. You can type -sapo instead of -apso or -soap. So, they detect when a player enters a text (-) as a substring, analyze it somehow, and must have several ITE's based on all the possible commands. Each command has it's own logic/system involved, since using -random isn't equal to using -MS, each one involves different actions. So, try to create a list of all the chat commands you want to use, and a description for each one of them.
 
Level 5
Joined
Jan 30, 2013
Messages
123
I am not lazy... Because I am a "newbie" in WE. Trigger - it's too new with me (especially GUI, I don't remember all the Events, Conditions, Actions,...). I need more time to study them :)
forgive me! :)

I have searched them on google several times, but I feel that the trigger is too long and hard-making. So that, I am looking for and studying a shorter and easier trigger to make...
 
Last edited by a moderator:
Level 29
Joined
Oct 24, 2012
Messages
6,543
u can use my tutorial things a GUIer should know as a basis for GUI things. as for ur problem u can make a massive trigger with the use of substrings. ( look for substrings in my tutorial)

it is a rather easy thing to use. try out substrings with my tutorial. if u dont understand it after u try a few times then post again. Also if u need help understanding anything on my tutorial post there and me or someone will help u asap.

i can do this for u but its always better to try to learn urself. U can also feel free to post on my tutorial if u think ur doing something wrong or anything like that.
im just posting this because i dont think u will be able to learn much if i do it by myself as it would look more complicated than anything for a beginner.

Also plz do not double post instead hit the edit button on ur last post
 
Level 8
Joined
Feb 3, 2013
Messages
277
I am not lazy... Because I am a "newbie" in WE. Trigger - it's too new with me (especially GUI, I don't remember all the Events, Conditions, Actions,...). I need more time to study them :)
forgive me! :)

I see, I take back what I said. I'll help you out a bit then

before you start - you need to setup a couple of variable arrays

unit array playerHero = index number as the buying player's number and set to the bought hero
unit type array heroID = set up index numbers to unit types of hero you want to sell
boolean array playerHasPicked = when a player picks, set this to true for the player number's index
boolean array heroPicked = when a hero is picked, set the index to heroId index of the unit type sold (you need this for random, but I didn't put that in there - so variable is not used in the demo.

you can set this up easily by looping through integer A in the GUI section.

sec I'll make a demo map and give you more info - it's always best to learn by copying a demo.
Read it and try making your own - it'll help a lot. And don't forget to take your time too :)

  • Hero Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set heroID[1] = Paladin
      • Set heroID[2] = Archmage
      • Set heroID[3] = Mountain King
      • Set heroID[4] = Blood Mage
      • Set playerColor[1] = |c00FF0303
      • Set playerColor[2] = |c000042FF
      • Set playerColor[3] = |c001CE6B9
      • Set playerColor[4] = |c00540081
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set playerHasPicked[(Integer A)] = False
          • Player - Add 1 to (Player((Integer A))) Current gold
  • Hero Picked
    • Events
      • Unit - A unit Sells a unit
    • Conditions
    • Actions
      • Set tempHero = (Sold unit)
      • Set tempBuyer = (Buying unit)
      • Set tempPlayer = (Owner of tempBuyer)
      • Set tempLoc = (Position of tempBuyer)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (tempHero is A Hero) Equal to True
        • Then - Actions
          • Unit - Move tempHero instantly to tempLoc
          • Set playerHasPicked[(Player number of tempPlayer)] = True
          • Set playerHero[(Player number of tempPlayer)] = tempHero
          • Game - Display to (All players) the text: (playerColor[(Player number of tempPlayer)] + ((Name of tempPlayer) + (|r + ( has picked + ((Name of tempHero) + !)))))
          • For each (Integer A) from 1 to 4, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of tempHero) Equal to heroID[(Integer A)]
                • Then - Actions
                  • For each (Integer B) from 1 to 4, do (Actions)
                    • Loop - Actions
                      • Player - Make heroID[(Integer A)] Unavailable for training/construction by (Player((Integer B)))
                • Else - Actions
        • Else - Actions
      • Custom script: call RemoveLocation(udg_tempLoc)
      • Custom script: set udg_tempHero = null
      • Custom script: set udg_tempBuyer = null
      • Custom script: set udg_tempLoc = null
      • Custom script: set udg_tempPlayer = null
  • Movespeed
    • Events
      • Player - Player 1 (Red) types a chat message containing -ms as An exact match
      • Player - Player 2 (Blue) types a chat message containing -ms as An exact match
      • Player - Player 3 (Teal) types a chat message containing -ms as An exact match
      • Player - Player 4 (Purple) types a chat message containing -ms as An exact match
    • Conditions
    • Actions
      • Set tempPlayer = (Triggering player)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • playerHasPicked[(Player number of tempPlayer)] Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: (Movespeed of + ((Name of playerHero[(Player number of tempPlayer)]) + ( is + ((String((Current movement speed of playerHero[(Player number of tempPlayer)]))) + .))))
        • Else - Actions
      • Custom script: set udg_tempPlayer = null
  • Repick
    • Events
      • Player - Player 1 (Red) types a chat message containing -repick as An exact match
      • Player - Player 2 (Blue) types a chat message containing -repick as An exact match
      • Player - Player 3 (Teal) types a chat message containing -repick as An exact match
      • Player - Player 4 (Purple) types a chat message containing -repick as An exact match
    • Conditions
    • Actions
      • Set tempPlayer = (Triggering player)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • playerHasPicked[(Player number of tempPlayer)] Equal to True
        • Then - Actions
          • Player - Add 1 to tempPlayer Current gold
          • Game - Display to (All players) the text: (playerColor[(Player number of tempPlayer)] + ((Name of tempPlayer) + (|r + ( has repicked + ((Name of playerHero[(Player number of tempPlayer)]) + !)))))
          • Game - Display to (All players) the text: ((Name of playerHero[(Player number of tempPlayer)]) + is now available for pick.)
          • Unit - Remove playerHero[(Player number of tempPlayer)] from the game
          • For each (Integer A) from 1 to 4, do (Actions)
            • Loop - Actions
              • Player - Make (Unit-type of playerHero[(Player number of tempPlayer)]) Available for training/construction by (Player((Integer A)))
          • Set playerHasPicked[(Player number of tempPlayer)] = False
          • Custom script: set udg_playerHero[GetPlayerId(udg_tempPlayer)] = null
        • Else - Actions
      • Custom script: set udg_tempPlayer = null
 

Attachments

  • Hero Tavern Demo.w3x
    15.6 KB · Views: 43
Last edited:
Level 29
Joined
Oct 24, 2012
Messages
6,543
u should not use integer A / B for looping they are less efficient and slower than using ur own integer.

also u shouldnt need a loop for this its simple substrings that need to be used unless u want to make multiple triggers. In that case u wont need substrings.

edit:


note: when u spawn / select the heroes for the player u need to store them into the pickedHeroArray indexed to that players number.
example: player 1 picks a unit. do
  • Set pickedHeroArray[(Player number of ( triggering player))] = unit selected
that will set the unit into the array the correct way
  • movement speed
    • Events
      • Player - Player 1 (Red) types a chat message containing -ms as An exact match
      • Player - Player 2 (Blue) types a chat message containing -ms as An exact match
      • Player - Player 3 (Teal) types a chat message containing -ms as An exact match
      • Player - Player 4 (Purple) types a chat message containing -ms as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -ms as An exact match
      • Player - Player 6 (Orange) types a chat message containing -ms as An exact match
      • Player - Player 7 (Green) types a chat message containing -ms as An exact match
      • Player - Player 8 (Pink) types a chat message containing -ms as An exact match
      • Player - Player 9 (Gray) types a chat message containing -ms as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -ms as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -ms as An exact match
      • Player - Player 12 (Brown) types a chat message containing -ms as An exact match
    • Conditions
    • Actions
      • Set tempPlayer = (Triggering player)
      • Set tempInt[0] = (Player number of tempPlayer)
      • Player Group - Add tempPlayer to tempPlayerGroup
      • Game - Display to tempPlayerGroup the text: (String((Current movement speed of pickedHeroArray[tempInt[0]])))
      • Player Group - Remove tempPlayer from tempPlayerGroup
@msongyboi
plz learn the correct naming for variables and other things. variables should be camelCased.
functions should have FirstLetterOfWordCapsed.
constant variables should be ALL_CAPS_WITH_SPACE_THING
 
Level 8
Joined
Feb 3, 2013
Messages
277
ahah yes my bad, I just got mixed up cuz of GUI - I did find that tut on conventions

and thanks for the corrections;;

while Looping in integer a might be bad, showing the concept might be a good thing to show since it'll be easier for things that require looping.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
ahah yes my bad, I just got mixed up cuz of GUI - I did find that tut on conventions

and thanks for the corrections;;

np and glad u looked for it i couldnt look for it at the time and i forgot about it lol. just edit ur above post so the TO doesnt get confused if u dont mind. also u have more variables than u need to have.
 
Status
Not open for further replies.
Top