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

[General] Need help with a command.

Status
Not open for further replies.
Level 2
Joined
Dec 15, 2012
Messages
26
I'm working on a Titan Land map, and I'm trying to figure out how to imitate some of the core features. I've gotten to a point where i just have no idea how to do it. There's a command called '-rgb xxx xxx xxx', to select which colour to use for recolouring units in-game. The thing is that in the map you can do '-rgb xxx x xxx' or '-rgb x x xxx', and it still can read the right values. How do i make it able to read it like that? I've thought about checking if the character before the number is zero, and going by that, but i feel like there should be a cleaner way.
 
Level 7
Joined
Nov 15, 2009
Messages
225
Have fun with it.. :)

  • rgb
    • Events
      • Player - Player 1 (Red) types a chat message containing -rgb as A substring
    • Conditions
      • (Length of (Entered chat string)) Greater than or equal to 10
    • Actions
      • Set TempInteger = 1
      • Set TempString = <Empty String>
      • Set TempString2 = <Empty String>
      • Set TempString3 = <Empty String>
      • For each (Integer A) from 6 to 16, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempInteger Equal to 1
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Substring((Entered chat string), (Integer A), (Integer A))) Not equal to
                  • (Integer A) Less than or equal to 8
                  • (Length of TempString) Less than 3
                • Then - Actions
                  • Set TempString = (TempString + (Substring((Entered chat string), (Integer A), (Integer A))))
                • Else - Actions
                  • Set TempInteger = 2
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInteger Equal to 2
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Substring((Entered chat string), (Integer A), (Integer A))) Not equal to
                      • (Integer A) Less than or equal to 12
                      • (Length of TempString2) Less than 3
                    • Then - Actions
                      • Set TempString2 = (TempString2 + (Substring((Entered chat string), (Integer A), (Integer A))))
                    • Else - Actions
                      • Set TempInteger = 3
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TempInteger Equal to 3
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Substring((Entered chat string), (Integer A), (Integer A))) Not equal to
                          • (Integer A) Less than or equal to 16
                          • (Length of TempString3) Less than 3
                        • Then - Actions
                          • Set TempString3 = (TempString3 + (Substring((Entered chat string), (Integer A), (Integer A))))
                        • Else - Actions
                          • Set TempInteger = 4
                    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Length of TempString) Equal to 0
              • (Length of TempString2) Equal to 0
              • (Length of TempString3) Equal to 0
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to (Triggering player)
            • Then - Actions
              • Animation - Change (Picked unit)'s vertex coloring to ((100.00 x ((Real(TempString)) / 255.00))%, (100.00 x ((Real(TempString2)) / 255.00))%, (100.00 x ((Real(TempString3)) / 255.00))%) with 0.00% transparency
            • Else - Actions
I didn't add error messages, but made it possible to add them very easy.
Hope I could help!

Edit: You just need to copy and paste the event for all the other players.
Forgot it, sorry.. :/
 

Attachments

  • rgb.w3x
    17.4 KB · Views: 46
Level 2
Joined
Dec 15, 2012
Messages
26
I'll try it out. I'll tweak it a bit, since it's not the exact thing I'll be using it for. Hope it works.
 
Level 2
Joined
Dec 15, 2012
Messages
26
It's pretty much the same, except it saves it as a value, so that it can be used later. You have a unit with a spell to colour things. It's so you don't have to enter the command when you wanna colour a ton of things :3 Also, it worked! Huzzah! Thanks a bunch for your help.
 
Status
Not open for further replies.
Top