WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Wiimote Laser Tag?
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Sensor Bar
View previous topic :: View next topic  
Author Message
TylerK



Joined: 18 Dec 2006
Posts: 384
Location: Springfield, IL

Digg It
PostPosted: Wed Jan 24, 2007 1:57 pm    Post subject:

No, nc is wanting the sound to come from the Wiimote speaker, which isn't possible yet.
Back to top
View user's profile Send private message
nc



Joined: 20 Jan 2007
Posts: 50

Digg It
PostPosted: Wed Jan 24, 2007 2:00 pm    Post subject:

That's too bad. That's one thing I'm going to start working on when I get my wiimote then. I ordered mine for a couple of days ago, it's not here yet.
Back to top
View user's profile Send private message
CarlKenner
Site Admin


Joined: 29 Nov 2006
Posts: 614

Digg It
PostPosted: Wed Jan 24, 2007 3:49 pm    Post subject:

Finished!
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:
// 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
Back to top
View user's profile Send private message Send e-mail
nc



Joined: 20 Jan 2007
Posts: 50

Digg It
PostPosted: Wed Jan 24, 2007 4:06 pm    Post subject:

Haha. Really nice work! I will try this as soon as I get my wiimote! Very Happy
Back to top
View user's profile Send private message
deceased
Site Admin


Joined: 11 Dec 2006
Posts: 287
Location: Aurora, ON

Digg It
PostPosted: Wed Jan 24, 2007 4:42 pm    Post subject:

TylerK wrote:
No, nc is wanting the sound to come from the Wiimote speaker, which isn't possible yet.


I was pretty sure that sound can be made to come out of the Wiimote. If not, then what is the sound in Carl's Laser Skirmish Script coming from? The PC?
_________________
-deceased-

Wiili - a gnu revolution
Back to top
View user's profile Send private message
TiagoTiago



Joined: 20 Jan 2007
Posts: 710
Location: Brasil

Digg It
PostPosted: Wed Jan 24, 2007 4:44 pm    Post subject:

CarlKenner wrote:
Finished!
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.


I wonder if anyone will be brave (dumb?) enough to run around with candles atached to their bodies
Laughing


Last edited by TiagoTiago on Wed Jan 24, 2007 4:53 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
nc



Joined: 20 Jan 2007
Posts: 50

Digg It
PostPosted: Wed Jan 24, 2007 4:52 pm    Post subject:

deceased wrote:
TylerK wrote:
No, nc is wanting the sound to come from the Wiimote speaker, which isn't possible yet.


I was pretty sure that sound can be made to come out of the Wiimote. If not, then what is the sound in Carl's Laser Skirmish Script coming from? The PC?


I've read somewhere on this forum that it is possible. But I don't remember where and I'm a bit to busy to take the energy to look for it again.

Don't know what he's using in this script. I don't have a wiimote so I've never learned this scriptlanguage.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Sensor Bar All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 2 of 7

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group