 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
bomboy02
Joined: 07 Jan 2007 Posts: 17
Digg It |
Posted: Wed Jan 10, 2007 1:09 am Post subject: |
|
|
at the moment i am not good enough to write an entire script so at the moment i am modifying existing scripts, and this is my first.
the spin attack is now of the joy + B variety instead of the original B-charge so that you get it the instant you shake the nunchuk, and is fairly reliable.
| Code: | /*
Zelda: Ocarina of Time, with Twilight Princess controls!
Version 2 - Now with better spin attack and greatly improved menu system
modified by bomboy02
Original By Carl Kenner
The controls are:
N64 Analog Stick = PPJoy = Nunchuk Joy
N64 A = X = Wiimote A
N64 B = C = Wiimote B
N64 Start = S = Wiimote One(Map),Minus(Items),Plus(Quest)
N64 R = D = Nunchuk Right Roll
N64 Z = Z = Nunchuk Z
N64 C-Up = I = Wiimote Up(Navi)Nunchuk C(1st person)
N64 C-Down = K = Wiimote Down
N64 C-Left = J = Wiimote Left
N64 C-Right = L = Wiimote Right
NOTE: If the Menu is showing you the wrong screen go to the Map and press
HOME to reset.
I, bomboy02, have played, and beat, Twilight Princess, so I did my best to
emulate the controls as close as posible, especially the spin attack.
I hope you like it.
*/
// analog = movement
If not Var.Swinging Then
PPJoy.Analog0 = Wiimote.Nunchuk.JoyX
PPJoy.Analog1 = Wiimote.Nunchuk.JoyY
EndIf
// A = context button
X = Wiimote.A
// B = cancel/sword
C = Wiimote.B
// swing Wiimote = sword
If abs(Wiimote.RelAccX) >= 15 and (not Var.Swinging) and (not Var.Shield) Then
Var.Swinging = True
Release(Z)
Wait 100 ms
Press(C)
Wait 100 ms
Release(C)
wait 100 ms
Var.Swinging = False
EndIf
If abs(Wiimote.RelAccY) >= 15 and (not Var.Swinging) and (not Var.Shield) Then
var.swinging = true
press(Z)
wait 100 ms
press(C)
wait 100 ms
release(C)
wait 100 ms
release(Z)
wait 100 ms
var.swinging = false
endif
if abs(wiimote.RelAccZ) >= 15 and (not var.swinging) and (not var.Shield) then
var.swinging = true
press(Z)
wait 100 ms
ppjoy.analog1 = -1
wait 100 ms
press(C)
wait 100 ms
release(C)
wait 100 ms
release(Z)
wait 100 ms
ppjoy.analog1 = 0
wait 100 ms
var.swinging = false
endif
if abs(wiimote.RelAccZ) >= 15 and (not var.swinging) and (var.Shield) then
var.swinging = true
press(C)
wait 100 ms
release(C)
wait 100 ms
var.swinging = false
endif
if abs(wiimote.RelAccY) >= 15 and (not var.swinging) and var.Shield and Wiimote.Nunchuk.ZButton then
var.swinging = true
release(D)
wait 100 ms
press(C)
wait 100 ms
release(C)
wait 100 ms
press(D)
wait 100 ms
var.swinging = false
endif
// Roll nunchuk right to use your shield
var.Shield = Wiimote.Nunchuk.Roll > 60 degrees
D = var.Shield
if abs(wiimote.Nunchuk.RelAccX) >= 15 and (not var.swinging) and (not var.Shield) then
var.swinging = true
ppjoy.Analog0 = 0
ppjoy.analog1 = -1
wait 0.00095 ms
ppjoy.Analog0 = 0.7
ppjoy.analog1 = -0.7
wait 0.00095 ms
ppjoy.Analog0 = 1
ppjoy.analog1 = 0
wait 0.00095 ms
ppjoy.Analog0 = 0.7
ppjoy.analog1 = 0.7
wait 0.00095 ms
ppjoy.Analog0 = 0
ppjoy.analog1 = 1
Wait 0.00095 ms
ppjoy.Analog0 = -0.7
ppjoy.analog1 = 0.7
Wait 0.00095 ms
ppjoy.Analog0 = -1
ppjoy.analog1 = 0
Wait 0.00095 ms
ppjoy.Analog0 = -0.7
ppjoy.analog1 = -0.7
Wait 0.00095 ms
ppjoy.Analog0 = 0
ppjoy.analog1 = -1
Wait 0.0005
Press (key.C)
wait 0.0008 ms
Release (key.C)
Var.swinging = false
endif
// 2 = toggle on screen map
A = Wiimote.Two
// up = talk with Navi
// C = first person
I = Wiimote.Up or Wiimote.Nunchuk.CButton
// left, right, down = items
j = Wiimote.Left
l = Wiimote.Right
k = Wiimote.Down
// Z = Z-Target
z = Wiimote.Nunchuk.ZButton
// "-" = item screen / "+" = status menu
If Pressed(Wiimote.Minus) and Var.Menu = False and Var.Page=0 Then
Var.Menu = True
Press Key.S
Wait 100 ms
Release Key.S
Wait 2 s
Press Key.Z
Wait 100 ms
Release Key.Z
Say("Select Item")
Elseif Pressed (Wiimote.Minus) and Var.Menu= False and var.Page= 1 Then
Var.Menu= True
Press Key.S
Wait 100 ms
Release Key.S
Wait 2 s
Press Key.Z
Wait 100 ms
Release Key.Z
Say("Select Item")
Elseif Pressed (Wiimote.Minus) and Var.Menu= False and var.Page= 2 Then
Var.Menu= True
Press Key.S
Wait 100 ms
Release Key.S
Wait 2 s
Press Key.D
Wait 100 ms
Release Key.D
Say("Select Item")
Elseif Pressed (Wiimote.Minus) and Var.Menu= False and Var.Page= 3 Then
Var.Menu= True
Press Key.S
Wait 100 ms
Release Key.S
Wait 2 s
Press Key.D
Wait 100 ms
Release Key.D
Wait 1 s
Press Key.D
Wait 100 ms
Release Key.D
Say("Select Item")
Elseif pressed(Wiimote.Minus) and Var.Menu = True and var.Page= 0 then
press Key.S
wait 100 ms
release Key.S
Var.Menu = False
Elseif pressed(Wiimote.Minus) and Var.Menu = True and var.Page= 1 then
press Key.D
wait 100 ms
release Key.D
wait 1 s
press Key.S
wait 100 ms
release Key.S
Var.Menu = False
elseif pressed(Wiimote.Minus) and Var.Menu = True and var.Page=2 then
press Key.D
Wait 100 ms
Release Key.D
Say("Select Item")
ElseIf Pressed(Wiimote.Minus) and Var.Menu = True and Var.Page=3 Then
Press Key.D
Wait 100 ms
Release Key.D
Wait 1 s
Press Key.D
Wait 100 ms
Release Key.D
Say("Select Item")
endif
if pressed(Wiimote.Plus) and Var.Menu = False and var.Page= 0 then
press Key.S
wait 100 ms
release Key.S
wait 2 s
press Key.D
wait 100 ms
release Key.D
Say("Quest Status")
Elseif Pressed (Wiimote.Plus) and Var.Menu= False and var.Page= 1 Then
Var.Menu= True
Press Key.S
Wait 100 ms
Release Key.S
Wait 2 s
Press Key.D
Wait 100 ms
Release Key.D
Wait 1 s
Press Key.D
Wait 100 ms
Release Key.D
Say("Quest Status")
Elseif Pressed (Wiimote.Plus) and Var.Menu= False and var.Page= 2 Then
Var.Menu= True
Press Key.S
Wait 100 ms
Release Key.S
Wait 2 s
Press Key.Z
Wait 100 ms
Release Key.Z
Say("Quest Status")
Elseif Pressed (Wiimote.Plus) and Var.Menu= False and Var.Page= 3 Then
Var.Menu= True
Press Key.S
Wait 100 ms
Release Key.S
Say("Quest Status")
ElseIf pressed(Wiimote.Plus) and Var.Menu = True and var.Page= 0 then
press Key.D
wait 100 ms
release Key.D
Say("Quest Status")
elseif pressed(Wiimote.Plus) and Var.Menu = True and var.Page= 1 then
press Key.D
wait 100 ms
release Key.D
wait 1 s
press Key.D
wait 100 ms
release Key.D
Say("Quest Status")
elseif pressed(Wiimote.Plus) and Var.Menu = True and var.Page= 2 then
press Key.Z
wait 1 s
release Key.Z
Say("Quest Status")
elseif pressed(Wiimote.Plus) and Var.Menu = True and var.Page= 3 then
press Key.Z
wait 100 ms
release Key.Z
wait 1 s
press Key.S
wait 100 ms
release Key.S
endif
If Pressed(Wiimote.One) and Var.Menu = False and Var.Page=0 Then
Var.Menu = True
Press Key.S
Wait 100 ms
Release Key.S
Say("Map")
Elseif Pressed (Wiimote.One) and Var.Menu= False and Var.Page= 1 Then
Var.Menu= True
Press Key.S
Wait 100 ms
Release Key.S
Wait 2 s
Press Key.D
Wait 100 ms
Release Key.D
Say("Map")
Elseif Pressed (Wiimote.One) and Var.Menu= False and Var.Page= 2 Then
Var.Menu= True
Press Key.S
Wait 100 ms
Release Key.S
Wait 2 s
Press Key.D
Wait 100 ms
Release Key.D
Wait 1 s
Press Key.D
Wait 100 ms
Release Key.D
Say("Map")
Elseif Pressed (Wiimote.One) and Var.Menu= False and Var.Page= 3 Then
Var.Menu= True
Press Key.S
Wait 100 ms
Release Key.S
Wait 2 s
Press Key.Z
Wait 100 ms
Release Key.Z
Say("Select Item")
Elseif pressed(Wiimote.One) and Var.Menu = True and Var.Page= 0 then
press Key.S
wait 100 ms
release Key.S
Var.Menu = False
Elseif pressed(Wiimote.One) and Var.Menu = True and Var.Page= 1 then
press Key.D
wait 100 ms
release Key.D
Say("Map")
elseif pressed(Wiimote.One) and Var.Menu = True and var.Page= 2 then
press Key.D
Wait 100 ms
Release Key.D
wait 1 s
Press Key.D
Wait 100 ms
Release Key.D
Say("Map")
ElseIf Pressed(Wiimote.One) and Var.Menu = True and Var.Page=3 Then
Press Key.Z
Wait 100 ms
Release Key.Z
Say("Map")
endif
If Pressed (Key.Z) and Var.Menu= True and var.Page< 3 Then
Inc(Var.Page)
Elseif Pressed (Key.Z) and Var.Menu= True and var.Page= 3 Then
Var.Page= 0
Elseif Pressed (Key.D) and Var.Menu= True and var.Page> 0 Then
Dec(Var.Page)
Elseif Pressed (key.D) and Var.Menu= True and var.Page= 0 Then
Var.Page= 3
Elseif Pressed (Key.C) and Var.Menu= True Then
Var.Menu= False
ElseIf Pressed (Wiimote.Home)
Var.Page= 0
endif
|
_________________ StarCraft 2
www.starcraft2.com
"Hell, it's about time." - Tychus Findlay
Wii #: 7041 2686 1913 6765
Pokemon diamond F/C: 0473 4276 9277 |
|
| Back to top |
|
 |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Wed Jan 10, 2007 1:38 pm Post subject: |
|
|
I can't get it to work. Link won't do the spin attack.
Can you explain how to make him do it with the joystick? I can't do it with your script, and I don't know how to do it manually.
Also, how did you make your emulator run at a million frames per second?
Your delays are for less than a millionth of a second. |
|
| Back to top |
|
 |
CPW
Joined: 11 Dec 2006 Posts: 6
Digg It |
Posted: Wed Jan 10, 2007 4:57 pm Post subject: |
|
|
You just rotate the stick around maybe once or twice really fast and press B while doing it.
It's weird though, when using the classic controller or nunchuk's analog stick on an emulator, it's way harder to do the spin attack than it is when I play Ocarina on my GC.
Edit: Yeah, I have a problem with this. I see that you made it so when you do a vertical movement, it'll hold Z so he does a vertical slash, but when I do that he continues to slash until I move the remote upward.
The spin attack works pretty well for me though. |
|
| Back to top |
|
 |
bomboy02
Joined: 07 Jan 2007 Posts: 17
Digg It |
Posted: Thu Jan 11, 2007 5:56 am Post subject: |
|
|
CarlKenner: your looking at it wrong frames per second tells you the number of times the VIDEO is refreshed, code on the other hand is refreshed millions or billions of times per second. also before i wrote that code i tested the joy+b to see how fast you have to do it and its pretty fast.
but unfortunately i can't test at the moment cuz for some reason my Wiimote stoped being recognized by GlovePIE
CPW: that peice of code was done by the original creator of the script CarlKenner, i was mainly focused on the more glaring parts, the spin attack, and menu, but i'l see what i can do _________________ StarCraft 2
www.starcraft2.com
"Hell, it's about time." - Tychus Findlay
Wii #: 7041 2686 1913 6765
Pokemon diamond F/C: 0473 4276 9277 |
|
| Back to top |
|
 |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Thu Jan 11, 2007 6:39 am Post subject: |
|
|
GlovePIE doesn't update that often. So it is probably actually using much longer delays, like 25ms.
By the way, you also need to set var.Menu to true when they press Home, because often it gets into an invalid state too. And why are you setting var.Menu to false when they press A? A is used in the menu to choose what shield you want to use, amongst other things. B followed by A is used to exit the menu.
Also I think we should add a way to access the page where you choose your shield/sword/clothing, by double-clicking the plus key. So it would be triggered by DoubleClicked(Wiimote.Plus), and Quest Status would be triggered by SingleClicked(Wiimote.Plus).
I am working on a much better version of the script. I now have ALL the Twilight Princess controls working. But I want to fix up the pointer aiming and the pointer-look first, currently my pointer aiming isn't very good. It works, but not well enough to aim at things easily.
If it keeps slashing until you move the Wiimote upwards, then your Wiimote or computer is broken. That is bizarre. There is no explanation for that.
I made a new version which fixes the sword swings. It now recognises 4 different swings: sideways, vertical, forwards, and diagonal. I got sideways and vertical working without using Z-Targetting now, but the other two still use Z-Targetting to do the swing. If you are already Z-Targetting, they all work without changing Z-Targetting. But my new version requires Z-Targetting to be set to Hold to work best.
I will post my latest version soon, although there is a later version already in another thread. |
|
| Back to top |
|
 |
Arianol
Joined: 26 Dec 2006 Posts: 49
Digg It |
Posted: Fri Jan 12, 2007 1:43 am Post subject: |
|
|
| CPW wrote: | | You just rotate the stick around maybe once or twice really fast and press B while doing it. |
In the original game, you DO NOT press B while you rotate the analog stick. I don't know where that came from. _________________ You have the right to remain n00bish.
Anything you do can and will be used to own you. |
|
| Back to top |
|
 |
diegovb
Joined: 12 Jan 2007 Posts: 4
Digg It |
Posted: Fri Jan 12, 2007 2:36 pm Post subject: |
|
|
My untested code, with Nunchuk, no Sensor Bar Requiered (If it can be called MY code, I just took pieces of other codes and modified them to be able to play Rakion):
| Code: | //Play Rakion with Wiimote and Nunchuk
//by Diegovb
//Doesn't use Sensor Bar
//Based on Counter-Strike/Half-Life 2 Script (by tfjear, vkapadia and
//deceased) and Secret of Mana w/ Wiimote (by KCBlack)
//
//Untested, Because I still don't have a bluetooth adapter.
//
//Key Assignments
/*
Nunchuk!!!
Joystick = Movement
c or Z = Jump
Shake Nunchuk Side to Side = Primary Attack
Wiimote!!!
A = Up-Up-Click Combo, with Mage's combo LEDs animation :D
B = Secondary Attack
Up in D-pad = F5 Macro
Down in D-pad = Guard
Left or Right in D-pad = Change Weapon
Home = Chaos
Minus and Plus simultaniously = Menu
One = First Summon
Two = Second Summon
Tilt Wiimote = Camara
*/
//
// When configuring the offsets please put the wiimote flat and do not move it.
// These are offsets change them so that your debug output reads 0,0,0
// The debug output is at the top of this window.
// Ex if you get -7,33,-6 then change the offsets to 7,-33,6
var.xOffset = 0
var.yOffset = 0
var.zOffset = 0
//
//
//
//
//
//
//
//
//Inside joke with the LEDs xD
Wiimote.Led1 = true
Wiimote.Led4 = true
//Assignments on Keybord
Keyboard.F5 = Wiimote.Up
Keyboard.LeftShift = Wiimote.Down
Keyboard.C = Wiimote.Home
Keyboard.1 = Wiimote.One
Keyboard.2 = Wiimote.Two
if Wiimote.Nunchuk.ZButton and not Wiimote.Nunchuk.CButton then
Keyboard.Space = true
endif
if Wiimote.Nunchuk.CButton and not Wiimote.Nunchuk.ZButton then
Keyboard.Space = true
endif
if Wiimote.Nunchuk.ZButton and Wiimote.Nunchuk.CButton then
Keyboard.Space = true
endif
if Wiimote.Left and Wiimote.Right then
Keyboard.Q = true
endif
if Wiimote.Left and not Wiimote.Right then
Keyboard.Q = true
endif
if Wiimote.Right and not Wiimote.Left then
Keyboard.Q = true
endif
if Wiimote.Plus and Wiimote.Minus then
Keyboard.Escape = true
endif
//Assignments on Mouse
Mouse.LeftButton = (wiimote.Nunchuk.gx >= 0.5)
if (Wiimote.Nunchuk.gx >= 0.5) then
Wiimote.Rumble = true
wait 120ms
Wiimote.Rumble = false
endif
Mouse.RightButton = Wiimote.B
if Wiimote.A then
Keyboard.W = true
wait 5 ms
Keyboard.W = false
wait 5 ms
Keyboard.W = true
wait 5 ms
Keyboard.W = false
wait 10 ms
Mouse.LeftButton = true
wait 500 ms
Mouse.LeftButton = false
endif
//LEDs
if Wiimote.A then
Wiimote.Led1 = false
Wiimote.Led2 = false
Wiimote.Led3 = false
Wiimote.Led4 = false
wait 330 ms
Wiimote.Led1 = true
Wiimote.Led2 = false
Wiimote.Led3 = false
Wiimote.Led4 = false
wait 125 ms
Wiimote.Led1 = true
Wiimote.Led2 = true
Wiimote.Led3 = false
Wiimote.Led4 = false
wait 125 ms
Wiimote.Led1 = true
Wiimote.Led2 = true
Wiimote.Led3 = true
Wiimote.Led4 = false
wait 125 ms
Wiimote.Led1 = true
Wiimote.Led2 = true
Wiimote.Led3 = true
Wiimote.Led4 = true
wait 1670 ms
Wiimote.Led1 = false
Wiimote.Led2 = false
Wiimote.Led3 = false
Wiimote.Led4 = false
wait 2000 ms
Wiimote.Led1 = true
Wiimote.Led2 = false
Wiimote.Led3 = false
Wiimote.Led4 = true
endif
//
//Everything Passed Here Deals With Movement
//==========================================
//Nunchuck
if Wiimote.nunchuk.joyy > .2
Keyboard.S = 1
else if Wiimote.nunchuk.joyy < -.2
Keyboard.W = 1
else
Keyboard.S = 0
Keyboard.W = 0
endif
if wiimote.nunchuk.joyx > .2
Keyboard.D = 1
else if wiimote.nunchuk.joyx < -.2
Keyboard.A = 1
else
Keyboard.D = 0
Keyboard.A = 0
endif
var.x = Wiimote.RawForceX + var.trimx
var.y = Wiimote.RawForceY + var.trimy
var.z = Wiimote.RawForceZ + var.trimz
//Precision
var.sense0 = 500
var.thresh0x = 5
var.thresh0y = 2
var.sense = 300
var.threshx = 10
var.threshy = 5
var.sense2 = 100
var.thresh2x = 15
var.thresh2y = 8
var.sense3 = 50
var.thresh3x = 20
var.thresh3y = 12
//First Sensitivity Setting
//X-axis
if var.x > var.thresh0x
mouse.x = mouse.x - 1/var.sense0
endif
if var.x < -var.thresh0x
mouse.x = mouse.x + 1/var.sense0
endif
//Y-axis
if var.z > var.thresh0y
mouse.y = mouse.y - 1/var.sense0
endif
if var.z < -var.thresh0y
mouse.y = mouse.y + 1/var.sense0
endif
//Second Sensitivity Setting
//X-axis
if var.x > var.threshx
mouse.x = mouse.x - 1/var.sense
endif
if var.x < -var.threshx
mouse.x = mouse.x + 1/var.sense
endif
//Y-axis
if var.z > var.threshy
mouse.y = mouse.y - 1/var.sense
endif
if var.z < -var.threshy
mouse.y = mouse.y + 1/var.sense
endif
//Third Sensitivity Setting
//X-axis
if var.x > var.thresh2x
mouse.x = mouse.x - 1/var.sense2
endif
if var.x < -var.thresh2x
mouse.x = mouse.x + 1/var.sense2
endif
//Y-axis
if var.z > var.thresh2y
mouse.y = mouse.y - 1/var.sense2
endif
if var.z < -var.thresh2y
mouse..y = mouse.y + 1/var.sense2
endif
//Fourth Sensitivity Setting
//X-axis
if var.x > var.thresh3x
mouse.x = mouse.x - 1/var.sense3
endif
if var.x < -var.thresh3x
mouse.x = mouse.x + 1/var.sense3
endif
//Y-axis
if var.z > var.thresh3y
mouse.y = mouse.y - 1/var.sense3
endif
if var.z < -var.thresh3y
mouse.y = mouse.y + 1/var.sense3
endif
//Debug
debug = var.x + " " + var.y + " " + var.z |
|
|
| Back to top |
|
 |
|
|
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
|