Snippet Give Gold To Player Trigger

DrEvil

FCRI Associate!
Reaction score
111
Well i heard alot of people saying "-gold (playercolour) (amount) " wasnt possible...

I made a system to sort that problem out .
It requires you to do "-g <playercolour> <amount>" without quotes

Its in GUI , i will make it JASS soon .

Dont know if it has been done before but o'well here is my codes =
Code:
GG
    Events
        Player - Player 1 (Red) types a chat message containing -g  as A substring
    Conditions
        (Substring((Entered chat string), 1, 3)) Equal to -g 
    Actions
        Set StartCount = 1
        Set EndCount = 1
        For each (Integer A) from 4 to (Length of (Entered chat string)), do (Actions)
            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 <
                    Then - Actions
                        Set StartV[StartCount] = ((Integer A) + 1)
                        Set StartCount = (StartCount + 1)
                    Else - 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 >
                    Then - Actions
                        Set EndV[EndCount] = ((Integer A) - 1)
                        Set EndCount = (EndCount + 1)
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                And - All (Conditions) are true
                    Conditions
                        EndCount Greater than or equal to 2
                        StartCount Greater than or equal to 2
            Then - Actions
                Set S = (Substring((Entered chat string), StartV[1], EndV[1]))
                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
                                S Equal to Names[(Integer A)]
                            Then - Actions
                                Set TargetPlayer = (Player((Integer A)))
                                Set S = (Substring((Entered chat string), StartV[2], EndV[2]))
                                Set GoldGiven = (Integer(S))
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Triggering player) Current gold) Greater than or equal to GoldGiven
                                    Then - Actions
                                        Player - Set TargetPlayer Current gold to ((TargetPlayer Current gold) + GoldGiven)
                                        Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - GoldGiven)
                                        Game - Display to (Player group((Triggering player))) the text: (You just gave  + ((Name of TargetPlayer) + (  + ((String(GoldGiven)) +  gold.))))
                                        Game - Display to (Player group(TargetPlayer)) the text: ((Name of (Triggering player)) + ( just gave you  + ((String(GoldGiven)) +  gold.)))
                                    Else - Actions
                            Else - Actions
            Else - Actions
Code:
Setup
    Events
        Time - Elapsed game time is 0.01 seconds
    Conditions
    Actions
        Set Names[1] = red
        Set Names[2] = blue
        Set Names[3] = teal
        Set Names[4] = purple
        Game - Display to (All players) the text: Type    "-g <player...
        Game - Display to (All players) the text: To give "PlayerColo...

:D Hope you all enjoy my first system at TheHelper .

Pic :
GGT.jpg

Heres the map
 

Attachments

  • GiveGoldTrigger.w3x
    10.6 KB · Views: 189

DrEvil

FCRI Associate!
Reaction score
111
[del]well think about it ...

how would you store the player and amount in -g blue 5 [/del]
I suppose i could of done it a much more sensibler way lol .
I could make it much neater and less sh1ty .

Should i do that or not ?

Still isnt it good enough the way it is ? Or is it to sloppy ?
 

Tyman2007

Ya Rly >.
Reaction score
74
A lot of those functions seems really unnecessary.

Seems like you went for bulk and to make it look neat than to go simple.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top