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

Lottery System Reloaded v1.0

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: ILH

Lottery System Reloaded


Triggers



  • LotSys Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_LotSys_LineBreak = "\n"
      • -------- Random Range --------
      • Set LotSys_RandomRange[0] = 0
      • Set LotSys_RandomRange[1] = 2
      • -------- Maximum bet --------
      • Set LotSys_MaxBet = 2000
      • -------- Draw Count --------
      • Set LotSys_DrawCount = 5
      • -------- Prize --------
      • Set LotSys_PrizeMultiplier = 2
      • -------- Seperator ex. 2/500 or 2-500 (2 is your number 500 is your bet) --------
      • Set LotSys_Seperator = /
      • -------- Messages --------
      • Set LotSys_Messages[0] = Invalid Input
      • Set LotSys_Messages[1] = Your number is
      • Set LotSys_Messages[2] = Your bet is
      • Set LotSys_Messages[3] = Drawing...
      • Set LotSys_Messages[4] = You Won
      • Set LotSys_Messages[5] = You Loose
      • Set LotSys_Messages[6] = Has won



  • LotSys Dialog
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
    • Conditions
    • Actions
      • Dialog - Clear LotSys_Dialog
      • Dialog - Change the title of LotSys_Dialog to (Gold: + (String(((Triggering player) Current gold))))
      • Dialog - Create a dialog button for LotSys_Dialog labelled Type Bet ex. 1-200...
      • Set LotSys_DialogButtons[(Player number of (Triggering player))] = (Last created dialog Button)
      • Dialog - Show LotSys_Dialog for (Triggering player)



  • LotSys Dialog Buttons
    • Events
      • Dialog - A dialog button is clicked for LotSys_Dialog
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to LotSys_DialogButtons[(Player number of (Triggering player))]
        • Then - Actions
          • Set LotSys_Typing[(Player number of (Triggering player))] = True
          • Game - Display to (Player group((Triggering player))) the text: (Please type + ((# + LotSys_Seperator) + Bet to draw.))
        • Else - Actions



  • LotSys Set and Draw
    • Events
      • Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
      • Player - Player 2 (Blue) types a chat message containing <Empty String> as A substring
      • Player - Player 3 (Teal) types a chat message containing <Empty String> as A substring
    • Conditions
      • LotSys_Typing[(Player number of (Triggering player))] Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • ((Triggering player) Current gold) Greater than or equal to (Integer((Substring((Entered chat string), 3, (3 + (Length of (String(LotSys_MaxBet))))))))
              • (Integer((Substring((Entered chat string), 1, 1)))) Greater than or equal to 0
              • (Substring((Entered chat string), 2, 2)) Equal to LotSys_Seperator
              • (Integer((Substring((Entered chat string), 3, (3 + (Length of (String(LotSys_MaxBet)))))))) Less than or equal to LotSys_MaxBet
              • LotSys_Typing[(Player number of (Triggering player))] Equal to True
        • Then - Actions
          • Set LotSys_Typing[(Player number of (Triggering player))] = False
          • Set LotSys_Number[(Player number of (Triggering player))] = (Integer((Substring((Entered chat string), 1, 1))))
          • Set LotSys_Bet[(Player number of (Triggering player))] = (Integer((Substring((Entered chat string), 3, (3 + (Length of (String(LotSys_MaxBet))))))))
          • Game - Display to (Player group((Triggering player))) the text: ((LotSys_Messages[1] + (String(LotSys_Number[(Player number of (Triggering player))]))) + (LotSys_LineBreak + (LotSys_Messages[2] + (String(LotSys_Bet[(Player number of (Triggering player))])))))
          • Game - Display to (Player group((Triggering player))) the text: LotSys_Messages[3]
          • For each (Integer A) from 0 to LotSys_DrawCount, do (Actions)
            • Loop - Actions
              • Set LotSys_Result[(Player number of (Triggering player))] = (Random integer number between LotSys_RandomRange[0] and LotSys_RandomRange[1])
              • Game - Display to (Player group((Triggering player))) the text: (String(LotSys_Result[(Player number of (Triggering player))]))
          • Game - Display to (Player group((Triggering player))) the text: (Final Result + (String(LotSys_Result[(Player number of (Triggering player))])))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LotSys_Number[(Player number of (Triggering player))] Equal to LotSys_Result[(Player number of (Triggering player))]
            • Then - Actions
              • Player - Add (LotSys_Bet[(Player number of (Triggering player))] x LotSys_PrizeMultiplier) to (Triggering player) Current gold
              • Game - Display to (Player group((Triggering player))) the text: (LotSys_Messages[4] + (String((LotSys_Bet[(Player number of (Triggering player))] x LotSys_PrizeMultiplier))))
              • Game - Display to (All players) the text: ((Name of (Triggering player)) + (LotSys_Messages[6] + (String((LotSys_Bet[(Player number of (Triggering player))] x LotSys_PrizeMultiplier)))))
            • Else - Actions
              • Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - (Integer((Substring((Entered chat string), 3, (3 + (Length of (String(LotSys_MaxBet)))))))))
              • Game - Display to (Player group((Triggering player))) the text: LotSys_Messages[5]
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) the text: (LotSys_Messages[0] + ( + ((Entered chat string) + (LotSys_LineBreak + Press ESC again.))))


Update Reloaded v1.0
Major Update v1.0 Changes.
-Major All Changed
Keywords:
Lottery, GUI
Contents

LotSys v1.0 (Map)

Reviews
14:41, 26th Mar 2015 IcemanBo: Check my post in thread.

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,182
this the trigger.

  • LotterySystem
    • Events
      • Player - Player 1 (Red) types a chat message containing -lot as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 4)) Equal to -lot
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Substring((Entered chat string), 1, 7)) Equal to -lot /h
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) the text: ---Lottery--- Max ...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Integer((Substring((Entered chat string), 10, 12)))) Equal to 0
              • (Integer((Substring((Entered chat string), 10, 12)))) Equal to (Integer(<Empty String>))
              • (Integer((Substring((Entered chat string), 10, 999)))) Greater than 500
              • ((Triggering player) Current gold) Equal to 0
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) the text: Your Bet is too lar...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Substring((Entered chat string), 10, 12)))) Less than or equal to 500
          • (Integer((Substring((Entered chat string), 10, 12)))) Not equal to 0
          • (Integer((Substring((Entered chat string), 10, 12)))) Not equal to (Integer(<Empty String>))
          • ((Triggering player) Current gold) Not equal to 0
        • Then - Actions
          • Set LotterySystem_Bet[1] = (Integer((Substring((Entered chat string), 10, 12))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering player) Current gold) Greater than or equal to LotterySystem_Bet[1]
            • Then - Actions
              • Set LotterySystem[1] = (String((Random integer number between 1 and 3)))
              • Set LotterySystem[2] = (String((Random integer number between 1 and 3)))
              • Set LotterySystem_Draws[1] = (LotterySystem[1] + (- + LotterySystem[2]))
              • Set LotterySystem_Draws[2] = (Substring((Entered chat string), 6, 8))
              • Game - Display to Player Group - Player 1 (Red) the text: (Draw : + LotterySystem_Draws[2])
              • Wait 1.00 seconds
              • Game - Display to Player Group - Player 1 (Red) the text: (String((Random integer number between 1 and 3)))
              • Wait 1.00 seconds
              • Game - Display to Player Group - Player 1 (Red) the text: (String((Random integer number between 1 and 3)))
              • Wait 1.00 seconds
              • Game - Display to Player Group - Player 1 (Red) the text: (String((Random integer number between 1 and 3)))
              • Wait 1.00 seconds
              • Game - Display to Player Group - Player 1 (Red) the text: (String((Random integer number between 1 and 3)))
              • Wait 1.00 seconds
              • Game - Display to Player Group - Player 1 (Red) the text: LotterySystem_Draws[1]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LotterySystem_Draws[1] Equal to LotterySystem_Draws[2]
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer((Substring((Entered chat string), 10, 13)))) Less than or equal to 500
                    • Then - Actions
                      • Game - Display to Player Group - Player 1 (Red) the text: (You Won! + (( + ((String((LotterySystem_Bet[1] x 2))) + )) + (Name of (Triggering player))))
                      • Player - Add (LotterySystem_Bet[1] x 2) to (Triggering player) Current gold
                    • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LotterySystem_Draws[1] Not equal to LotterySystem_Draws[2]
                • Then - Actions
                  • Game - Display to Player Group - Player 1 (Red) the text: Fail!.
                  • Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - LotterySystem_Bet[1])
                • Else - Actions
            • Else - Actions
        • Else - Actions
and these are the demos:

  • DEMO
    • Events
      • Player - Player 1 (Red) types a chat message containing -random as An exact match
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • -------- - --------
          • Unit - Remove DEMO_Random from the game
          • Player - Set (Picked player) Current gold to (Random integer number between 1 and (Random integer number between 1 and 1000000))
          • Player - Set (Picked player) Current lumber to (Random integer number between 1 and (Random integer number between 1 and 1000000))
          • Unit - Create 1 SaveLoad_Hero[(Random integer number between 1 and SaveLoad_HeroCount)] for (Picked player) at ((Picked player) start location) facing Default building facing degrees
          • Hero - Set (Last created unit) Hero-level to (Random integer number between 1 and 10), Show level-up graphics
          • Hero - Set (Last created unit) experience to (Random integer number between 1 and 9999), Show level-up graphics
          • Hero - Modify Strength of (Last created unit): Set to (Random integer number between 1 and 1000)
          • Hero - Modify Agility of (Last created unit): Set to (Random integer number between 1 and 1000)
          • Hero - Modify Intelligence of (Last created unit): Set to (Random integer number between 1 and 1000)
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Hero - Create SaveLoad_Item[(Random integer number between 1 and SaveLoad_ItemCount)] and give it to (Last created unit)
          • Set DEMO_Random = (Last created unit)
          • Set DEMO_Integers = (DEMO_Integers + 1)
          • Set DEMO_Strings[DEMO_Integers] = (((String(DEMO_Integers)) + .)) + (Name of (Last created unit)))
          • Game - Display to (All players) the text: DEMO_Strings[DEMO_Integers]
  • DEMO II
    • Events
      • Player - Player 1 (Red) types a chat message containing -randomlist as An exact match
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: DEMO_Strings[(Integer A)]


  • (Integer((Substring((Entered chat string), 10, 999)))) Greater than 500
>>>>
  • (Integer((Substring((Entered chat string), 10, (Length of (Entered chat string)))))) Greater than 500
waits are not allowed either. They prevent the system from being MPI. (search for it on the forum and you will find 999999 explanations about what it is and how to deal with it)
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,864
:vw_unimpressed::goblin_jawdrop::goblin_sleep::ogre_rage:
For the love of god.........please
Don't say that waits are bad, unless they are used wrongly. Waits don't make a spell/system not MPI or MUI...so don't say that when you don't even have proof here. That is like saying that a woman reported his husband for treating her badly when she doesn't even have proof....

jvbtwentyone, you should post finished systems/spells and stuff like that, not works in progress.
 
Level 3
Joined
Feb 26, 2015
Messages
16
Do Nothing
Should remove this :)

Save the Triggering Player
set tempPlayer = Triggering Player
then use it

Why i can remove
  • Do Nothing
Did you mean for "Save the Triggering Player"
  • Set tempPlayer[(Player number of (Triggering player))] = (Triggering player)
I set the array to 12 for 12 players.
I'm using LotSys_Bet[(Player number of (Triggering player))] Less than or equal to ((Triggering player) Current gold) for multiplayer.
 
Top