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

[Trigger] Some sorts of admin commands

Status
Not open for further replies.
Level 2
Joined
Apr 7, 2008
Messages
14
Hi there,
Could some please explain and show me (using GUI triggers) how to make this trigger work for me?

typed message: -setgold <player variable> <amount>
makes the player in <player variable> slot suddenly have <amount> of gold. I need this for players 1-6
E.G:
-setgold blue 40000
sets blue's gold to 40000

The same trigger is needed for setwood ;)

Thanks in advance,

Fox:spell_breaker:
 
Level 7
Joined
Mar 12, 2006
Messages
407
  • Events
    • Player - Player 1 (Red) types -setgold as exact match
    • Player - Player 2 (Blue) types -setgold as exact match
    • ...
  • Conditions
  • Actions
    • Player - Add 1000 Gold to (triggering players) actual gold
NOte that you have to add all 6 players to the event
The action is listed as Player - Add property

if you got it working for gold copy n paste your gold trigger, change -setgold to -setwood
and then modify your Player Action to add wood (it is the same function you can choose from gold / wood / food / points etc)
 
Level 2
Joined
Apr 7, 2008
Messages
14
Thanks, but not quite exactly what I need :\

Example:
Red types -setgold blue 400
blue's gold goes to 400

red types -setgold orange 400
oranges gold goes up to 400.

Thanks in advance,
Fox
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Thanks, but not quite exactly what I need :\

Example:
Red types -setgold blue 400
blue's gold goes to 400

red types -setgold orange 400
oranges gold goes up to 400.

Thanks in advance,
Fox

Use your mind, then go to the editor and look at Player events and actions, and change what apocalypse_dude did to whatever you want.

Honestly, can't you people think more then a bird ?
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
Use this:

  • Events: Player - Player 1 (Red) types a chat message containing -setgold as A substring
  • Conditions: NONE
  • Actions:
    • -------- Blue --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Substring((Entered chat string), 10, 13)) Equal to blue
      • Then - Actions
        • Player - Set Player 2 (Blue) Current gold to (Integer((Substring((Entered chat string), 15, (Length of (Entered chat string))))))
      • Else - Actions
    • -------- Teal --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Substring((Entered chat string), 10, 13)) Equal to teal
      • Then - Actions
        • Player - Set Player 3 (Teal) Current gold to (Integer((Substring((Entered chat string), 15, (Length of (Entered chat string))))))
      • Else - Actions
    • -------- Purple --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Substring((Entered chat string), 10, 15)) Equal to purple
      • Then - Actions
        • Player - Set Player 4 (Purple) Current gold to (Integer((Substring((Entered chat string), 17, (Length of (Entered chat string))))))
      • Else - Actions
    • -------- Yellow --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Substring((Entered chat string), 10, 15)) Equal to yellow
      • Then - Actions
        • Player - Set Player 5 (Yellow) Current gold to (Integer((Substring((Entered chat string), 17, (Length of (Entered chat string))))))
      • Else - Actions
    • -------- Orange --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Substring((Entered chat string), 10, 15)) Equal to orange
      • Then - Actions
        • Player - Set Player 6 (Orange) Current gold to (Integer((Substring((Entered chat string), 17, (Length of (Entered chat string))))))
      • Else - Actions
For wood just copy the trigger and set:
  • Player 1 (Red) types a chat message containing -setgold as A substring
to:
  • Player 1 (Red) types a chat message containing -setwood as A substring
Then replace all "Current Gold" with "Current lumber".
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Because -setgold is 0 to 8, then the space is 9, and then 10 - next one is the player's name.

The_Reborn_Devil, you should add a condition that substring 0 to 8 is that sentence, so only if you type it like that the trigger will work.
Currently also if the player types "bla blo blu -setgold" it would start the trigger without any point.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
While Jass would be undescribably cleaner for this, here you are:

Uses two integer variables, bound and bound2, a string variable, PlayerString, and a player variable, TargetPlayer.

Untested, and the syntax may not be perfect since this was written in Notepad.

Also, light blue and dark green must be typed as lightblue and darkgreen for the input, since the trigger separates at spaces.

  • Set Gold
    • Events
      • Player - Player 1 (Red) types -setgold as a substring
      • Player - Player 2 (Blue) types -setgold as a substring
      • Player - Player 3 (Teal) types -setgold as a substring
      • Player - Player 4 (Purple) types -setgold as a substring
      • Player - Player 5 (Yellow) types -setgold as a substring
      • Player - Player 6 (Orange) types -setgold as a substring
      • Player - Player 7 (Green) types -setgold as a substring
      • Player - Player 8 (Pink) types -setgold as a substring
      • Player - Player 9 (Grey) types -setgold as a substring
      • Player - Player 10 (Light Blue) types -setgold as a substring
      • Player - Player 11 (Dark Green) types -setgold as a substring
      • Player - Player 12 (Brown) types -setgold as a substring
    • Conditions
      • (Substring((Entered Chat String),0,8) Equal to '-setgold')
      • -------- Your conditions here --------
    • Actions
      • -------- Find the different words --------
      • Set bound = 0
      • Set bound2 = 0
      • For Each Integer A from 10 to (Length of (Entered Chat String))
        • Loop - Actions
          • If (All conditions are true) Then do (Then actions) Else do (Else actions)
            • If - Conditions
              • (Substring((Entered Chat String),(Integer A),(Integer A)) Equal to )
              • -------- (Equal to a space) --------
            • Then - Actions
              • If (All conditions are true) Then do (Then actions) Else do (Else actions)
                • If - Conditions
                  • (bound Equal to 0)
                • Then - Actions
                  • Set bound = ((Integer A) + 1)
                • Else - Actions
                  • Set bound2 = ((Integer A) - 1)
                  • Custom script: exitwhen true
            • Else - Actions
      • If (All conditions are true) Then do (Then actions) Else do (Else actions)
        • If - Conditions
          • (bound2 Equal to 0)
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • Set PlayerString = Substring((Entered chat string),bound,bound2)
      • If (All conditions are true) Then do (Then actions) Else do (Else actions)
        • If - Conditions
          • (PlayerString Equal to red)
        • Then - Actions
          • Set TargetPlayer = Player 1 (Red)
        • Else - Actions
          • If (All conditions are true) Then do (Then actions) Else do (Else actions)
            • If - Conditions
              • (PlayerString Equal to blue)
            • Then - Actions
              • Set TargetPlayer = Player 2 (Blue)
            • Else - Actions
              • -------- Continue for all players --------
              • -------- In the 'else' for Player 12 (Brown), put 'Skip remaining actions' --------
      • Player - Add Integer(Substring((Entered Chat String),(bound2 + 2),(Length of (Entered Chat String)))) Gold to TargetPlayer
To change for -setlumber and -setfood, or any other commands, you just need to tweak the substring positions, and of course the "-setgold" string.
 
Level 2
Joined
Apr 7, 2008
Messages
14
PurplePoot and The_Reborn_Devil, Thank you :)

GhostWolf, instead of flaming people who can't use WE 24/7 like you, go get some friends.
 
Level 2
Joined
Apr 7, 2008
Messages
14
I used this code, can someone verify and see if this is right? Thanks.
  • Set Property
    • Events
      • Player - Player 1 (Red) types a chat message containing - as A substring
      • Player - Player 2 (Blue) types a chat message containing - as A substring
      • Player - Player 3 (Teal) types a chat message containing - as A substring
      • Player - Player 4 (Purple) types a chat message containing - as A substring
      • Player - Player 5 (Yellow) types a chat message containing - as A substring
      • Player - Player 6 (Orange) types a chat message containing - as A substring
      • Player - Player 11 (Dark Green) types a chat message containing - as A substring
      • Player - Player 12 (Brown) types a chat message containing - as A substring
    • Conditions
      • (Name of (Triggering player)) Equal to Zayfox
      • (Name of (Triggering player)) Equal to WhindSoldier
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Substring((Entered chat string), 5, (5 + (Length of colour[(Integer A)])))) Equal to (colour[(Integer A)] + )
            • Then - Actions
              • Set Amount = (Integer((Substring((Entered chat string), (5 + (Length of colour[(Integer A)])), 25))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Substring((Entered chat string), 2, 7)) Equal to setwood
                • Then - Actions
                  • Player - Set (Player((Integer A))) Current lumber to Amount
                • Else - Actions
                  • Do Nothing
Amount is the variable to set to
colour is a player array with players 1-12.
 
Level 9
Joined
Oct 17, 2007
Messages
547
PurplePoot and The_Reborn_Devil, Thank you :)

GhostWolf, instead of flaming people who can't use WE 24/7 like you, go get some friends.

It would help you a lot (in the long run) if you do a little bit of thinking before asking. This applies to life in general not only WE. Try playing around with the actions in the trigger editor so you dont have to ask for help at every bump in the road.
 
  • Set gold
    • Events
      • Player - Player 1 (Red) types a chat message containing -set gold p as A substring
      • Player - Player 2 (Blue) types a chat message containing -set gold p as A substring
      • Player - Player 3 (Teal) types a chat message containing -set gold p as A substring
      • Player - Player 4 (Purple) types a chat message containing -set gold p as A substring
      • Player - Player 5 (Yellow) types a chat message containing -set gold p as A substring
      • Player - Player 6 (Orange) types a chat message containing -set gold p as A substring
      • Player - Player 7 (Green) types a chat message containing -set gold p as A substring
      • Player - Player 8 (Pink) types a chat message containing -set gold p as A substring
      • Player - Player 9 (Gray) types a chat message containing -set gold p as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -set gold p as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -set gold p as A substring
      • Player - Player 12 (Brown) types a chat message containing -set gold p as A substring
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Name of (Triggering player)) Equal to Gray_Stuff111
    • Actions
      • Player - Set (Player((Integer((Substring((Entered chat string), 12, 13)))))) Current gold to (Integer((Substring((Entered chat string), 14, 1000000000))))
Easier than you thought, Huh?
 
Level 2
Joined
Apr 7, 2008
Messages
14
yea, but how could I make it player colours (I have a colour array variable) instead of numbers? I used colours for everything else in the map.

Thanks loads btw.
colour arrays are all proper names except for oj and dg.
 
Level 2
Joined
Apr 7, 2008
Messages
14
  • Set gold
    • Events
      • Player - Player 1 (Red) types a chat message containing -set gold p as A substring
      • Player - Player 2 (Blue) types a chat message containing -set gold p as A substring
      • Player - Player 3 (Teal) types a chat message containing -set gold p as A substring
      • Player - Player 4 (Purple) types a chat message containing -set gold p as A substring
      • Player - Player 5 (Yellow) types a chat message containing -set gold p as A substring
      • Player - Player 6 (Orange) types a chat message containing -set gold p as A substring
      • Player - Player 7 (Green) types a chat message containing -set gold p as A substring
      • Player - Player 8 (Pink) types a chat message containing -set gold p as A substring
      • Player - Player 9 (Gray) types a chat message containing -set gold p as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -set gold p as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -set gold p as A substring
      • Player - Player 12 (Brown) types a chat message containing -set gold p as A substring
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Name of (Triggering player)) Equal to Gray_Stuff111
    • Actions
      • Player - Set (Player((Integer((Substring((Entered chat string), 12, 13)))))) Current gold to (Integer((Substring((Entered chat string), 14, 1000000000))))

  • Setgold
    • Events
      • Player - Player 1 (Red) types a chat message containing -set gold p as A substring
      • Player - Player 2 (Blue) types a chat message containing -set gold p as A substring
      • Player - Player 3 (Teal) types a chat message containing -set gold p as A substring
      • Player - Player 4 (Purple) types a chat message containing -set gold p as A substring
      • Player - Player 5 (Yellow) types a chat message containing -set gold p as A substring
      • Player - Player 6 (Orange) types a chat message containing -set gold p as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -set gold p as A substring
      • Player - Player 12 (Brown) types a chat message containing -set gold p as A substring
    • Conditions
      • (Name of (Triggering player)) Equal to Zayfox
      • (Name of (Triggering player)) Equal to WhindSoldier
    • Actions
      • Player - Set (Player((Integer((Substring((Entered chat string), 12, 13)))))) Current gold to (Integer((Substring((Entered chat string), 14, 1000000000))))
Is there a difference between the two?
Second one is my code.
 
Status
Not open for further replies.
Top