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 

OBLIVION with ZELDA:TP controls! Now supports LOCK ON MOD!
Goto page 1, 2  Next
 
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Scripts
View previous topic :: View next topic  
Author Message
thagerty



Joined: 01 Feb 2007
Posts: 35

Digg It
PostPosted: Fri Feb 16, 2007 3:51 am    Post subject: OBLIVION with ZELDA:TP controls! Now supports LOCK ON MOD!

UPDATED to V2.2 FEB 18-07. Added Hotkeys 6, and 8 to "Flick Nunchuk Left/Right". This is ideal to use the Combat Mod Lock-on with....

This is my newer and even better script for Oblivion. Now you will truly play it more like Zelda: Twilight Princess because it supports the Lock On Mod with the Z mode (for target locking) and the B mode is great for bow and arrow use when needed. ALL game functions are present in this version as well.

I posted this seperately from the other version I made because this one has significantly (and in my opinion) easier and more fun controls to use. Also I give you the choice for yourself this way, though I prefer this one. Most controls are changed so make sure you read below for FULL instructions.

NO PPJOY NEEDED!

Have fun and let me know if this works for anyone else out there!!!



Code:


/* OBLIVION-THE Zelda Twilight Princess Controls Script-BY TERRY HAGERTY   V 2.2   Feb 18.07

 This script lets you play Oblivion just like Zelda: Twilight Princess, or the old normal way if you choose!
(Sensor Bar required for Mouse Look/Aim MODE or Pointer movement) It also has extra easy controls compared to
normal Oblivion, ie. automatic HEAVY ATTACKS.

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)


To play MORE like Zelda I HIGHLY recommend you install and use the Combat Modification 2.0c MOD which
will give you a "TARGET" item. You then bind it to either Hotkey 1,3,5,6,7 or 8, and use it to LOCK ON to your
enemies just like the Z-LOCK targetting in ZELDA:TP or ZELDA:OOT. This will automatically keep you facing
your enemy while strafing which makes Combat controls MUCH easier! To find the Combat Modification 2.0c MOD
goto this link and follow thier instructions for installation and use:

http://planetelderscrolls.gamespy.com/View.php?view=OblivionMods.Detail&id=750

HOW TO PLAY!!!

//////////////
The Normal MODE (LED 1 OFF) controls are as follows:

Just walk around forward and backward and turn left and right with the Nunchuk joystick. It will NOT look
up or down but it will make Oblivion very easy to play. To have FULL mouse LOOK/AIM/Pointer control, HOLD B,
aim at sensor bar, and move with the remote. If you are LOCKED-ON to an enemy in NORMAL mode, you cannot move
left/right, only forward and backward. Toggle to Z MODE (press Z, LED 1 is on) when LOCKED-ON and you can
FULLY move around your enemy.

//////////////
Z MODE or Traditional Controls (Press Z, LED 1 ON):

If you wish to use more traditional controls, press Z. Now your Nunchuk joystick will strafe left and right
instead of looking left/right and it will still move forward/backward. Use this mode when LOCKING ON to an enemy.
Press Z again to toggle back to normal.

//////////////
LOOK/AIM/POINTER Mode (HOLD B)

This MODE 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.
//////////////

To GUARD, just hold the Nunchuk upright.

To ATTACK just swing the Wii Remote left/right OR push the "A" button for arrows. To do a HEAVY ATTACK automatically,
Hold Down "C" and swing the Wii Remote in a direction (up,down,left,right) for that direction's attack.

To CAST magic just FLICK the Wii Remote forward (but NOT while holding C), or HOLD "PLUS".


The BUTTON layout is as follows:

Normal Attack/Select.etc = Wiimote.A
Jump (Press)  or  Cast (Hold) = Wiimote.Plus
Enter/Activate (Press) or  Grab (HOLD) = Wiimote.Minus
Journal = Wiimote.Home
Hotkeys 1,3,5,7
 1 = Wiimote.Up
 5 = Wiimote.Down
 7 = Wiimote.Left
 3 = Wiimote.Right
Ready weapon = Wiimote.One
Sneak = Wiimote.Two
Nunchuk Z = Change Modes (Normal Mode / Z Mode (Traditional controls)) LED 1 on = Z mode
Hotkeys 6, 8 (Your object must be assigned to Hotkey 6 or 8 using the keyboard)
  Flick Nunchuk to your left for Hotkey 8
  Flick Nunchuk to your right for Hotkey 6 (I recommend putting your Target Ring from the Combat Mod here)

Hold down "B" on remote for FULL Mouse Look/Aim/Pointer  MODE.

These buttons only work when holding down Nunchuk "C":

Change view = Wiimote.home
Scroll view in/out
  = Wiimote.Up
  = Wiimote.Down
Quick Save = Wiimote.left
Quick Load = Wiimote.right
Wait = Wiimote.one
Menu = Wiimote.two



Have fun...

*/



// Normal Mode - Mouse look Left and Right only with Nunchuk-Stick

if var.lock=0 then
Mouse.DirectInputX = Mouse.DirectInputX + 20 * DeadZone(Wiimote.Nunchuk.JoyX, 10%)
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
//Walk forward and backward
key.w = wiimote.Nunchuk.JoyY < -0.5
key.s = wiimote.Nunchuk.JoyY > 0.5
//Swing Right
if (Wiimote.RawAccX < -var.ForceSensitivity, Wiimote.RawAccX > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingright=1
var.lock=4
endif
//Swing Left
if (Wiimote.RawAccX > var.ForceSensitivity, Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingleft=1
var.lock=4
endif
//Swing Back
if (Wiimote.RawAccy > var.ForceSensitivity, Wiimote.RawAccy < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingback=1
var.lock=4
endif
// Swing Forward
if (Wiimote.RawAccy < -var.ForceSensitivity, Wiimote.RawAccy > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingforward=1
var.lock=4
endif

endif



//Buttons that only work with Nunchuk C held Down
if wiimote.Nunchuk.CButton =true then
//Change view
r = Wiimote.Home
//Scroll view in/out
Mouse.WheelUp=Wiimote1.Up
Mouse.WheelDown=Wiimote.Down
//Wait
t=wiimote.one
//Menu
esc = Wiimote.two
// Quick Save
key.f5 = Wiimote.Left
// Quick Load
key.f9 = Wiimote.Right
endif



// Normal buttons

if wiimote.Nunchuk.CButton =false then
//Sneak
ctrl = Wiimote.Two
//Journal
tab = Wiimote.Home
//Ready weapon
f = Wiimote.One
//Hotkeys 1,3,5,7
key.1 = Wiimote.Up
key.5 = Wiimote.Down
key.7 = Wiimote.Left
key.3 = Wiimote.Right
endif

//Buttons that work in all modes

// Attack/Select
mouse.leftbutton=wiimote.a

 //Jump (Press Minus) &  Cast (Hold Minus)
var.old = var.jnew
var.new = HeldDown(Wiimote.plus, 250 ms)
key.e = Released(Wiimote.plus) && !var.jold
key.c = HeldDown(Wiimote.plus, 300 ms)

// Enter/Activate (Press Minus) & Grab (Hold Minus)
var.jold = var.jnew
var.jnew = HeldDown(Wiimote.minus, 250 ms)
key.space = Released(Wiimote.minus) && !var.jold
key.z = HeldDown(Wiimote.minus, 300 ms)

//Nunchuck hotkeys
//Hotkey 8  Flick Nunchuk to your left
key.8 = (Wiimote.Nunchuk.RawAccX < -var.ForceSensitivity, Wiimote.Nunchuk.RawAccX > var.ForceSensitivity)
//Hotkey 6  Flick Nunchuk to your right
key.6 = (Wiimote.Nunchuk.RawAccX > var.ForceSensitivity, Wiimote.Nunchuk.RawAccX < -var.ForceSensitivity)


//This varible controls the amount 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/attack variable
mouse.leftbutton=var.swing


//Normal Swing of Sword
if (Wiimote.RawAccX > var.ForceSensitivity or Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =false and wiimote.Nunchuk.zButton =false then
var.swing=true
wait 50ms
var.swing=false
endif

//Cast magic
if (Wiimote.RawAccy < -10, Wiimote.RawAccy > 10) 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 var.swingleft=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.a=true
var.swing=true
wait 400ms
var.swing=false
key.a=false
wait 100ms
var.lock=0
var.swingleft=0
endif

// Swing left Z
if var.zswingleft=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.a=true
var.swing=true
wait 400ms
var.swing=false
key.a=false
wait 100ms
var.lock=1
var.zswingleft=0
endif


// Swing right
if var.swingright=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.d=true
var.swing=true
wait 400ms
var.swing=false
key.d=false
wait 100ms
var.lock=0
var.swingright=0
endif

// Swing right Z
if var.zswingright=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.d=true
var.swing=true
wait 400ms
var.swing=false
key.d=false
wait 100ms
var.lock=1
var.zswingright=0
endif

// Swing Back
if var.swingback=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.s=true
var.swing=true
wait 400ms
var.swing=false
key.s=false
wait 100ms
var.swingback=0
var.lock=0
endif

// Swing Back Z
if var.zswingback=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.s=true
var.swing=true
wait 400ms
var.swing=false
key.s=false
wait 100ms
var.zswingback=0
var.lock=1
endif


// Swing Forward
if var.swingforward=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.w=true
var.swing=true
wait 400ms
var.swing=false
key.w=false
wait 100ms
var.swingforward=0
var.lock=0
endif

// Swing Forward Z
if var.zswingforward=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.w=true
var.swing=true
wait 400ms
var.swing=false
key.w=false
wait 100ms
var.zswingforward=0
var.lock=1
endif


///////////////////////////////////////////////////////////


//Z Lock Mode - Press Z button - Still needs you to manually lock and unlock yourself

if released(wiimote.nunchuk.zbutton) then
var.lock=var.lock +1
if var.lock >1 and <3 then
var.lock=0
endif
endif
//LED 1 on to show Z mode active
if var.lock >=1 then
Wiimote.Led1 = TRUE
else  Wiimote.Led1 = FALSE
endif

//Z Lock Mode Active
if var.lock=1 then
key.s = wiimote.Nunchuk.JoyY > 0.5
key.w = wiimote.Nunchuk.JoyY < -0.5
key.a = wiimote.Nunchuk.JoyX < -0.5
key.d = wiimote.Nunchuk.JoyX > 0.5

//Swing Right Z
if (Wiimote.RawAccX < -var.ForceSensitivity, Wiimote.RawAccX > var.ForceSensitivity)and wiimote.Nunchuk.CButton =true then
var.zswingright=1
var.lock=4
endif
//Swing Left Z
if (Wiimote.RawAccX > var.ForceSensitivity, Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.zswingleft=1
var.lock=4
endif
//Swing Back Z
if (Wiimote.RawAccy > var.ForceSensitivity, Wiimote.RawAccy < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.zswingback=1
var.lock=4
endif
// Swing Forward Z
if (Wiimote.RawAccy < -var.ForceSensitivity, Wiimote.RawAccy > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.zswingforward=1
var.lock=4
endif

endif



// Only needed if Pinnacle Profiler does FULL mouse LOOK/AIM
ppjoy.digital1 = wiimote.B


// Hold B for full aim and movement

if wiimote.b 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 START....
//
//If you have a BETTER IR mouse SCRIPT, replace everything below until you see
// "FULL MOUSE AIMING ENDS...." at the bottom of the 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

//FULL MOUSE AIMING ENDS....



Last edited by thagerty on Sun Feb 18, 2007 6:55 pm; edited 3 times in total
Back to top
View user's profile Send private message
U.C. 1973



Joined: 16 Feb 2007
Posts: 1

Digg It
PostPosted: Fri Feb 16, 2007 3:25 pm    Post subject:

hi,i'm italian...sorry my bad english....you can do a script of oblivion without a sensor bar for me???when i run script for me don't work...
or i have a sensor bar(wii)....i can use it with pc?can do me a tutorial???help i wold play your work.....thanks
Back to top
View user's profile Send private message
dobby245



Joined: 16 Feb 2007
Posts: 2

Digg It
PostPosted: Fri Feb 16, 2007 7:36 pm    Post subject:

Make sure that you have connected your remote to your computer with a bluetooth adapter before you do anything first. Yes you can use your wii sensor bar, once you have connected your remote simply turn on your wii and place the sensor bar on top of your screen. Run the script with glovepie and it should all work.
Back to top
View user's profile Send private message
synbios1978



Joined: 27 Feb 2007
Posts: 2

Digg It
PostPosted: Tue Feb 27, 2007 3:56 am    Post subject: great script so far, just need a little help....

I wanted to let you know this is a great script so far, but I'm running into one issue that is killing me. I just bought a new sensor bar online. I know it's working fine b/c I tested it with my Wii and it worked the same as the Wii sensor bar, however when playing Oblivion the mouse control is awful. It loses track of the mouse half the time, will wonder off on it's own, and won't make it across the screen without considerable help. I saw an option in the code for use with Pinnacle, and I was wondering what that was all about, b/c I have Pinnacle on my computer, and I have the rest of the mod working, I think...haven't fully tested yet, but without good mouse control it's almost unplayable. Any help would be greatly appreciated!!

Edit: I downloaded the WiiMouse IR from LiquidIce's Nintendo Wii Hacks page (I can't past URL's yet or else I would), however I pasted the code that was copied/pasted with yours and it works great while I'm in Windows (after copying/pasteing the applicable parts into your script, however once I load Oblivion, all movement stops. Here is the code that I am trying to use:

/* OBLIVION-THE Zelda Twilight Princess Controls Script-BY TERRY HAGERTY V 2.2 Feb 18.07

This script lets you play Oblivion just like Zelda: Twilight Princess, or the old normal way if you choose!
(Sensor Bar required for Mouse Look/Aim MODE or Pointer movement) It also has extra easy controls compared to
normal Oblivion, ie. automatic HEAVY ATTACKS.

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)


To play MORE like Zelda I HIGHLY recommend you install and use the Combat Modification 2.0c MOD which
will give you a "TARGET" item. You then bind it to either Hotkey 1,3,5,6,7 or 8, and use it to LOCK ON to your
enemies just like the Z-LOCK targetting in ZELDA:TP or ZELDA:OOT. This will automatically keep you facing
your enemy while strafing which makes Combat controls MUCH easier! To find the Combat Modification 2.0c MOD
goto this link and follow thier instructions for installation and use:



HOW TO PLAY!!!

//////////////
The Normal MODE (LED 1 OFF) controls are as follows:

Just walk around forward and backward and turn left and right with the Nunchuk joystick. It will NOT look
up or down but it will make Oblivion very easy to play. To have FULL mouse LOOK/AIM/Pointer control, HOLD B,
aim at sensor bar, and move with the remote. If you are LOCKED-ON to an enemy in NORMAL mode, you cannot move
left/right, only forward and backward. Toggle to Z MODE (press Z, LED 1 is on) when LOCKED-ON and you can
FULLY move around your enemy.

//////////////
Z MODE or Traditional Controls (Press Z, LED 1 ON):

If you wish to use more traditional controls, press Z. Now your Nunchuk joystick will strafe left and right
instead of looking left/right and it will still move forward/backward. Use this mode when LOCKING ON to an enemy.
Press Z again to toggle back to normal.

//////////////
LOOK/AIM/POINTER Mode (HOLD B)

This MODE 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.
//////////////

To GUARD, just hold the Nunchuk upright.

To ATTACK just swing the Wii Remote left/right OR push the "A" button for arrows. To do a HEAVY ATTACK automatically,
Hold Down "C" and swing the Wii Remote in a direction (up,down,left,right) for that direction's attack.

To CAST magic just FLICK the Wii Remote forward (but NOT while holding C), or HOLD "PLUS".


The BUTTON layout is as follows:

Normal Attack/Select.etc = Wiimote.A
Jump (Press) or Cast (Hold) = Wiimote.Plus
Enter/Activate (Press) or Grab (HOLD) = Wiimote.Minus
Journal = Wiimote.Home
Hotkeys 1,3,5,7
1 = Wiimote.Up
5 = Wiimote.Down
7 = Wiimote.Left
3 = Wiimote.Right
Ready weapon = Wiimote.One
Sneak = Wiimote.Two
Nunchuk Z = Change Modes (Normal Mode / Z Mode (Traditional controls)) LED 1 on = Z mode
Hotkeys 6, 8 (Your object must be assigned to Hotkey 6 or 8 using the keyboard)
Flick Nunchuk to your left for Hotkey 8
Flick Nunchuk to your right for Hotkey 6 (I recommend putting your Target Ring from the Combat Mod here)

Hold down "B" on remote for FULL Mouse Look/Aim/Pointer MODE.

These buttons only work when holding down Nunchuk "C":

Change view = Wiimote.home
Scroll view in/out
= Wiimote.Up
= Wiimote.Down
Quick Save = Wiimote.left
Quick Load = Wiimote.right
Wait = Wiimote.one
Menu = Wiimote.two



Have fun...

*/



// Normal Mode - Mouse look Left and Right only with Nunchuk-Stick

if var.lock=0 then
Mouse.DirectInputX = Mouse.DirectInputX + 20 * DeadZone(Wiimote.Nunchuk.JoyX, 10%)
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
//Walk forward and backward
key.w = wiimote.Nunchuk.JoyY < -0.5
key.s = wiimote.Nunchuk.JoyY > 0.5
//Swing Right
if (Wiimote.RawAccX < -var.ForceSensitivity, Wiimote.RawAccX > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingright=1
var.lock=4
endif
//Swing Left
if (Wiimote.RawAccX > var.ForceSensitivity, Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingleft=1
var.lock=4
endif
//Swing Back
if (Wiimote.RawAccy > var.ForceSensitivity, Wiimote.RawAccy < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingback=1
var.lock=4
endif
// Swing Forward
if (Wiimote.RawAccy < -var.ForceSensitivity, Wiimote.RawAccy > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingforward=1
var.lock=4
endif

endif



//Buttons that only work with Nunchuk C held Down
if wiimote.Nunchuk.CButton =true then
//Change view
r = Wiimote.Home
//Scroll view in/out
Mouse.WheelUp=Wiimote1.Up
Mouse.WheelDown=Wiimote.Down
//Wait
t=wiimote.one
//Menu
esc = Wiimote.two
// Quick Save
key.f5 = Wiimote.Left
// Quick Load
key.f9 = Wiimote.Right
endif



// Normal buttons

if wiimote.Nunchuk.CButton =false then
//Sneak
ctrl = Wiimote.Two
//Journal
tab = Wiimote.Home
//Ready weapon
f = Wiimote.One
//Hotkeys 1,3,5,7
key.1 = Wiimote.Up
key.5 = Wiimote.Down
key.7 = Wiimote.Left
key.3 = Wiimote.Right
endif

//Buttons that work in all modes

// Attack/Select
mouse.leftbutton=wiimote.a

//Jump (Press Minus) & Cast (Hold Minus)
var.old = var.jnew
var.new = HeldDown(Wiimote.plus, 250 ms)
key.e = Released(Wiimote.plus) && !var.jold
key.c = HeldDown(Wiimote.plus, 300 ms)

// Enter/Activate (Press Minus) & Grab (Hold Minus)
var.jold = var.jnew
var.jnew = HeldDown(Wiimote.minus, 250 ms)
key.space = Released(Wiimote.minus) && !var.jold
key.z = HeldDown(Wiimote.minus, 300 ms)

//Nunchuck hotkeys
//Hotkey 8 Flick Nunchuk to your left
key.8 = (Wiimote.Nunchuk.RawAccX < -var.ForceSensitivity, Wiimote.Nunchuk.RawAccX > var.ForceSensitivity)
//Hotkey 6 Flick Nunchuk to your right
key.6 = (Wiimote.Nunchuk.RawAccX > var.ForceSensitivity, Wiimote.Nunchuk.RawAccX < -var.ForceSensitivity)


//This varible controls the amount 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/attack variable
mouse.leftbutton=var.swing


//Normal Swing of Sword
if (Wiimote.RawAccX > var.ForceSensitivity or Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =false and wiimote.Nunchuk.zButton =false then
var.swing=true
wait 50ms
var.swing=false
endif

//Cast magic
if (Wiimote.RawAccy < -10, Wiimote.RawAccy > 10) 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 var.swingleft=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.a=true
var.swing=true
wait 400ms
var.swing=false
key.a=false
wait 100ms
var.lock=0
var.swingleft=0
endif

// Swing left Z
if var.zswingleft=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.a=true
var.swing=true
wait 400ms
var.swing=false
key.a=false
wait 100ms
var.lock=1
var.zswingleft=0
endif


// Swing right
if var.swingright=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.d=true
var.swing=true
wait 400ms
var.swing=false
key.d=false
wait 100ms
var.lock=0
var.swingright=0
endif

// Swing right Z
if var.zswingright=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.d=true
var.swing=true
wait 400ms
var.swing=false
key.d=false
wait 100ms
var.lock=1
var.zswingright=0
endif

// Swing Back
if var.swingback=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.s=true
var.swing=true
wait 400ms
var.swing=false
key.s=false
wait 100ms
var.swingback=0
var.lock=0
endif

// Swing Back Z
if var.zswingback=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.s=true
var.swing=true
wait 400ms
var.swing=false
key.s=false
wait 100ms
var.zswingback=0
var.lock=1
endif


// Swing Forward
if var.swingforward=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.w=true
var.swing=true
wait 400ms
var.swing=false
key.w=false
wait 100ms
var.swingforward=0
var.lock=0
endif

// Swing Forward Z
if var.zswingforward=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.w=true
var.swing=true
wait 400ms
var.swing=false
key.w=false
wait 100ms
var.zswingforward=0
var.lock=1
endif


///////////////////////////////////////////////////////////


//Z Lock Mode - Press Z button - Still needs you to manually lock and unlock yourself

if released(wiimote.nunchuk.zbutton) then
var.lock=var.lock +1
if var.lock >1 and <3 then
var.lock=0
endif
endif
//LED 1 on to show Z mode active
if var.lock >=1 then
Wiimote.Led1 = TRUE
else Wiimote.Led1 = FALSE
endif

//Z Lock Mode Active
if var.lock=1 then
key.s = wiimote.Nunchuk.JoyY > 0.5
key.w = wiimote.Nunchuk.JoyY < -0.5
key.a = wiimote.Nunchuk.JoyX < -0.5
key.d = wiimote.Nunchuk.JoyX > 0.5

//Swing Right Z
if (Wiimote.RawAccX < -var.ForceSensitivity, Wiimote.RawAccX > var.ForceSensitivity)and wiimote.Nunchuk.CButton =true then
var.zswingright=1
var.lock=4
endif
//Swing Left Z
if (Wiimote.RawAccX > var.ForceSensitivity, Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.zswingleft=1
var.lock=4
endif
//Swing Back Z
if (Wiimote.RawAccy > var.ForceSensitivity, Wiimote.RawAccy < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.zswingback=1
var.lock=4
endif
// Swing Forward Z
if (Wiimote.RawAccy < -var.ForceSensitivity, Wiimote.RawAccy > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.zswingforward=1
var.lock=4
endif

endif



// Only needed if Pinnacle Profiler does FULL mouse LOOK/AIM
ppjoy.digital1 = wiimote.B


// Hold B for full aim and movement

if wiimote.b 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 START....
//
//If you have a BETTER IR mouse SCRIPT, replace everything below until you see
// "FULL MOUSE AIMING ENDS...." at the bottom of the script.




//Mouse Control Script using IR
//by vkapadia with much assistance from inio
//
//Calibration:
//To calibrate, run this program and put the Wiimote on a flat surface face-up.
//Then read the values in the debug line (next to the run button).
//Change these values until the debug line reads approx. all zeros.
var.xtrim = 6
var.ytrim = -31
var.ztrim = 6
//
//Options:
var.deadzone = 5 //distance in pixels that you have to move the wiimote in
//order for it to register movement. Creates a "dead zone" around the pointer
//to make it easier to click. Higher = smoother but less accurate.

//Controls:
//Point Wiimote = Move Mouse
//D-Pad = Arrow Keys
//B-Button = Left Click
//Home = Middle Click
//A-Button = Right Click
//Plus and Minus = Control Volume
//One = Unmapped
//Two = Unmapped
//
//If the pointer hits the edge of the screen, the Wiimote will rumble a bit.
//
//The LEDs attempt to emulate KITT's grill from Knight Rider

//***Do not edit anything below this line unless you know what you are doing.***

var.accx = wiimote.RawForceX + var.xtrim
var.accy = wiimote.RawForceY + var.ytrim
var.accz = wiimote.RawForceZ + var.ztrim

if wiimote.dot1vis and wiimote.dot2vis then

if var.accy > -7 then
var.orientation = 0
elseif var.accy > -45 then
if var.accx < 0 then
var.orientation = 3
else
var.orientation = 1
endif
else
var.orientation = 2
endif

if var.leftpoint = 0 then
if var.orientation = 0 then
if wiimote.dot1x < wiimote.dot2x then
var.leftpoint = 1
else
var.leftpoint = 2
endif
endif
if var.orientation = 1 then
if wiimote.dot1y > wiimote.dot2y then
var.leftpoint = 1
else
var.leftpoint = 2
endif
endif
if var.orientation = 2 then
if wiimote.dot1x > wiimote.dot2x then
var.leftpoint = 1
else
var.leftpoint = 2
endif
endif
if var.orientation = 3 then
if wiimote.dot1y < wiimote.dot2y then
var.leftpoint = 1
else
var.leftpoint = 2
endif
endif
endif

if var.leftpoint = 1 then
var.fix1x = wiimote.dot1x
var.fix1y = wiimote.dot1y
var.fix2x = wiimote.dot2x
var.fix2y = wiimote.dot2y
else
var.fix1x = wiimote.dot2x
var.fix1y = wiimote.dot2y
var.fix2x = wiimote.dot1x
var.fix2y = wiimote.dot1y
endif

var.dx = var.fix2x - var.fix1x
var.dy = var.fix2y - var.fix1y
var.cx = (var.fix1x+var.fix2x)/1024.0 - 1
var.cy = (var.fix1y+var.fix2y)/1024.0 - .75

var.d = sqrt(var.dx*var.dx+var.dy*var.dy)

var.dx = var.dx / var.d
var.dy = var.dy / var.d

var.ox = -var.dy*var.cy-var.dx*var.cx;
var.oy = -var.dx*var.cy+var.dy*var.cx;

var.ax = (var.ox * screen.desktopwidth) + (screen.desktopwidth / 2)
var.ay = (-var.oy * screen.desktopwidth) + (screen.desktopheight / 2)




var.dx = var.ax - mouse.cursorposx
var.dy = var.ay - mouse.cursorposy

var.d = sqrt((var.dx*var.dx)+(var.dy*var.dy))

var.a = 180 / (200 + var.d * var.d * var.d * .001)

if var.d <= var.deadzone then var.a = 1

debug = var.d + " " + var.a

var.finalx = mouse.cursorposx * var.a + var.ax * (1 - var.a)
var.finaly = mouse.cursorposy * var.a + var.ay * (1 - var.a)


mouse.cursorposx = var.finalx
mouse.cursorposy = var.finaly

else

var.leftpoint = 0

endif

//debug = var.accx + " " + var.accy + " " + var.accz

endif







******END CODE*******

If there is any help you can give me I would greatly appreciate it, because this is looking more and more cool by the minute, but I just need a good mouse script and I would be set.

Thanks again!!!!

-Synbios1978
Back to top
View user's profile Send private message
synbios1978



Joined: 27 Feb 2007
Posts: 2

Digg It
PostPosted: Tue Feb 27, 2007 5:26 am    Post subject: One other sample code

I apologize for double-posting, but I think I was getting close to reaching post character limit. I also tried one other mouse script at the end, and it works great in Windows when combined with your script, however once I start Oblivion the mouse pointer goes the speed of light. Other than that it works great. Here's the code for the other option:

/* OBLIVION-THE Zelda Twilight Princess Controls Script-BY TERRY HAGERTY V 2.2 Feb 18.07

This script lets you play Oblivion just like Zelda: Twilight Princess, or the old normal way if you choose!
(Sensor Bar required for Mouse Look/Aim MODE or Pointer movement) It also has extra easy controls compared to
normal Oblivion, ie. automatic HEAVY ATTACKS.

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)


To play MORE like Zelda I HIGHLY recommend you install and use the Combat Modification 2.0c MOD which
will give you a "TARGET" item. You then bind it to either Hotkey 1,3,5,6,7 or 8, and use it to LOCK ON to your
enemies just like the Z-LOCK targetting in ZELDA:TP or ZELDA:OOT. This will automatically keep you facing
your enemy while strafing which makes Combat controls MUCH easier! To find the Combat Modification 2.0c MOD
goto this link and follow thier instructions for installation and use:

HOW TO PLAY!!!

//////////////
The Normal MODE (LED 1 OFF) controls are as follows:

Just walk around forward and backward and turn left and right with the Nunchuk joystick. It will NOT look
up or down but it will make Oblivion very easy to play. To have FULL mouse LOOK/AIM/Pointer control, HOLD B,
aim at sensor bar, and move with the remote. If you are LOCKED-ON to an enemy in NORMAL mode, you cannot move
left/right, only forward and backward. Toggle to Z MODE (press Z, LED 1 is on) when LOCKED-ON and you can
FULLY move around your enemy.

//////////////
Z MODE or Traditional Controls (Press Z, LED 1 ON):

If you wish to use more traditional controls, press Z. Now your Nunchuk joystick will strafe left and right
instead of looking left/right and it will still move forward/backward. Use this mode when LOCKING ON to an enemy.
Press Z again to toggle back to normal.

//////////////
LOOK/AIM/POINTER Mode (HOLD B)

This MODE 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.
//////////////

To GUARD, just hold the Nunchuk upright.

To ATTACK just swing the Wii Remote left/right OR push the "A" button for arrows. To do a HEAVY ATTACK automatically,
Hold Down "C" and swing the Wii Remote in a direction (up,down,left,right) for that direction's attack.

To CAST magic just FLICK the Wii Remote forward (but NOT while holding C), or HOLD "PLUS".


The BUTTON layout is as follows:

Normal Attack/Select.etc = Wiimote.A
Jump (Press) or Cast (Hold) = Wiimote.Plus
Enter/Activate (Press) or Grab (HOLD) = Wiimote.Minus
Journal = Wiimote.Home
Hotkeys 1,3,5,7
1 = Wiimote.Up
5 = Wiimote.Down
7 = Wiimote.Left
3 = Wiimote.Right
Ready weapon = Wiimote.One
Sneak = Wiimote.Two
Nunchuk Z = Change Modes (Normal Mode / Z Mode (Traditional controls)) LED 1 on = Z mode
Hotkeys 6, 8 (Your object must be assigned to Hotkey 6 or 8 using the keyboard)
Flick Nunchuk to your left for Hotkey 8
Flick Nunchuk to your right for Hotkey 6 (I recommend putting your Target Ring from the Combat Mod here)

Hold down "B" on remote for FULL Mouse Look/Aim/Pointer MODE.

These buttons only work when holding down Nunchuk "C":

Change view = Wiimote.home
Scroll view in/out
= Wiimote.Up
= Wiimote.Down
Quick Save = Wiimote.left
Quick Load = Wiimote.right
Wait = Wiimote.one
Menu = Wiimote.two



Have fun...

*/



// Normal Mode - Mouse look Left and Right only with Nunchuk-Stick

if var.lock=0 then
Mouse.DirectInputX = Mouse.DirectInputX + 20 * DeadZone(Wiimote.Nunchuk.JoyX, 10%)
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
//Walk forward and backward
key.w = wiimote.Nunchuk.JoyY < -0.5
key.s = wiimote.Nunchuk.JoyY > 0.5
//Swing Right
if (Wiimote.RawAccX < -var.ForceSensitivity, Wiimote.RawAccX > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingright=1
var.lock=4
endif
//Swing Left
if (Wiimote.RawAccX > var.ForceSensitivity, Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingleft=1
var.lock=4
endif
//Swing Back
if (Wiimote.RawAccy > var.ForceSensitivity, Wiimote.RawAccy < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingback=1
var.lock=4
endif
// Swing Forward
if (Wiimote.RawAccy < -var.ForceSensitivity, Wiimote.RawAccy > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingforward=1
var.lock=4
endif

endif



//Buttons that only work with Nunchuk C held Down
if wiimote.Nunchuk.CButton =true then
//Change view
r = Wiimote.Home
//Scroll view in/out
Mouse.WheelUp=Wiimote1.Up
Mouse.WheelDown=Wiimote.Down
//Wait
t=wiimote.one
//Menu
esc = Wiimote.two
// Quick Save
key.f5 = Wiimote.Left
// Quick Load
key.f9 = Wiimote.Right
endif



// Normal buttons

if wiimote.Nunchuk.CButton =false then
//Sneak
ctrl = Wiimote.Two
//Journal
tab = Wiimote.Home
//Ready weapon
f = Wiimote.One
//Hotkeys 1,3,5,7
key.1 = Wiimote.Up
key.5 = Wiimote.Down
key.7 = Wiimote.Left
key.3 = Wiimote.Right
endif

//Buttons that work in all modes

// Attack/Select
mouse.leftbutton=wiimote.a

//Jump (Press Minus) & Cast (Hold Minus)
var.old = var.jnew
var.new = HeldDown(Wiimote.plus, 250 ms)
key.e = Released(Wiimote.plus) && !var.jold
key.c = HeldDown(Wiimote.plus, 300 ms)

// Enter/Activate (Press Minus) & Grab (Hold Minus)
var.jold = var.jnew
var.jnew = HeldDown(Wiimote.minus, 250 ms)
key.space = Released(Wiimote.minus) && !var.jold
key.z = HeldDown(Wiimote.minus, 300 ms)

//Nunchuck hotkeys
//Hotkey 8 Flick Nunchuk to your left
key.8 = (Wiimote.Nunchuk.RawAccX < -var.ForceSensitivity, Wiimote.Nunchuk.RawAccX > var.ForceSensitivity)
//Hotkey 6 Flick Nunchuk to your right
key.6 = (Wiimote.Nunchuk.RawAccX > var.ForceSensitivity, Wiimote.Nunchuk.RawAccX < -var.ForceSensitivity)


//This varible controls the amount 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/attack variable
mouse.leftbutton=var.swing


//Normal Swing of Sword
if (Wiimote.RawAccX > var.ForceSensitivity or Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =false and wiimote.Nunchuk.zButton =false then
var.swing=true
wait 50ms
var.swing=false
endif

//Cast magic
if (Wiimote.RawAccy < -10, Wiimote.RawAccy > 10) 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 var.swingleft=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.a=true
var.swing=true
wait 400ms
var.swing=false
key.a=false
wait 100ms
var.lock=0
var.swingleft=0
endif

// Swing left Z
if var.zswingleft=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.a=true
var.swing=true
wait 400ms
var.swing=false
key.a=false
wait 100ms
var.lock=1
var.zswingleft=0
endif


// Swing right
if var.swingright=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.d=true
var.swing=true
wait 400ms
var.swing=false
key.d=false
wait 100ms
var.lock=0
var.swingright=0
endif

// Swing right Z
if var.zswingright=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.d=true
var.swing=true
wait 400ms
var.swing=false
key.d=false
wait 100ms
var.lock=1
var.zswingright=0
endif

// Swing Back
if var.swingback=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.s=true
var.swing=true
wait 400ms
var.swing=false
key.s=false
wait 100ms
var.swingback=0
var.lock=0
endif

// Swing Back Z
if var.zswingback=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.s=true
var.swing=true
wait 400ms
var.swing=false
key.s=false
wait 100ms
var.zswingback=0
var.lock=1
endif


// Swing Forward
if var.swingforward=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.w=true
var.swing=true
wait 400ms
var.swing=false
key.w=false
wait 100ms
var.swingforward=0
var.lock=0
endif

// Swing Forward Z
if var.zswingforward=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.w=true
var.swing=true
wait 400ms
var.swing=false
key.w=false
wait 100ms
var.zswingforward=0
var.lock=1
endif


///////////////////////////////////////////////////////////


//Z Lock Mode - Press Z button - Still needs you to manually lock and unlock yourself

if released(wiimote.nunchuk.zbutton) then
var.lock=var.lock +1
if var.lock >1 and <3 then
var.lock=0
endif
endif
//LED 1 on to show Z mode active
if var.lock >=1 then
Wiimote.Led1 = TRUE
else Wiimote.Led1 = FALSE
endif

//Z Lock Mode Active
if var.lock=1 then
key.s = wiimote.Nunchuk.JoyY > 0.5
key.w = wiimote.Nunchuk.JoyY < -0.5
key.a = wiimote.Nunchuk.JoyX < -0.5
key.d = wiimote.Nunchuk.JoyX > 0.5

//Swing Right Z
if (Wiimote.RawAccX < -var.ForceSensitivity, Wiimote.RawAccX > var.ForceSensitivity)and wiimote.Nunchuk.CButton =true then
var.zswingright=1
var.lock=4
endif
//Swing Left Z
if (Wiimote.RawAccX > var.ForceSensitivity, Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.zswingleft=1
var.lock=4
endif
//Swing Back Z
if (Wiimote.RawAccy > var.ForceSensitivity, Wiimote.RawAccy < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.zswingback=1
var.lock=4
endif
// Swing Forward Z
if (Wiimote.RawAccy < -var.ForceSensitivity, Wiimote.RawAccy > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.zswingforward=1
var.lock=4
endif

endif



// Only needed if Pinnacle Profiler does FULL mouse LOOK/AIM
ppjoy.digital1 = wiimote.B


// Hold B for full aim and movement

if wiimote.b 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 START....
//
//If you have a BETTER IR mouse SCRIPT, replace everything below until you see
// "FULL MOUSE AIMING ENDS...." at the bottom of the script.




// My best IR Mouse Script, with 5DOF Tracking
// By Carl Kenner

// Change these values:
var.SensorBarSeparation = 7.5 inches // distance between middles of two sensor bar dots
var.NoYawAllowed = true // Calculates X if no yaw is allowed, otherwise calculates Yaw but not X
var.IRMulX = 1.2
var.IRMulY = 1.2
var.IROffsetX = 0 // add to mouse.x
var.IROffsetY = 0 // add to mouse.y
//var.IRLeftButton = Wiimote.A
//var.IRRightButton = Wiimote.B


// Compensate for roll
var.c = cos(Smooth(wiimote.roll, 10))
var.s = sin(Smooth(wiimote.roll, 10))
if wiimote.dot1vis then
var.dot1x = var.c*(511.5-wiimote.dot1x)/511.5 - var.s*(wiimote.dot1y-383.5)/511.5
var.dot1y = var.s*(511.5-wiimote.dot1x)/511.5 + var.c*(wiimote.dot1y-383.5)/511.5
end if
if wiimote.dot2vis then
var.dot2x = var.c*(511.5-wiimote.dot2x)/511.5 - var.s*(wiimote.dot2y-383.5)/511.5
var.dot2y = var.s*(511.5-wiimote.dot2x)/511.5 + var.c*(wiimote.dot2y-383.5)/511.5
end if

// if both dots are visible check which is which and how far apart
if wiimote.dot1vis and wiimote.dot2vis then
if var.dot1x <= var.dot2x then
var.leftdot = 1
var.dotdeltay = var.dot2y - var.dot1y
else
var.leftdot = 2
var.dotdeltay = var.dot1y - var.dot2y
end if
var.dotdeltax = abs(var.dot1x-var.dot2x)
var.DotSep = hypot(var.dotdeltax, var.dotdeltay) * 511.5
var.IRDistance = var.SensorBarSeparation * 1320 / var.DotSep
end if

// sort out the position of the left and right dots
if var.leftdot = 1 then
if wiimote.dot1vis and wiimote.dot2vis then
var.LeftDotX = var.dot1x
var.LeftDotY = var.dot1y
var.LeftDotVis = true
var.RightDotX = var.dot2x
var.RightDotY = var.dot2y
var.RightDotVis = true
else if wiimote.dot1vis then
if hypot(var.leftdotx-var.dot1x,var.leftdoty-var.dot1y) <= hypot(var.rightdotx-var.dot1x,var.rightdoty-var.dot1y) then
// is the real dot 1
var.LeftDotX = var.dot1x
var.LeftDotY = var.dot1y
var.RightDotX = var.dot1x + var.dotdeltax
var.RightDotY = var.dot1y + var.dotdeltay
var.LeftDotVis = true
var.RightDotVis = false
else
// was originally dot 2, but now called dot 1.
var.leftdot = 2 // this dot (1) is actually the right dot
var.LeftDotX = var.dot1x - var.dotdeltax
var.LeftDotY = var.dot1y - var.dotdeltay
var.RightDotX = var.dot1x
var.RightDotY = var.dot1y
var.RightDotVis = true
var.LeftDotVis = false
end if
else if wiimote.dot2vis then
var.LeftDotX = var.dot2x - var.dotdeltax
var.LeftDotY = var.dot2y - var.dotdeltay
var.RightDotX = var.dot2x
var.RightDotY = var.dot2y
var.RightDotVis = true
var.LeftDotVis = false
end if
else if var.leftdot = 2 then
if wiimote.dot1vis and wiimote.dot2vis then
var.LeftDotX = var.dot2x
var.LeftDotY = var.dot2y
var.LeftDotVis = true
var.RightDotX = var.dot1x
var.RightDotY = var.dot1y
var.RightDotVis = true
else if wiimote.dot1vis then
if hypot(var.leftdotx-var.dot1x,var.leftdoty-var.dot1y) <= hypot(var.rightdotx-var.dot1x,var.rightdoty-var.dot1y) then
var.leftdot = 1 // dot 1 is now the left dot
var.LeftDotX = var.dot1x
var.LeftDotY = var.dot1y
var.RightDotX = var.dot1x + var.dotdeltax
var.RightDotY = var.dot1y + var.dotdeltay
var.LeftDotVis = true
var.RightDotVis = false
else
// the real dot 1 (on the right)
var.LeftDotX = var.dot1x - var.dotdeltax
var.LeftDotY = var.dot1y - var.dotdeltay
var.RightDotX = var.dot1x
var.RightDotY = var.dot1y
var.RightDotVis = true
var.LeftDotVis = false
end if
else if wiimote.dot2vis then
var.RightDotX = var.dot2x + var.dotdeltax
var.RightDotY = var.dot2y + var.dotdeltay
var.LeftDotX = var.dot2x
var.LeftDotY = var.dot2y
var.LeftDotVis = true
var.RightDotVis = false
end if
else
var.LeftDotX = var.dot1x
var.LeftDotY = var.dot1y
var.RightDotX = var.LeftDotX
var.RightDotY = var.LeftDotY
var.LeftDotVis = true
var.RightDotVis = true
end if


// Find the imaginary middle dot
var.MiddleDotX = (var.leftdotx + var.rightdotx)/2
var.MiddleDotY = (var.leftdoty + var.rightdoty)/2
var.MiddleDotVis = wiimote.dot1vis or wiimote.dot2vis

if var.MiddleDotVis then
var.TotalPitch = atan2(511.5*var.MiddleDotY,1320) + Wiimote.Pitch
var.DotYaw = atan2(-511.5*var.MiddleDotX,1320) // assume yaw is 0
var.WiimoteYawNoX = atan2(511.5*var.MiddleDotX,1320)
var.WiimoteXNoYaw = -sin(var.dotyaw)*var.IRDistance
var.WiimoteY = -sin(var.totalpitch)*var.IRDistance
var.WiimoteZ = (-sqrt(sqr(var.IRDistance) - sqr(var.WiimoteY)))*var.IRDistance/RemoveUnits(var.IRDistance)
end if

// scale it to the screen range 0 to 1
var.IRx = var.IRMulX*var.middledotx/2 + 0.5
var.IRy = var.IRMulY*var.middledoty*1023/767/2 + 0.5
var.IRvis = wiimote.dot1vis or wiimote.dot2vis
var.IROnScreen = 0 <= var.IRx <= 1 and 0 <= var.IRy <= 1

// is it off the screen?
var.IRTooFarLeft = var.IRx < 0 or (var.IRx < 0.1 and (not var.IRvis))
var.IRTooFarRight = var.IRx > 1 or (var.IRx > 1-0.1 and (not var.IRvis))
var.IRTooFarUp = var.IRy < 0 or (var.IRy < 0.1 and (not var.IRvis))
var.IRTooFarDown = var.IRy > 1 or (var.IRy > 1-0.1 and (not var.IRvis))

// Heavily smooth small movements, but do zero lag for quick movements
var.MoveAmount = 1024*hypot(delta(var.IRx), delta(var.IRy))
if smooth(var.MoveAmount) > 12 then
var.SmoothX = var.IRx
var.SmoothY = var.IRy
var.LastSureFrame = PIE.Frame
else if (PIE.frame-var.LastSureFrame) > 18 then
var.SmoothX = Smooth(var.IRx, 18, 4/1024)
var.SmoothY = Smooth(var.IRy, 18, 4/1024)
else if (PIE.frame-var.LastSureFrame) > 14 then
var.SmoothX = Smooth(var.IRx, 14, 4/1024)
var.SmoothY = Smooth(var.IRy, 14, 4/1024)
else if (PIE.frame-var.LastSureFrame) > 10 then
var.SmoothX = Smooth(var.IRx, 10, 4/1024)
var.SmoothY = Smooth(var.IRy, 10, 4/1024)
else if (PIE.frame-var.LastSureFrame) > 6 then
var.SmoothX = Smooth(var.IRx, 6, 4/1024)
var.SmoothY = Smooth(var.IRy, 6, 4/1024)
else if (PIE.frame-var.LastSureFrame) > 2 then
var.SmoothX = Smooth(var.IRx, 2, 4/1024)
var.SmoothY = Smooth(var.IRy, 2, 4/1024)
end if

// Freeze the mouse cursor while they start pressing the button
// otherwise it will make the cursor jump
var.Freeze = (var.IRLeftButton or var.IRRightButton) and KeepDown(pressed(var.IRLeftButton) or pressed(var.IRRightButton), 600ms)

// Only change the mouse position if pointing at the screen
// otherwise they can still use a real mouse
if var.IRvis and (not var.Freeze) then
mouse.x = var.SmoothX
mouse.y = var.SmoothY
end if

// delay the buttons slightly so we have time to freeze the cursor (is that needed?)
//mouse.LeftButton = var.IRLeftButton and (not KeepDown(pressed(var.IRLeftButton), 40ms))
//mouse.RightButton = var.IRRightButton and (not KeepDown(pressed(var.IRRightButton), 40ms))

// display 6DOF data
if var.NoYawAllowed then
debug = 'X: '+var.WiimoteXNoYaw+', Y: '+var.WiimoteY+', Z: '+var.WiimoteZ+', Yaw: 0, Pitch: '+Wiimote.Pitch+', Roll: '+Wiimote.Roll
else
debug = 'X: 0, Y: '+var.WiimoteY+', Z: '+var.WiimoteZ+', Yaw: '+var.WiimoteYawNoX+', Pitch: '+Wiimote.Pitch+', Roll: '+Wiimote.Roll
endif

endif


I just looked through the rest of the boards, and I apologize again as I just saw the answer to my first post about full-screen games not being based on the x-y coordinate but rather on mouse movement. However, is there a way to slow the 2nd script down some as it seems to move and work, just really really fast? I understand the first script to some extent, but the 2nd still has me puzzled. I'm going to take a fresh look at it tomorrow after work, as I've spent most of tonight getting to this point, but at least it's a really good start.

Thanks again!!

-Synbios1978
Back to top
View user's profile Send private message
thagerty



Joined: 01 Feb 2007
Posts: 35

Digg It
PostPosted: Wed Feb 28, 2007 2:22 am    Post subject:

What i do for myself is use Pinnacle Profiler with this same script except i use the "mouse to joystick" type script that came with Glovepie for mouse movement instead of the one i posted above. Note: you will NEED to have PPJOY installed and setup for this to work as well as Pinnacle Profiler. I will post the Pinnacle Profiler version script here....

Code:


/* OBLIVION-THE Zelda Twilight Princess Controls Script-BY TERRY HAGERTY   V 2.2   Feb 18.07

 This script lets you play Oblivion just like Zelda: Twilight Princess, or the old normal way if you choose!
(Sensor Bar required for Mouse Look/Aim MODE or Pointer movement) It also has extra easy controls compared to
normal Oblivion, ie. automatic HEAVY ATTACKS.

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)


To play MORE like Zelda I HIGHLY recommend you install and use the Combat Modification 2.0c MOD which
will give you a "TARGET" item. You then bind it to either Hotkey 1,3,5,or 7 and use it to LOCK ON to your
enemies just like the Z-LOCK targetting in ZELDA:TP or ZELDA:OOT. This will automatically keep you facing
your enemy while strafing which makes Combat controls MUCH easier! To find the Combat Modification 2.0c MOD
goto this link and follow thier instructions for installation and use:

http://planetelderscrolls.gamespy.com/View.php?view=OblivionMods.Detail&id=750

HOW TO PLAY!!!

//////////////
The Normal MODE (LED 1 OFF) controls are as follows:

Just walk around forward and backward and turn left and right with the Nunchuk joystick. It will NOT look
up or down but it will make Oblivion very easy to play. To have FULL mouse LOOK/AIM/Pointer control, HOLD B,
aim at sensor bar, and move with the remote. If you are LOCKED-ON to an enemy in NORMAL mode, you cannot move
left/right, only forward and backward. Toggle to Z MODE (press Z, LED 1 is on) when LOCKED-ON and you can
FULLY move around your enemy.

//////////////
Z MODE or Traditional Controls (Press Z, LED 1 ON):

If you wish to use more traditional controls, press Z. Now your Nunchuk joystick will strafe left and right
instead of looking left/right and it will still move forward/backward. Use this mode when LOCKING ON to an enemy.
Press Z again to toggle back to normal.

//////////////
LOOK/AIM/POINTER Mode (HOLD B)

This MODE 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.
//////////////

To GUARD, just hold the Nunchuk upright.

To ATTACK just swing the Wii Remote left/right OR push the "A" button for arrows. To do a HEAVY ATTACK automatically,
Hold Down "C" and swing the Wii Remote in a direction (up,down,left,right) for that direction's attack.

To CAST magic just FLICK the Wii Remote forward (but NOT while holding C), or HOLD "PLUS".


The BUTTON layout is as follows:

Normal Attack/Select.etc = Wiimote.A
Jump (Press)  or  Cast (Hold) = Wiimote.Plus
Enter/Activate (Press) or  Grab (HOLD) = Wiimote.Minus
Journal = Wiimote.Home
Hotkeys 1,3,5,7
 1 = Wiimote.Up
 5 = Wiimote.Down
 7 = Wiimote.Left
 3 = Wiimote.Right
Ready weapon = Wiimote.One
Sneak = Wiimote.Two
Nunchuk Z = Change Modes (Normal Mode / Z Mode (Traditional controls)) LED 1 on = Z mode
Hotkeys 6, 8 (Your object must be assigned to Hotkey 6 or 8 using the keyboard)
  Flick Nunchuk to your left for Hotkey 8
  Flick Nunchuk to your right for Hotkey 6 (I recommend putting your Target Ring from the Combat Mod here)


Hold down "B" on remote for FULL Mouse Look/Aim/Pointer  MODE.

These buttons only work when holding down Nunchuk "C":

Change view = Wiimote.home
Scroll view in/out
  = Wiimote.Up
  = Wiimote.Down
Quick Save = Wiimote.left
Quick Load = Wiimote.right
Wait = Wiimote.one
Menu = Wiimote.two



Have fun...

*/



// Normal Mode - Mouse look Left and Right only with Nunchuk-Stick

if var.lock=0 then
Mouse.DirectInputX = Mouse.DirectInputX + 20 * DeadZone(Wiimote.Nunchuk.JoyX, 10%)
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
//Walk forward and backward
key.w = wiimote.Nunchuk.JoyY < -0.5
key.s = wiimote.Nunchuk.JoyY > 0.5
//Swing Right
if (Wiimote.RawAccX < -var.ForceSensitivity, Wiimote.RawAccX > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingright=1
var.lock=4
endif
//Swing Left
if (Wiimote.RawAccX > var.ForceSensitivity, Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingleft=1
var.lock=4
endif
//Swing Back
if (Wiimote.RawAccy > var.ForceSensitivity, Wiimote.RawAccy < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingback=1
var.lock=4
endif
// Swing Forward
if (Wiimote.RawAccy < -var.ForceSensitivity, Wiimote.RawAccy > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.swingforward=1
var.lock=4
endif

endif






//Buttons that only work with Nunchuk C held Down
if wiimote.Nunchuk.CButton =true then
//Change view
r = Wiimote.Home
//Scroll view in/out
Mouse.WheelUp=Wiimote1.Up
Mouse.WheelDown=Wiimote.Down
//Wait
t=wiimote.one
//Menu
esc = Wiimote.two
// Quick Save
key.f5 = Wiimote.Left
// Quick Load
key.f9 = Wiimote.Right
endif



// Normal buttons

if wiimote.Nunchuk.CButton =false then
//Sneak
ctrl = Wiimote.Two
//Journal
tab = Wiimote.Home
//Ready weapon
f = Wiimote.One
//Hotkeys 1,3,5,7
key.1 = Wiimote.Up
key.5 = Wiimote.Down
key.7 = Wiimote.Left
key.3 = Wiimote.Right
endif

//Buttons that work in all modes

// Attack/Select
mouse.leftbutton=wiimote.a

 //Jump (Press Minus) &  Cast (Hold Minus)
var.old = var.jnew
var.new = HeldDown(Wiimote.plus, 250 ms)
key.e = Released(Wiimote.plus) && !var.jold
key.c = HeldDown(Wiimote.plus, 300 ms)

// Enter/Activate (Press Minus) & Grab (Hold Minus)
var.jold = var.jnew
var.jnew = HeldDown(Wiimote.minus, 250 ms)
key.space = Released(Wiimote.minus) && !var.jold
key.z = HeldDown(Wiimote.minus, 300 ms)


//Nunchuck hotkeys
//Hotkey 8  Flick Nunchuk to your left
key.8 = (Wiimote.Nunchuk.RawAccX < -var.ForceSensitivity, Wiimote.Nunchuk.RawAccX > var.ForceSensitivity)
//Hotkey 6  Flick Nunchuk to your right
key.6 = (Wiimote.Nunchuk.RawAccX > var.ForceSensitivity, Wiimote.Nunchuk.RawAccX < -var.ForceSensitivity)


//This varible controls the amount 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/attack variable
mouse.leftbutton=var.swing


//Normal Swing of Sword
if (Wiimote.RawAccX > var.ForceSensitivity or Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =false and wiimote.Nunchuk.zButton =false then
var.swing=true
wait 50ms
var.swing=false
endif

//Cast magic
if (Wiimote.RawAccy < -10, Wiimote.RawAccy > 10) 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 var.swingleft=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.a=true
var.swing=true
wait 400ms
var.swing=false
key.a=false
wait 100ms
var.lock=0
var.swingleft=0
endif

// Swing left Z
if var.zswingleft=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.a=true
var.swing=true
wait 400ms
var.swing=false
key.a=false
wait 100ms
var.lock=1
var.zswingleft=0
endif


// Swing right
if var.swingright=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.d=true
var.swing=true
wait 400ms
var.swing=false
key.d=false
wait 100ms
var.lock=0
var.swingright=0
endif

// Swing right Z
if var.zswingright=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.d=true
var.swing=true
wait 400ms
var.swing=false
key.d=false
wait 100ms
var.lock=1
var.zswingright=0
endif

// Swing Back
if var.swingback=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.s=true
var.swing=true
wait 400ms
var.swing=false
key.s=false
wait 100ms
var.swingback=0
var.lock=0
endif

// Swing Back Z
if var.zswingback=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.s=true
var.swing=true
wait 400ms
var.swing=false
key.s=false
wait 100ms
var.zswingback=0
var.lock=1
endif


// Swing Forward
if var.swingforward=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.w=true
var.swing=true
wait 400ms
var.swing=false
key.w=false
wait 100ms
var.swingforward=0
var.lock=0
endif

// Swing Forward Z
if var.zswingforward=1 and var.lock=4 then
key.s = (wiimote.Nunchuk.JoyY > 100)
key.w = wiimote.Nunchuk.JoyY < -100
key.a = wiimote.Nunchuk.JoyX < -100
key.d = wiimote.Nunchuk.JoyX > 100
key.w=true
var.swing=true
wait 400ms
var.swing=false
key.w=false
wait 100ms
var.zswingforward=0
var.lock=1
endif


///////////////////////////////////////////////////////////


//Z Lock Mode - Press Z button - Still needs you to manually lock and unlock yourself

if released(wiimote.nunchuk.zbutton) then
var.lock=var.lock +1
if var.lock >1 and <3 then
var.lock=0
endif
endif
//LED 1 on to show Z mode active
if var.lock >=1 then
Wiimote.Led1 = TRUE
else  Wiimote.Led1 = FALSE
endif

//Z Lock Mode Active
if var.lock=1 then
key.s = wiimote.Nunchuk.JoyY > 0.5
key.w = wiimote.Nunchuk.JoyY < -0.5
key.a = wiimote.Nunchuk.JoyX < -0.5
key.d = wiimote.Nunchuk.JoyX > 0.5

//Swing Right Z
if (Wiimote.RawAccX < -var.ForceSensitivity, Wiimote.RawAccX > var.ForceSensitivity)and wiimote.Nunchuk.CButton =true then
var.zswingright=1
var.lock=4
endif
//Swing Left Z
if (Wiimote.RawAccX > var.ForceSensitivity, Wiimote.RawAccX < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.zswingleft=1
var.lock=4
endif
//Swing Back Z
if (Wiimote.RawAccy > var.ForceSensitivity, Wiimote.RawAccy < -var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.zswingback=1
var.lock=4
endif
// Swing Forward Z
if (Wiimote.RawAccy < -var.ForceSensitivity, Wiimote.RawAccy > var.ForceSensitivity) and wiimote.Nunchuk.CButton =true then
var.zswingforward=1
var.lock=4
endif

endif



// Only needed if Pinnacle Profiler does FULL mouse LOOK/AIM
ppjoy.digital1 = wiimote.B


// Hold B for full aim and movement

if wiimote.b 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 START....
//
//If you have a BETTER IR mouse SCRIPT, replace everything below until you see
// "FULL MOUSE AIMING ENDS...."



// These values are used to make it easy to add any addition Wiimotes. If you
// need to add Wiimotes, just make the new line equals of number of the Wiimote
var.Wiimote1 = 1

// Wiimote Settings

// Wiimote 1 Variables

// Used to change the angle at which the Wiimote direction is detected
var.Wiimote1.Rotation = 7

// You can scale the movement to either speed up the movement or allow for
// better coverage near the edges of the screen
var.Wiimote1.ScaleX = 1.1
var.Wiimote1.ScaleY = 1.1

// Number of pixels the pointer has to move before it is updated
var.Wiimote1.Deadzone = 5

//Adjust these to calibrate your remote
var.Wiimote1.xcal = 3
var.Wiimote1.ycal = -30
var.Wiimote1.zcal = 3



// Calibrate settings
var.Wiimote1.ForceX = Wiimote1.RawForceX + var.Wiimote1.xcal
var.Wiimote1.ForceY = Wiimote1.RawForceY + var.Wiimote1.ycal
var.Wiimote1.ForceZ = Wiimote1.RawForceZ + var.Wiimote1.zcal

// Find Orientation
if var.Wiimote1.ForceY > var.Wiimote1.ycal + var.Rotation then
   var.Wiimote1.Orientation = var.Wiimote.Up
elseif var.Wiimote1.ForceY < var.Wiimote1.ycal - var.Rotation then
   var.Wiimote1.Orientation = var.Wiimote.Down
else
   if var.Wiimote1.ForceX > 0 then
      var.Wiimote1.Orientation = var.Wiimote.Left
   else
      var.Wiimote1.Orientation = var.Wiimote.Right
   endif
endif

// Get absolute screen position
if var.Wiimote1.Orientation == var.Wiimote.Up then
   var.Wiimote1.X = (1024 - ((Wiimote1.Dot1x + Wiimote1.Dot2x) / 2)) / 1024 * Screen.DesktopWidth
   var.Wiimote1.Y = ((Wiimote1.Dot1y + Wiimote1.Dot2y) / 2) / 768 * Screen.DesktopHeight
elseif var.Wiimote1.Orientation == var.Wiimote.Down then
   var.Wiimote1.X = (Wiimote1.Dot1x + Wiimote1.Dot2x) / 2 / 1024 * Screen.DesktopWidth
   var.Wiimote1.Y = (768 - ((Wiimote1.Dot1y + Wiimote1.Dot2y) / 2)) / 768 * Screen.DesktopHeight
elseif var.Wiimote1.Orientation == var.Wiimote.Left then
   var.Wiimote1.X = (Wiimote1.Dot1y) / 768 * Screen.DesktopWidth
   var.Wiimote1.Y = (Wiimote1.Dot1x + Wiimote1.Dot2x) / 2 / 1024 * Screen.DesktopHeight
else
   var.Wiimote1.X = (768 - Wiimote1.Dot1y) / 768 * Screen.DesktopWidth
   var.Wiimote1.Y = (1024 - ((Wiimote1.Dot1x + Wiimote1.Dot2x) / 2)) / 1024 * Screen.DesktopHeight
endif






   // Joystick needs to be between  -1 and 1 so we can't use absolute values directly
   if abs(mouse.CursorPosX - var.Wiimote1.X) > var.Wiimote1.Deadzone then
      ppjoy1.Analog0 = (var.Wiimote1.X - (Screen.DesktopWidth /2)) * var.Wiimote1.ScaleX / (Screen.DesktopWidth / 2)
   endif

   if abs(mouse.CursorPosY - var.Wiimote1.Y) > var.Wiimote1.Deadzone then
     ppjoy1.Analog1 = (var.Wiimote1.Y - (Screen.DesktopHeight /2)) * var.Wiimote1.ScaleY / (Screen.DesktopHeight / 2)
   endif
endif



endif
//FULL MOUSE AIMING ENDS....




Run this script in GlovePie, then setup your PPJOY controller in Pinnacle (ie using the device setup wizard). Make sure you set one of your PPJOY joysticks in Pinnacle as X AXIS for Horizontal and Y AXIS for Vertical.

That joystick (with this script running) is actually the Wii remote aiming at the sensor bar. (To confirm this goto CONTROL PANEL/GAME CONTROLLERS and click on properties for your your PPJOY controller. Your Wii remote with the sensor bar should move the x and y axis)

Then setup your oblivion profile in Pinnacle. Make sure there is NO assignments/mappings to ANY joysticks. Assign your B button as a SHIFT button. Then under shifted commands map your JOYSTICK (the Wii remote one) as your mouse. I have the joystick setup as: sensitivity 50/75, deadzone 5/5, motion range 50/25.

If all is done properly, run Oblivion through Pinnacle (as a persistent profile). When you Hold down B, you should have smooth controllable mouse/look movement. Much better than Glove Pie alone.

What is happening is Glove Pie makes the Wii remote IR functions acts like a joystick. Then Pinnacle will make that "JOYSTICK" acts like a mouse in game again, only you can control the sensitivity,deadzone,etc in Pinnacle to your liking VERY easily.

I use this with all my FPS type games in Glove Pie, but not everyone has Pinnacle so i substitute it with the best IR script i have found that actually works for everyone.
Back to top
View user's profile Send private message
firegoron



Joined: 16 Mar 2007
Posts: 36

Digg It
PostPosted: Fri Mar 16, 2007 3:25 am    Post subject: awesome

wow, another amazing script. congrats =)
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 Scripts All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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