From WiiLi
//WIIMOTE COMPLETE SCRIPT FOR STAR WARS BATTLEFRONT II by FATAL GEAR
//Now Supports Classic Controller, Nunchuk, and stand-alone Wiimote.
//Last Updated: 2/17/08
//STAND-ALONE WIIMOTE CONTROLS
//-Before using the script, be sure to reset your controls in the game to the defaults. The buttons are mapped to their default counterparts.
//--If aiming up and down seems reversed, try inverting the Y-Axis on the ingame Control settings.
//---To acknowledge the stand-alone Wiimote as Player 1, press HOME while the LEDs are flashing.
//Tilt Remote: Aim / Navigate Menus (Mouse)
//2 Button :: Primary Fire / Click (Mouse Left Button)
//1 :: Secondary Fire (Mouse Right Button_
//Minus :: Primary Switch (Scroll Down)
//Plus :: Secondary Switch (Scroll Up)
//A :: Jump (Spacebar)
//B :: Zoom (Z)
//Home :: Sprint (Shift)
// CLASSIC CONTROLS
//-Note that all controls are on the Classic Controller, the Wiimote buttons will not function.
//--Before using the script, be sure to reset your controls in the game to the defaults. The buttons are mapped to their default counterparts.
//---Player 1 will be automatically acknowledged by attaching the Classic Controller.
//Left Control Stick :: Move (Up/Down/Left/Right Arrows)
//Right Control Stick :: Aim / Navigate Menus (Mouse)
//R :: Primary Fire / Click (Mouse Left Button)
//L :: Secondary Fire (Mouse Right Button)
//ZR :: Primary Switch (Scroll Down)
//ZL :: Secondary Switch (Scroll Up)
//B :: Jump (Spacebar)
//A :: Enter/Use (E)
//Y :: Sprint (Shift)
//X :: Zoom (Z)
//Plus :: Roll (Alt)
//Minus :: Crouch (C)
//D-pad Down :: Accept (F1)
//Home :: Menu (Escape)
//D-pad Up :: Toggle Ventrilo Push-To-Talk [Must set to F7 in Ventrilo first!] (Optional, useful for Clans)
// NUNCHUK CONTROLS
//-Before using the script, be sure to reset your controls in the game to the defaults. The buttons are mapped to their default counterparts.
//--Player 1 will be automatically acknowledged by attaching the Nunchuk.
//Nunchuk Control Stick :: Move (Up/Down/Left/Right Arrows)
//D-pad :: Aim / Navigate Menus (Mouse)
//B :: Primary Fire / Click (Mouse Left Button)
//C + Nunchuk Motion :: Secondary Fire (Mouse Right Button)
//1 :: Primary Switch (Scroll Down)
//2 :: Secondary Switch (Scroll Up)
//A :: Jump (Spacebar)
//Minus :: Enter/Use (E)
//C + Wiimote Motion :: Sprint (Shift)
//Plus :: Zoom (Z)
//Home :: Roll (Alt)
//C + Plus :: Crouch (C)
if var.debug = false
//Debug Variables for stand-alone Wiimote (will have no effect for other control schemes)
//Change these variables if aspects of the game seem awkward.
var.sensitivity = 10 //Try adjusting if aiming seems too fast or too slow. (10-30) Default: 10
var.aimX = 0.3 //Sensitivity for mouse X axis. Adjust if tilting sideways seems awkward. (0.2-1.0) Default: 0.3
var.aimY = 0.3 //Sensitivity for mouse Y axis. Adjust if tiliting forward/backward seems awkard (0.2-1.0) Default: 0.3
//End of Debug variables
var.debug = true
endif
if var.Classic = true
//CLASSIC CONTROLLER
//Controls the mouse - Can be used safely outside of game, R is Left-click, L is Right-Click
if wiimote.Classic.Joy2X > .1 or < -.1
mouse.DirectInputX = mouse.DirectInputX+(wiimote.Classic.Joy2X*30)
endif
if wiimote.Classic.Joy2Y > .1 or < -.1
mouse.DirectInputY = mouse.DirectInputY+(wiimote.Classic.Joy2Y*30)
endif
//Button Mapping
mouse.LeftButton = wiimote.Classic.RFull
mouse.RightButton = wiimote.Classic.LFull
Keyboard.Left = wiimote.Classic.Joy1X < -.2
Keyboard.Right = wiimote.Classic.Joy1X > .2
Keyboard.Up = wiimote.Classic.Joy1Y < -.2
Keyboard.Down = wiimote.Classic.Joy1Y > .2
Mouse.WheelUp = wiimote.Classic.ZL
Mouse.WheelDown = wiimote.Classic.ZR
Keyboard.Space = wiimote.Classic.B
Keyboard.escape = wiimote.Classic.Home
Keyboard.Shift = wiimote.Classic.Y
Keyboard.C = wiimote.Classic.Minus
Keyboard.Alt = wiimote.Classic.Plus
Keyboard.Z = Wiimote.Classic.X
Keyboard.E = Wiimote.Classic.A
Keyboard.F1 = Wiimote.Classic.Down
toggle(keyboard.F7) = wiimote.Classic.Up
//End of Classic Script
endif
if var.Nunchuk = true
//NUNCHUK
//Controls the mouse - Can be used safely outside of game, B is Left-Click, C + Nunchuk Motion is Right-Click
if wiimote.Right
mouse.DirectInputX = mouse.DirectInputX+15
endif
if wiimote.Down
mouse.DirectInputY = mouse.DirectInputY+15
endif
if wiimote.Left
mouse.DirectInputX = mouse.DirectInputX-15
endif
if wiimote.Up
mouse.DirectInputY = mouse.DirectInputY-15
endif
//Button Mapping
mouse.LeftButton = wiimote.B
mouse.RightButton = pressed(Wiimote.Nunchuk.Cbutton and wiimote.Nunchuk.RelAccZ > 5)
Keyboard.Left = wiimote.Nunchuk.JoyX < -.2
Keyboard.Right = wiimote.Nunchuk.JoyX > .2
Keyboard.Up = wiimote.Nunchuk.JoyY < -.2
Keyboard.Down = wiimote.Nunchuk.JoyY > .2
Mouse.WheelDown = wiimote.1
Mouse.WheelUp = wiimote.2
Keyboard.Space = wiimote.A
Keyboard.Shift = pressed(Wiimote.Nunchuk.Cbutton and wiimote.RelAccZ > 5)
Keyboard.C = (wiimote.nunchuk.Cbutton and Wiimote.Minus)
Keyboard.Alt = wiimote.Home
Keyboard.Z = Wiimote.Plus
Keyboard.E = Wiimote.Minus
//End of Nunchuk Script
endif
if var.wiimote = true
//STAND-ALONE WIIMOTE
//Controls the mouse
if (wiimote.gz > var.aimX or < -var.aimX)
mouse.DirectInputX = mouse.DirectInputX+(wiimote.gz*var.sensitivity)
endif
if (wiimote.gX > var.aimY or < -var.aimY)
mouse.DirectInputY = mouse.DirectInputY+(wiimote.gX*var.sensitivity)
endif
//Button Mapping
mouse.LeftButton = wiimote.2
mouse.RightButton = wiimote.1
Keyboard.Left = wiimote.up
Keyboard.Right = wiimote.down
Keyboard.Up = wiimote.right
Keyboard.Down = wiimote.left
Mouse.WheelDown = wiimote.plus
Mouse.WheelUp = wiimote.minus
Keyboard.Space = wiimote.A
Keyboard.Shift = wiimote.Home
Keyboard.Z = Wiimote.B
//End of stand-alone Wiimote Script
endif
//CONTROLLER RECOGNITION SCRIPT
if pressed(wiimote.Home) and var.wiimote = false and wiimote.classic.exists = false and wiimote.nunchuk.exists = false and wiimote.guitar.exists = false
var.wiimote = true
endif
if wiimote.Classic.exists or wiimote.Nunchuk.exists or var.wiimote = true //Recognizes Attachment and indicates Player 1
wiimote.LEDs = 0001
endif
if wiimote.classic.Exists
var.wiimote = false
var.classic = true
var.nunchuk = false
endif
if wiimote.Nunchuk.Exists
var.wiimote = false
var.Nunchuk = true
var.Classic = false
endif
if wiimote.Classic.exists = false and wiimote.nunchuk.exists = false and wiimote.guitar.exists = false and var.wiimote = false
wiimote.rumble = 0
wiimote.LEDs = 0001 //If no attachment is connected, Wiimote flashes LEDs in a "searching" pattern.
wait(.25) //Press HOME to acknowledge stand-alone Wii Remote.
wiimote.LEDs = 1010
wait(.25)
wiimote.LEDs = 0100
wait(.25)
wiimote.LEDs = 1000
wait(.25)
wiimote.LEDs = 0100
wait(.25)
wiimote.LEDs = 1010
wait(.25)
endif
if wiimote.Guitar.exists = true
wiimote.LEDs = 0000
wiimote.rumble = 0 //Notifies the user if the wrong attachment is connected
wait(1)
wiimote.LEDs = 0111
wiimote.rumble = 1
wait(1)
endif
if var.Nunchuk = true and wiimote.Nunchuk.exists = false and wiimote.Classic.exists = false and wiimote.guitar.exists = false
var.Nunchuk = false
endif
if var.Classic = true and wiimote.Classic.exists = false and wiimote.Nunchuk.exists = false and wiimote.guitar.exists = false
var.Classic = False
endif
if var.Classic = False and var.Nunchuk = False and var.wiimote = false
var.initiate = false
endif