thagerty
Joined: 01 Feb 2007 Posts: 35
Digg It |
Posted: Sun Feb 11, 2007 2:30 am Post subject: The ULTIMATE Oblivion script with IR mouse! Plays like Zelda |
|
|
Updated to v1.2 to fix some bugs as of Feb 11-07
This will let you play Oblivion kind of like Zelda, or the old normal way if you choose! (Sensor Bar required). No PPJOY needed. Read below for details on how to play.... If anyone has a better working IR mouse, let me know please!
Let me know what you think!
| Code: |
// OBLIVION-THE ULTIMATE SCRIPT-BY TERRY HAGERTY V1.2
//All you need to do to set this up is make sure your Oblivion controls are at their default.
//Also make sure you check your Oblivion.ini file so that your joystick is disabled. (bUse Joystick=0)
/* This script lets you play Oblivion kind of like Zelda, or the old normal way if you choose! (Sensor Bar required)
HOW TO PLAY
The default controls are as follows:
Just walk around forward and backward with the Nunchuk joystick. It will NOT look up or down but it
will turn you left and right. This makes Oblivion very easy to play.
To guard, just hold the Nunchuk upright.
To attack just swing the Wii Remote left/right OR push the "B" button. To do a HEAVY ATTACK Hold Down "C"
and swing the Wii Remote in a direction for that attack.
To cast magic just FLICK the Wii Remote forward or backward (but NOT while holding C or Z), or push A.
Traditional Controls:
If you wish to use more traditional controls, hold down Z. Now your Nunchuk joystick will strafe left and right
instead or looking left/right and move forward/backward. This also enables the Wii Remote to act as your mouse.
So now you will look left/right and up/down with the remote (good for bow and arrow or camera control). This
also lets you move your pointer when needed.
The button layout is as follows:
Normal Ataack/Select.etc = Wiimote.B
Cast = Wiimote.A
Jump = Wiimote.Minus
Enter/Activate = Wiimote.Home
Journal = Wiimote.Plus
Hotkeys
= Wiimote.Up
= Wiimote.Down
= Wiimote.Left
= Wiimote.Right
Ready weapon = Wiimote.One
Sneak = Wiimote.Two
Nunchuck Z = Traditional controls
These buttons only work when holding down Nunchuk "C":
Change view = Wiimote.plus
Scroll view in/out
= Wiimote1.Up
= Wiimote.Down
Wait = wiimote.one
Menu = Wiimote.Home
Have fun...
*/
// Mouse look Left and Right
if wiimote.Nunchuk.ZButton =false and wiimote.Nunchuk.CButton =false then
Mouse.DirectInputX = Mouse.DirectInputX + 20 * DeadZone(Wiimote.Nunchuk.JoyX, 10%)
key.a = false
key.d = false
endif
//Walk forward and backward
key.w = wiimote.Nunchuk.JoyY < -0.5
key.s = wiimote.Nunchuk.JoyY > 0.5
//Buttons that only work with Nunchuk C held Down
if wiimote.Nunchuk.CButton =true then
Mouse.DirectInputX = Mouse.DirectInputX + 20 * DeadZone(Wiimote.Nunchuk.JoyX, 10%)
//Change view
r = Wiimote.plus
//Scroll view in/out
Mouse.WheelUp=Wiimote1.Up
Mouse.WheelDown=Wiimote.Down
//Wait
t=wiimote.one
//Menu
esc = Wiimote.Home
endif
//Cast
c = Wiimote.A
//Jump
e=Wiimote.Minus
//Enter/Activate
space=Wiimote.Home
//Normal Ataack/Select.etc
mouse.leftbutton=Wiimote.B
if wiimote.Nunchuk.CButton =false then
//Journal
tab = Wiimote.Plus
//Hotkeys
key.1 = Wiimote.Up
key.5 = Wiimote.Down
endif
key.7 = Wiimote.Left
key.3 = Wiimote.Right
//Ready weapon
f = Wiimote.One
//Sneak
ctrl = Wiimote.Two
//This varible controlls the ammount of force you need to use when moving the
//wiimote or nunchuk, make it lower if you want to use less force when moving the
//wiimote or nunchuk
var.ForceSensitivity=20
//Assign mouse swing variable
mouse.leftbutton=var.swing
//Normal Swing of Sword
if (Wiimote.RawAccX > var.ForceSensitivity or Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =false then
var.swing=true
wait 50ms
var.swing=false
endif
//Cast magic
if (Wiimote.RawAccy < -15, Wiimote.RawAccy > 15) and wiimote.Nunchuk.CButton =false then
c=true
wait 50ms
c=false
endif
//Raise Nunchuk to raise Shield
key.alt=wiimote.nunchuk.pitch > 50 and wiimote.nunchuk.pitch < 170
// Swing left
if (Wiimote.RawAccX > var.ForceSensitivity, Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a=true
var.swing=true
wait 400ms
var.swing=false
key.a=false
wait 100ms
key.s = wiimote.Nunchuk.JoyY > 0.5
key.w = wiimote.Nunchuk.JoyY < -0.5
endif
// Swing right
if (Wiimote.RawAccX < -var.ForceSensitivity, Wiimote.RawAccX > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.d=true
var.swing=true
wait 400ms
var.swing=false
key.d=false
wait 100ms
key.s = wiimote.Nunchuk.JoyY > 0.5
key.w = wiimote.Nunchuk.JoyY < -0.5
endif
// Swing Back
if (Wiimote.RawAccy > var.ForceSensitivity, Wiimote.RawAccy < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.s=true
var.swing=true
wait 400ms
var.swing=false
key.s=false
wait 100ms
key.s = wiimote.Nunchuk.JoyY > 0.5
key.w = wiimote.Nunchuk.JoyY < -0.5
endif
// Swing Forward
if (Wiimote.RawAccy < -var.ForceSensitivity, Wiimote.RawAccy > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.w=true
var.swing=true
wait 400ms
var.swing=false
key.w=false
wait 100ms
key.s = wiimote.Nunchuk.JoyY > 0.5
key.w = wiimote.Nunchuk.JoyY < -0.5
endif
///////////////////////////////////////////////////////////
/// Second configuration. NORMAL controls for walk,strafe,and aim.
/// Hold down Z button to use.
if wiimote.nunchuk.zbutton=true then
key.w = wiimote.Nunchuk.JoyY < -0.5
key.s = wiimote.Nunchuk.JoyY > 0.5
key.a = wiimote.Nunchuk.JoyX < -0.5
key.d = wiimote.Nunchuk.JoyX > 0.5
//Full mouse aiming and movement START....
// If you have a better IR script, replace the following until you see
// "END OF MOUSE AIMING" at the bottom of this script
//Setup the input (so you can use any analog input with this code
var.InputX = Wiimote1.Dot1X // X component
var.InputXRangeStart = 0 Pixels // Smallest X value possible
var.InputXRangeEnd= 1023 Pixels //Biggest X value possible
var.InputXRangeSiz= (var.InputXRangeEnd- var.InputXRangeStart ) //calculates the size of the avaiable range
var.InputY = Wiimote1.Dot1Y // Y component
var.InputYRangeStart = 0 Pixels // Smallest Y value possible
var.InputYRangeEnd = 767 Pixels //Biggest Y value possible
var.InputYRangeSiz= (var.InputYRangeEnd- var.InputYRangeStart ) //calculates the size of the avaiable range
var.InputEnabled= Wiimote1.Dot1Vis //checks to see if the data is avaiable
// how much of the Y axis us destuned to "Absolute" motion,
// more than this in either direction will go into "Relative" mode
var.RangeX=(var.InputXRangeSiz / 4)
// how much of the Y axis us destuned to "Absolute" motion,
// more than this in either direction will go into "Relative" mode
var.RangeY= (var.InputYRangeSiz / 4)
var.eyesizeX= 300 Mickeys //the size of the "Absolute" X movement in DirectInput units
var.eyesizeY= 225 Mickeys //the size of the "Absolute" y movement in DirectInput units
var.edgespeedX= 30mickeys //Speed of the X axis when in "relative" mode
var.edgespeedY= 20Mickeys //Speed of the Y axis when in "relative" mode
if (var.InputEnabled)then //if the data is avaiable process it
// X offset in relation to the relative position
var.Xloc= -MapRange(var.InputX, var.InputXRangeStart , var.InputXRangeEnd, -var.eyesizeX,var.eyesizeX)mickeys
// Y offset in relation to the relative position
var.Yloc= MapRange(var.InputY, var.InputYRangeStart , var.InputYRangeEnd, -var.eyesizeY,var.eyesizeY)mickeys
//not used anymore, returns the distance from the relative position, I choose to use the distance per axis instead
var.dist =sqrt(sqr((var.InputXRangeSiz/2) - var.InputX)+ sqr((var.InputYRangeSiz/2)- var.InputY))
var.text= ""
//if X is bigger than the Absolute range then process it as relative
if ( sqrt(sqr((var.InputXRangeSiz /2) - var.InputX)) > var.RangeX) then
// change the relative position based on the direction the cursor is
var.MiddleX = var.MiddleX+ (Maprange(var.Xloc, -Var.EyeSizex,var.eyesizex, -var.edgespeedX,var.EdgeSpeedX))
var.text =var.text+"edging X " //adds to the debug thing what it is doing
endif
//if Y is bigger than the Absolute range then process it as relative
if ( sqrt(sqr((var.InputYRangeSiz /2) - var.InputY)) > var.RangeY) then
// change the relative position based on the direction the cursor is
var.MiddleY = var.MiddleY+ (Maprange(var.Yloc, -Var.EyeSizeY,var.eyesizeY, -var.edgespeedY,var.EdgeSpeedY))
var.text= var.text+ "edging Y " //adds to the debug thing what it is doing
endif
//if inside the absolute rnage then do whatever it is required
if ((sqrt(sqr(((var.InputYRangeSiz)/2) - var.InputY)) <= var.RangeY)) OR ( sqrt(sqr((var.InputXRangeSiz/2) - var.InputX)) <= var.RangeX)then
var.Text=var.Text+"local "// not much to be done, only ads to the debug thing what it is doing
endif
debug = var.text+ Mouse.DirectInputPos
//Position the DirectInput cursor based on what it has processed
Mouse.DirectInputPos = [var.MiddleX + var.Xloc, var.MiddleY + var.Yloc]
endif
endif
////END OF MOUSE AIMING//////
|
|
|