Results 1 to 7 of 7

Thread: Wiimote Laser Tag

                  
   
  1. #1
    Won Hung Lo wraggster's Avatar
    Join Date
    Apr 2003
    Location
    Nottingham, England
    Age
    52
    Posts
    139,347
    Blog Entries
    3209
    Rep Power
    50

    Rev Wiimote Laser Tag

    via carlkenner

    I made a GlovePIE Skirmish game that you can play away from the computer.

    You need:
    * Two wireless sensor bars (or TV remotes or candles or whatever generates infra-red). Each person must wear one on their body somewhere so it won't fall off or break if they run around.
    * Two Wii remotes
    * One reasonably fast computer with Windows and a Bluetooth adapter with the two wiimotes connected.
    * GlovePIE 0.29
    * a friend
    * A space where you can run around and shoot at each other, that is in range.
    * The following GlovePIE script.

    Instructions:

    Each player puts on their wireless "sensor bar" and switches it on, and they pick up their connected wiimote. Then they press "Run" on the script. Then it will warn you that you have 10 seconds before the game will start. So run and get into position.

    After the 5 seconds your weapon will start to charge up. When your weapon is charging it will beep five times then make a sound and vibrate which indicates that it is ready. Also the LEDs will come on one at a time while it is charging.

    The lights on your weapon will be on when your weapon is charged and ready to fire. You can also check whether you are player 1 or player 2 by holding the A button. Or you can check player 1's score by holding the 1 button, or you can check player 2's score by holding the 2 button. It stops counting once it gets to 10.

    You can shoot with the B button. The default maximum firing rate is five rounds per second, but you can change that at the top of the script. It will make a sound and vibrate when you shoot. If you hit the opponent then their remote will make a loud noise and power down for 7 seconds. Their weapon will beep very quietly while it charges up again. They can't shoot during that time, and they can't be shot again either.

    The score will also be shown in the debug box on the screen, if you don't want to check it with the 1 or 2 button.

    Code Via Comments, Use with Glovepie

  2. #2
    Won Hung Lo wraggster's Avatar
    Join Date
    Apr 2003
    Location
    Nottingham, England
    Age
    52
    Posts
    139,347
    Blog Entries
    3209
    Rep Power
    50

    Default

    heres the code

    Code:
    // Laser Skirmish Script
    // By Carl Kenner
    //
    // Set master volume to between 0% and 100%
    var.GameVolume = 50%
    // Set time it takes to reload to whatever you want
    var.ReloadTime = 200ms

    if not var.Initialized then
    var.Player1disabled = true
    var.Player2disabled = true
    var.BeepVolume = 40%
    Say("Skirmish will begin in 10 seconds")
    Wait 3 seconds
    Say("Ten")
    Wait 1 second
    Say("Nine")
    Wait 1 second
    Say("Eight")
    Wait 1 second
    Say("Seven")
    Wait 1 second
    Say("Six")
    Wait 100 ms
    var.Player1Starting = true
    var.Player2Starting = true
    Wait 900 ms
    //Say("Five")
    Wait 1 second
    //Say("Four")
    Wait 1 second
    //Say("Three")
    Wait 1 second
    //Say("Two")
    Wait 1 second
    //Say("One")
    Wait 1 second

    Wait 1 second
    var.BeepVolume = 2%
    var.Initialized = true
    end if

    var.player1targeted = (Wiimote2.dot1vis or Wiimote2.dot2vis) and (not var.Player1disabled)
    var.player2targeted = (Wiimote1.dot1vis or Wiimote1.dot2vis) and (not var.Player2disabled)

    var.player1reloading = keepdown(pressed(var.player1shooting), var.ReloadTime)
    var.player1shooting = Wiimote1.B and (not var.player1reloading) and (not var.player1disabled)

    var.player2reloading = keepdown(pressed(var.player2shooting), var.ReloadTime)
    var.player2shooting = Wiimote2.B and (not var.player2reloading) and (not var.player2disabled)

    if Wiimote1.A then
    Wiimote1.leds = 1
    else if Wiimote1.One then
    Wiimote1.Led1 = var.Player1Frags=1 or var.Player1Frags=5 or var.Player1Frags=8 or var.Player1Frags>=10
    Wiimote1.Led2 = var.Player1Frags=2 or var.Player1Frags=6 or var.Player1Frags>=9
    Wiimote1.Led3 = var.Player1Frags=3 or var.Player1Frags>=7
    Wiimote1.Led4 = var.Player1Frags>=4
    else if Wiimote1.Two then
    Wiimote1.Led1 = var.Player2Frags=1 or var.Player2Frags=5 or var.Player2Frags=8 or var.Player2Frags>=10
    Wiimote1.Led2 = var.Player2Frags=2 or var.Player2Frags=6 or var.Player2Frags>=9
    Wiimote1.Led3 = var.Player2Frags=3 or var.Player2Frags>=7
    Wiimote1.Led4 = var.Player2Frags>=4
    else if not var.player1disabled then
    Wiimote1.leds = 15 * (1-int(var.player1reloading))
    end if
    if Wiimote2.A then
    Wiimote2.leds = 2
    else if Wiimote2.One then
    Wiimote2.Led1 = var.Player1Frags=1 or var.Player1Frags=5 or var.Player1Frags=8 or var.Player1Frags>=10
    Wiimote2.Led2 = var.Player1Frags=2 or var.Player1Frags=6 or var.Player1Frags>=9
    Wiimote2.Led3 = var.Player1Frags=3 or var.Player1Frags>=7
    Wiimote2.Led4 = var.Player1Frags>=4
    else if Wiimote2.Two then
    Wiimote2.Led1 = var.Player2Frags=1 or var.Player2Frags=5 or var.Player2Frags=8 or var.Player2Frags>=10
    Wiimote2.Led2 = var.Player2Frags=2 or var.Player2Frags=6 or var.Player2Frags>=9
    Wiimote2.Led3 = var.Player2Frags=3 or var.Player2Frags>=7
    Wiimote2.Led4 = var.Player2Frags>=4
    else if not var.player2disabled then
    Wiimote2.leds = 15 * (1-int(var.player2reloading))
    end if

    var.player1hit = var.player2shooting and var.player1targeted
    var.player2hit = var.player1shooting and var.player2targeted

    if var.player1shooting but not var.player2hit then
    Wiimote1.volume = 120% * var.GameVolume
    Wiimote1.frequency = 300 Hz
    Wiimote1.rumble = true
    wait 100 ms
    Wiimote1.rumble = false
    Wiimote1.frequency = 400 Hz
    wait 50 ms
    Wiimote1.frequency = 0
    end if

    if var.player2shooting but not var.player1hit then
    Wiimote2.volume = 120% * var.GameVolume
    Wiimote2.frequency = 300 Hz
    Wiimote2.rumble = true
    wait 100 ms
    Wiimote2.rumble = false
    Wiimote2.frequency = 400 Hz
    wait 50 ms
    Wiimote2.frequency = 0
    end if

    if var.player1hit then
    Inc(var.Player2Frags)
    var.player1disabled = true
    Wiimote1.volume = 200% * var.GameVolume
    Wiimote1.frequency = 500 Hz
    Wiimote1.rumble = true
    wait 200 ms
    Wiimote1.leds = 1+2+4
    Wiimote1.frequency = 400 Hz
    wait 200 ms
    Wiimote1.leds = 1+2
    Wiimote1.frequency = 300 Hz
    wait 200 ms
    Wiimote1.leds = 1
    Wiimote1.frequency = 200 Hz
    wait 200 ms
    Wiimote1.leds = 0
    Wiimote1.frequency = 100 Hz
    wait 200 ms
    Wiimote1.frequency = 0
    Wiimote1.rumble = false
    var.Player1Starting = true
    end if

    if var.Player1Starting then
    var.Player1Starting = false
    Wiimote1.volume = var.BeepVolume * var.GameVolume
    wait 1 second
    // 1 second beep
    Wiimote1.frequency = 1600 Hz
    wait 100 ms
    Wiimote1.frequency = 0
    wait 900 ms
    // 2 seconds beep
    Wiimote1.leds = 1
    Wiimote1.frequency = 1600 Hz
    wait 100 ms
    Wiimote1.frequency = 0
    wait 900 ms
    // 3 seconds beep
    Wiimote1.leds = 1+2
    Wiimote1.frequency = 1600 Hz
    wait 100 ms
    Wiimote1.frequency = 0
    wait 900 ms
    // 4 seconds beep
    Wiimote1.leds = 1+2+4
    Wiimote1.frequency = 1600 Hz
    wait 100 ms
    Wiimote1.frequency = 0
    wait 900 ms
    // 5 seconds beep
    Wiimote1.leds = 1+2+4+8
    Wiimote1.frequency = 1600 Hz
    wait 100 ms
    Wiimote1.frequency = 0
    wait 900 ms
    Wiimote1.volume = 25% * var.GameVolume
    Wiimote1.frequency = 100 Hz
    Wiimote1.rumble = true
    wait 100 ms
    Wiimote1.frequency = 200 Hz
    wait 100 ms
    Wiimote1.frequency = 300 Hz
    wait 100 ms
    Wiimote1.frequency = 400 Hz
    wait 100 ms
    Wiimote1.frequency = 500 Hz
    wait 100 ms
    Wiimote1.frequency = 0
    Wiimote1.rumble = false
    var.Player1disabled = false
    end if

    if var.player2hit then
    Inc(var.Player1Frags)
    var.player2disabled = true
    Wiimote2.volume = 200% * var.GameVolume
    Wiimote2.frequency = 500 Hz
    Wiimote2.rumble = true
    wait 200 ms
    Wiimote2.leds = 1+2+4
    Wiimote2.frequency = 400 Hz
    wait 200 ms
    Wiimote2.rumble = false
    Wiimote2.leds = 1+2
    Wiimote2.frequency = 300 Hz
    wait 200 ms
    Wiimote2.leds = 1
    Wiimote2.frequency = 200 Hz
    wait 200 ms
    Wiimote2.leds = 0
    Wiimote2.frequency = 100 Hz
    wait 200 ms
    Wiimote2.frequency = 0
    var.player2starting = true
    end if

    if var.player2starting then
    var.player2starting = false
    Wiimote2.volume = var.BeepVolume * var.GameVolume
    wait 700 ms
    // 1 second beep
    Wiimote2.frequency = 1600 Hz
    wait 100 ms
    Wiimote2.frequency = 0
    wait 900 ms
    // 2 seconds beep
    Wiimote2.leds = 1
    Wiimote2.frequency = 1600 Hz
    wait 100 ms
    Wiimote2.frequency = 0
    wait 900 ms
    // 3 seconds beep
    Wiimote2.leds = 1+2
    Wiimote2.frequency = 1600 Hz
    wait 100 ms
    Wiimote2.frequency = 0
    wait 900 ms
    // 4 seconds beep
    Wiimote2.leds = 1+2+4
    Wiimote2.frequency = 1600 Hz
    wait 100 ms
    Wiimote2.frequency = 0
    wait 900 ms
    // 5 seconds beep
    Wiimote2.leds = 1+2+4+8
    Wiimote2.frequency = 1600 Hz
    wait 100 ms
    Wiimote2.frequency = 0
    wait 900 ms
    Wiimote2.volume = 25% * var.gamevolume
    Wiimote2.frequency = 100 Hz
    Wiimote2.rumble = true
    wait 100 ms
    Wiimote2.frequency = 200 Hz
    wait 100 ms
    Wiimote2.rumble = false
    Wiimote2.frequency = 300 Hz
    wait 200 ms
    Wiimote2.frequency = 400 Hz
    wait 200 ms
    Wiimote2.frequency = 500 Hz
    wait 200 ms
    Wiimote2.frequency = 0
    Wiimote2.rumble = false
    var.Player2disabled = false
    end if

    debug = Wiimote1.Battery+', '+Wiimote2.battery+ ' Score: Player1 = '+var.Player1Frags+', Player2 = '+var.Player2Frags

  3. #3
    DCEmu Newbie
    Join Date
    Aug 2005
    Posts
    50
    Rep Power
    0

    Default

    What a great idea. Reading that put a great stupid grin on my face.

  4. #4
    DCHelp Admin curt_grymala's Avatar
    Join Date
    Apr 2004
    Location
    DCHelp Land
    Posts
    1,307
    Rep Power
    80

    Default

    Quote Originally Posted by wraggster View Post
    You need:
    * Two wireless sensor bars (or TV remotes or candles or whatever generates infra-red). Each person must wear one on their body somewhere so it won't fall off or break if they run around.

    Now there's a good idea. :thumbup:
    DCHelp - A Newbie's Best Friend
    DC Evolution - Disc Images
    The DreamZone Forums

    I Refuse To Help Anyone That Says They've Tried Everything.

  5. #5
    DCEmu Newbie
    Join Date
    Jun 2006
    Posts
    10
    Rep Power
    0

    Default

    hahaha! candles?!

    can i just set myself on fire? will that count as a sensor?

  6. #6
    Banned
    Join Date
    Jan 2007
    Location
    Halloween Town
    Posts
    32
    Rep Power
    0

    Default

    Quote Originally Posted by mickshake View Post
    hahaha! candles?!

    can i just set myself on fire? will that count as a sensor?
    lol, the candles are to be unlit

  7. #7
    DCEmu Pro AtariFreek's Avatar
    Join Date
    Dec 2005
    Location
    Calgary, Alberta, Canada
    Posts
    562
    Rep Power
    0

    Default

    Actually it call for the candle to bet lit. :rofl:

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •