 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
wrathofzhan
Joined: 26 Dec 2007 Posts: 19
Digg It |
Posted: Fri Jun 06, 2008 6:29 pm Post subject: Resident Evil 4 Script (MOUSEAIM) |
|
|
For the purposes of this script, I borrowed coding from both GMA and TigerGD. Due to my issues with Bluetooth HID Devices and ppjoy, I am unable to use ir aiming with ppjoy.analog. Keybindings were highly inaccurate also. For these reasons, I made my own script. This script requires mouse aiming for Resident Evil 4, and uses a mouse script for aiming. Rest assured, Accuracy in this script is unbelievably good.
Be Sure to Download Resident Evil Mouse Aim 2.0 and its 1.1 mouse aim patch. These can be found through
http://www.moddb.com/downloads/6442/resident-evil-4-mouseaim-patch
http://www.moddb.com/downloads/6919/resident-evil-4-mouseaim-patch-11
In the Mouse Aim loader, set the mouse sensitivity to your discretion. Then, go to glovepie and enable my script. Trigger the script to aim mode, and enjoy! I am quite proud of my work, and I don't mean to brag, but I think this has even more accurate aiming than the Wii!
/*'Resident Evil 4: Awesome Edition'
by Ran (wrathofzhan@gmail.com)
Thanks to GMA and Tiger for IR aiming and Key Bindings
*******************************************************************************
This script is designed to create a realistic approximation of accurate aiming with an IR sensor.
Before playing, download and install Resident Evil 4 MouseAim 2.0, a mod that can easily be found on google.
In the file loader for the Mouse Aim Mod, toggle Mouse sensitivity to your own discretion. Then, Run Glovpie.
In the debug Bar, toggle to Aim in order to play. If you read this and use this script, you agree to submit
to my awesomeness!
Controls:
D-pad = Move camera
B button = Ready weapon / Aim
C button = Ready knife
A button = Action, attack, confirm
'Minus' button = Status screen
'Plus' button = Call Ashley
'1' button = Map
'Home' button = Options, skip movies
Z button = Run (while moving forward), 180 turn (while moving backward)
B button + move Remote = Aim weapon
B button + shake Remote = Reload
C button + shake Remote = Knife attack
*/
var.speed = 1
Left = Wiimote.Left //Camera left
Right = Wiimote.Right //Camera right
Up = Wiimote.Up //Camera up
Down = Wiimote.Down //Camera down
LeftShift = Nunchuk.CButton //Ready knife
RightShift = Wiimote.B //Ready weapon
Enter = Wiimote.A //Action, attack, confirm
F = Wiimote.Plus //Call Ashley
I = Wiimote.Minus //Status screen
M = Wiimote.One //Map
Esc = Wiimote.Home //Options, skip movies
RightCtrl = Nunchuk.ZButton //Run, 180 turn
var.IRCount = 2
//Joystick movement
If Nunchuk.JoyY > 0.55
S = True
Wait 10ms
S = False
EndIf
If Nunchuk.JoyY > 0.35 and < 0.55
S = True
Wait 25ms
S = False
EndIf
If Nunchuk.JoyY > 0.15 and < 0.35
S = True
Wait 35ms
S = False
EndIf
If Nunchuk.JoyY < -0.55
W = True
Wait 10ms
W = False
EndIf
If Nunchuk.JoyY < -0.35 and > -0.55
W = True
Wait 25ms
W = False
EndIf
If Nunchuk.JoyY < -0.15 and > -0.35
W = True
Wait 35ms
W = False
EndIf
If Nunchuk.JoyX < -0.55
A = True
Wait 10ms
A = False
EndIf
If Nunchuk.JoyX < -0.35 and > -0.55
A = True
Wait 25ms
A = False
EndIf
If Nunchuk.JoyX < -0.15 and > -0.35
A = True
Wait 35ms
A = False
EndIf
If Nunchuk.JoyX > 0.55
D = True
Wait 10ms
D = False
EndIf
If Nunchuk.JoyX > 0.35 and < 0.55
D = True
Wait 25ms
D = False
EndIf
If Nunchuk.JoyX > 0.15 and < 0.35
D = True
Wait 35ms
D = False
EndIf
if Var.AbsolutePositioning then
debug = Var.Game + ", Mode: MOUSE, click <2> <home> to change"
else
debug = Var.Game + ", Mode: AIM, click <2> <home> to change. "
end if
If starting then
Var.Game = "ResidentEvil"
endif
if Var.Game = "ResidentEvil" then
var.Sensitivity = 0.15 // 0.15 for Resident Evil
endif
if Clicked(wiimote.Two + wiimote.Home) or starting then var.AbsolutePositioning = not var.AbsolutePositioning
if starting then
var.Margin = 1
end if
//Wiimote knife
If Nunchuk.CButton
Enter = (Wiimote.RawAccX > 15) or (Wiimote.RawAccX < -15)
var.Cam = "Aim"
EndIf
//Wiimote reload
If Wiimote.B
RightCtrl = (Wiimote.RawAccX > 15) or (Wiimote.RawAccX < -15)
EndIf
// Camera/Aim
var.Cam = "Move"
If Wiimote.B
var.Cam = "Aim"
ElseIf released(Wiimote.B)
W = False
A = False
S = False
D = False
Else
var.Cam = "Move"
EndIf
If var.Cam = "Aim"
if wiimote.dot1vis or wiimote.dot2vis then
if wiimote.dot1vis and wiimote.dot2vis then
var.DotX = (wiimote.dot1x + wiimote.dot2x) / 2
var.DotY = (wiimote.dot1y + wiimote.dot2y) / 2
Var.Rumble = false
else
if wiimote.dot1vis then
var.DotX = wiimote.dot1x
var.DotY = wiimote.dot1y
else if wiimote.dot2vis then
var.DotX = wiimote.dot2x
var.DotY = wiimote.dot2y
end if
end if
if var.AccX >= .7 and not Nunchuk.Exists then
Var.PY = var.DotX / (1024 - var.Margin * 2)
Var.PX = var.DotY / (640 - var.Margin * 2)
else if var.AccX <= -.7 and not Nunchuk.Exists then
Var.PY = (1024 - var.DotX) / (1024 - var.Margin * 2)
Var.PX = (640 - var.DotY) / (640 - var.Margin * 2)
else
Var.PX = (1024 - var.DotX) / (1024 - var.Margin * 2)
Var.PY = var.DotY / (640 - var.Margin * 2)
end if
var.PX = wiimote.PointerX
var.PY = wiimote.PointerY
var.NextX = screen.Width * Var.PX - var.Margin
var.NextY = screen.Height * Var.PY - var.Margin
Var.KeepRolling = true
if var.AbsolutePositioning then
mouse.cursorposx = var.NextX
mouse.cursorposy = var.NextY
end if
else if Var.KeepRolling and not var.AbsolutePositioning then
Var.Rumble = true
wait 2 seconds
Var.Rumble = false
Var.NextX = screen.Width / 2
Var.NextY = screen.Height / 2
Var.KeepRolling = false
end if
if not var.AbsolutePositioning then
Var.TrackX = Delta(var.NextX)
Var.TrackY = Delta(var.NextY)
if Var.TrackX = 0 then
if Var.NextX > screen.Width * .75 then Var.TrackX = screen.Width * .003
if Var.NextX < screen.Width * .25 then Var.TrackX = -screen.Width * .003
end if
if Var.TrackY = 0 then
if Var.NextY > screen.Height * .75 then Var.TrackY = screen.Height * .003
if Var.NextY < screen.Height * .25 then Var.TrackY = -screen.Height * .003
end if
if Var.TrackX > 0 then Var.TrackX *= var.Sensitivity * sqr(var.NextX / screen.Width)
if Var.TrackX < 0 then Var.TrackX *= var.Sensitivity * sqr(1 - (var.NextX / screen.Width))
if Var.TrackY > 0 then Var.TrackY *= var.Sensitivity * sqr(var.NextY / screen.Height)
if Var.TrackY < 0 then Var.TrackY *= var.Sensitivity * sqr(1 - (var.NextY / screen.Height))
mouse.DirectInputX += Var.TrackX
mouse.DirectInputY += Var.TrackY
end if
ElseIf var.Cam = "Move"
EndIf
var.dummy = Wiimote.RawForceX
var.dummy = Wiimote.RawForceZ |
|
| Back to top |
|
 |
wrathofzhan
Joined: 26 Dec 2007 Posts: 19
Digg It |
Posted: Fri Jun 06, 2008 11:07 pm Post subject: |
|
|
This script implements Dr. Zoidberg's aiming. Press wiimote 2 to toggle mouse.
/*'Resident Evil 4: Awesome Edition'
by Ran (wrathofzhan@gmail.com)
Thanks to Dr Zoidberg and Tiger for IR aiming and Key Bindings
*******************************************************************************
This script is designed to create a realistic approximation of accurate aiming with an IR sensor.
Before playing, download and install Resident Evil 4 MouseAim 2.0, a mod that can easily be found on google.
In the file loader for the Mouse Aim Mod, toggle Mouse sensitivity to your own discretion. Then, Run Glovepie.
In the debug Bar, toggle to Aim in order to play. If you read this and use this script, you agree to submit
to my awesomeness!
Controls:
D-pad = Move camera
B button = Ready weapon / Aim
C button = Ready knife
A button = Action, attack, confirm
'Minus' button = Status screen
'Plus' button = Call Ashley
'1' button = Map
'Home' button = Options, skip movies
Z button = Run (while moving forward), 180 turn (while moving backward)
B button + move Remote = Aim weapon
B button + shake Remote = Reload
C button + shake Remote = Knife attack
*/
var.speed = 1
Left = Wiimote.Left //Camera left
Right = Wiimote.Right //Camera right
Up = Wiimote.Up //Camera up
Down = Wiimote.Down //Camera down
LeftShift = Nunchuk.CButton //Ready knife
RightShift = Wiimote.B //Ready weapon
Enter = Wiimote.A //Action, attack, confirm
F = Wiimote.Plus //Call Ashley
I = Wiimote.Minus //Status screen
M = Wiimote.One //Map
Esc = Wiimote.Home //Options, skip movies
RightCtrl = Nunchuk.ZButton //Run, 180 turn
var.IRCount = 2
//Joystick movement
If Nunchuk.JoyY > 0.55
S = True
Wait 10ms
S = False
EndIf
If Nunchuk.JoyY > 0.35 and < 0.55
S = True
Wait 25ms
S = False
EndIf
If Nunchuk.JoyY > 0.15 and < 0.35
S = True
Wait 35ms
S = False
EndIf
If Nunchuk.JoyY < -0.55
W = True
Wait 10ms
W = False
EndIf
If Nunchuk.JoyY < -0.35 and > -0.55
W = True
Wait 25ms
W = False
EndIf
If Nunchuk.JoyY < -0.15 and > -0.35
W = True
Wait 35ms
W = False
EndIf
If Nunchuk.JoyX < -0.55
A = True
Wait 10ms
A = False
EndIf
If Nunchuk.JoyX < -0.35 and > -0.55
A = True
Wait 25ms
A = False
EndIf
If Nunchuk.JoyX < -0.15 and > -0.35
A = True
Wait 35ms
A = False
EndIf
If Nunchuk.JoyX > 0.55
D = True
Wait 10ms
D = False
EndIf
If Nunchuk.JoyX > 0.35 and < 0.55
D = True
Wait 25ms
D = False
EndIf
If Nunchuk.JoyX > 0.15 and < 0.35
D = True
Wait 35ms
D = False
EndIf
//Wiimote knife
If Nunchuk.CButton
Enter = (Wiimote.RawAccX > 15) or (Wiimote.RawAccX < -15)
var.Cam = "Aim"
EndIf
//Wiimote reload
If Wiimote.B
RightCtrl = (Wiimote.RawAccX > 15) or (Wiimote.RawAccX < -15)
EndIf
// Camera/Aim
var.Cam = "Move"
If Wiimote.B
var.Cam = "Aim"
ElseIf released(Wiimote.B)
W = False
A = False
S = False
D = False
Else
var.Cam = "Move"
EndIf
If var.Cam = "Aim"
if wiimote.two = true then
if var.one = false then
if var.input = 1 then
var.input = 0
else
var.input = 1
endif
endif
var.one = true
endif
if wiimote.two = false then
var.one = false
endif
pie.FrameRate = 100
//rotation deadzone
var.rn = 36
pie.MouseDPI = 1640
//smoothsoftdeadzone
var.deadzone = 20
//adjust sensitivty mousedpi/100 works best
If not var.scrmultchngd = 1 then
var.scrmult = 250
endif
//areas for IR pointing ----------------
//direct pointing area
var.czonex = (screen.Width/1.2)/var.scrmult
var.czoney = (screen.Height/1.2)/var.scrmult
//faster direct pointing area
var.izonex = (screen.Width/4)/var.scrmult
var.izoney = (screen.Height/4)/var.scrmult
//continous movment around inner area
//-------------------------------------
//speed factors-----------------------
var.cfactor = 1/30
var.ifactor = 1/30
var.0factor = 1/30
//y-axis adjustment
var.factory = 0.00002
//acceleration adjust
var.cpower = 0.002
var.ipower = 0.03
var.0power = 0.05
//-------------------------------------
//wiimoteroll convert
if var.onedot = 0
var.cos0 = var.cos
var.sin0 = var.sin
endif
var.roll = 0 - wiimote.roll
if var.roll < 0 then
var.roll = var.roll + 360
endif
var.cos = cos(var.roll)
var.sin = -sin(var.roll)
var.0cos = var.cos - var.cos0
var.0sin = var.sin - var.sin0
var.0cos = smooth(var.0cos,2)
var.0sin = smooth(var.0sin,2)
var.cos = smooth(var.cos,25)
var.sin = smooth(var.sin,25)
var.sinpitch = sin(wiimote.Pitch)
var.sinpitch = smooth(var.sinpitch,5)
if wiimote.dot1vis or wiimote.dot2vis then
//phantomdot creation if only one dot is visible
if (not wiimote.dot1vis) or (not wiimote.dot2vis) then
if var.onedot < pie.FrameRate
var.onedot ++
endif
//compensate for pitch
var.distf = 1+((abs(var.y)^1/640-1)*((abs(var.sinpitch)^1)*(var.dist-1))/(640-1))*sign(var.sinpitch)*sign(var.y)
var.px = var.cos*var.dist*var.distf
var.py = var.sin*var.dist*var.distf
if wiimote.dot1vis then
var.d0x = (640/2)- wiimote.dot1x
var.d0y = (640/2) - wiimote.dot1y
var.dot2f = 2
var.dot1f = 1
else
var.d0x = (640/2)- wiimote.dot2x
var.d0y = (640/2) - wiimote.dot2y
var.dot1f = 2
var.dot2f = 1
endif
//check which dot is which
if sqrt(sqr(var.d0x-var.d1x)+sqr(var.d0y-var.d1y))*var.dot1f > sqrt(sqr(var.d0x-var.d2x)+sqr(var.d0y-var.d2y))*var.dot2f then
var.d3x = var.d1x
var.d3y = var.d1y
var.0d3x = var.d01x
var.0d3y = var.d01y
var.0d0x = var.d02x
var.0d0y = var.d02y
else
var.d3x = var.d2x
var.d3y = var.d2y
var.0d3x = var.d02x
var.0d3y = var.d02y
var.0d0x = var.d01x
var.0d0y = var.d01y
endif
//var.roll = var.roll - var.dr
if sqrt(sqr(var.d0x+var.px-var.d3x)+sqr(var.d0y+var.py-var.d3y)) > sqrt(sqr(var.d0x-var.px-var.d3x)+sqr(var.d0y-var.py-var.d3y)) then
var.px = var.px*(-1)
var.py = var.py*(-1)
endif
if var.onedot < 3 // set to +1 0sin / 0cos smooth value
//eliminte glitches at transition form 2 to 1 ir dots visible
var.0dx = var.px - var.0d3x + var.0d0x - var.0cos*var.dist
var.0dy = var.py - var.0d3y + var.0d0y - var.0sin*var.dist
endif
var.d2x = var.d0x + var.px - var.0dx
var.d2y = var.d0y + var.py - var.0dy
var.d1x = var.d0x
var.d1y = var.d0y
else
//read IR if both dots are visible
var.onedot = 0
var.d2x = (640/2)- wiimote.dot2x
var.d2y = (640/2) - wiimote.dot2y
var.d1x = (640/2)- wiimote.dot1x
var.d1y = (640/2) - wiimote.dot1y
var.dist = sqrt(sqr(var.d1x-var.d2x)+sqr(var.d1y-var.d2y))
endif
var.rotc = acos((var.d1x-var.d2x)/sqrt(sqr(var.d1x-var.d2x)+sqr(var.d1y-var.d2y)))
if ((var.d1y-var.d2y)/sqrt(sqr(var.d1x-var.d2x)+sqr(var.d1y-var.d2y))) > 0 then
var.rotc = 360 - var.rotc
endif
var.rots = - asin((var.d1y-var.d2y)/sqrt(sqr(var.d1x-var.d2x)+sqr(var.d1y-var.d2y)))
if ((var.d1x-var.d2x)/sqrt(sqr(var.d1x-var.d2x)+sqr(var.d1y-var.d2y))) < 0 then
var.rots = 180 - var.rots
endif
if var.rots < 0 then
var.rots = 360 + var.rots
endif
var.rot = var.rotc/2 + var.rots/2
//rotation neutralization
if (360 -var.rn) > abs(var.rot - var.roll) > (var.rn) then
var.rot = var.rot - 180
if var.rot < 0 then
var.rot = 360 + var.rot
endif
var.d0x = var.d1x
var.d0y = var.d1y
var.d1x = var.d2x
var.d1y = var.d2y
var.d2x = var.d0x
var.d2y = var.d0y
endif
//store last dots
if var.onedot = 0
var.d01x = var.d1x
var.d01y = var.d1y
var.d02x = var.d2x
var.d02y = var.d2y
endif
//smooth movement
var.d1x = smooth(var.d1x,2)
var.d1y = smooth(var.d1y,2)
var.d2x = smooth(var.d2x,2)
var.d2y = smooth(var.d2y,2)
//store last coordinates
var.0x = var.x
var.0y = var.y
//coordinate calculation
var.y = ((var.d1y*var.d2x)-(var.d1x*var.d2y)) / (sqrt(sqr(var.d2x-var.d1x) + sqr(var.d2y-var.d1y)))/((640))*screen.height/var.scrmult
var.x = (sqr(var.d1x)-sqr(var.d2x)+sqr(var.d1y)-sqr(var.d2y)) / (2*(sqrt(sqr(var.d2x-var.d1x) + sqr(var.d2y-var.d1y))))/(1024)*screen.Width/var.scrmult
//NAN bug workaround
if var.x = NAN then
var.x = 0
var.0x = 0
endif
if var.y = NAN then
var.y = 0
var.0y = 0
endif
//softsmoothdeadzone
if abs(var.x-var.0x) < var.deadzone then
var.x = var.x - ((var.x-var.0x)*(1-((abs((var.deadzone-abs(var.x-var.0x))/var.deadzone)))^0.5))
var.x = smooth(var.x,4)
endif
if abs(var.y-var.0y) < var.deadzone then
var.y = var.y - ((var.y-var.0y)*(1-((abs((var.deadzone-abs(var.y-var.0y))/var.deadzone)))^0.5))
var.x = smooth(var.x,4)
endif
var.x = smooth(var.x,2)
var.y = smooth(var.y,2)
if var.input = 0 then
if abs(var.x) > var.czonex
var.x = var.x*abs(1+(abs(abs(var.x)-var.czonex)/abs(var.x))*var.cpower)*var.cfactor
endif
if abs(var.y) > var.czoney
var.y = var.y*abs(1+(abs(abs(var.y)-var.czoney)/abs(var.y))*var.cpower*var.factory)*var.cfactor
endif
endif
if var.input = 1 then
mouse.x = smooth(((var.x/screen.Width*var.scrmult)*1.5 + 0.5),3)
mouse.y = smooth(((var.y/screen.Height*var.scrmult)*1.2 + 0.5),3)
endif
//fps mouse movement
if var.input = 0 then
if abs(var.x) > var.izonex then
var.inputx = var.inputx + var.x*abs((abs((abs(var.x)-var.izonex)^var.ipower)/abs(abs(var.x)^var.ipower)))*var.ifactor
endif
if abs(var.y) > var.izoney then
var.inputy = var.inputy + var.y*abs((abs((abs(var.y)-var.izoney)^var.ipower)/abs(abs(var.y)^var.ipower)))*var.ifactor
endif
var.inputx = var.inputx + var.x - var.0x
var.inputy = var.inputy + var.y - var.0y
mouse.DirectInputX = var.inputx
mouse.DirectInputY = var.inputy
endif
else
//continue mouse movement if no IR visible
if var.input = 0 then
if abs(var.x) > var.izonex then
var.InputX = var.InputX + var.x*abs((abs((abs(var.x)-var.izonex)^var.ipower)/abs(abs(var.x)^var.ipower)))*var.ifactor
else
var.InputX = var.InputX + var.x*abs(1+abs(var.x)*var.0power)*var.0factor
endif
if abs(var.y) > var.izoney then
var.InputY = var.InputY + var.y*abs((abs(abs(abs(var.y)-var.izoney)^var.ipower)/abs(abs(var.y)^var.ipower)))*var.ifactor
else
var.InputY = var.InputY + var.y*abs(1+abs(var.y)*var.0power*var.factory)*var.0factor
endif
mouse.directinputX = var.inputx
mouse.directinputY = var.inputy
endif
endif
ElseIf var.Cam = "Move"
EndIf
var.dummy = Wiimote.RawForceX
var.dummy = Wiimote.RawForceZ |
|
| Back to top |
|
 |
leynadix
Joined: 28 Dec 2007 Posts: 44 Location: MatarĂ³, Catalunya
Digg It |
Posted: Thu Jul 03, 2008 12:27 am Post subject: |
|
|
ouhm great!
There is possible create a "mod" generical for all fps games? I think no, but...
Other mod are Criisis, and its for use the IR wiimote for see. |
|
| Back to top |
|
 |
jeromote

Joined: 19 Mar 2008 Posts: 53
Digg It |
Posted: Thu Jul 03, 2008 2:30 pm Post subject: |
|
|
easiest
| Code: |
if Wiimote.Led1
if Wiimote.Nunchuk.ZButton or Wiimote.A
enter = Wiimote.RawForceX > 60
WASD = (mouse.DirectInput /600)
mouse.DirectInputX = (smooth(Wiimote1.pointerX - 1/2)/2) *(Screen.Width*1/2)
mouse.DirectInputY = (smooth(Wiimote1.pointerY - 1/2)/2) *(Screen.Height*1/2)
mouse.CursorPosX = (Screen.Width*1/2) + mouse.DirectInputX
mouse.CursorPosY = (Screen.Height*1/2)+ mouse.DirectInputY
else
WASD = Wiimote.Nunchuk.Joy
endif
rightshift = Wiimote.Nunchuk.ZButton
leftshift = Wiimote.A
if Wiimote.A
enter = Wiimote.B or Wiimote.RawForceX > 60
else
enter = Wiimote.B
endif
else
rightshift = Wiimote.Nunchuk.ZButton
leftshift = Wiimote.A
WASD = Wiimote.Nunchuk.Joy
if Wiimote.A
enter = Wiimote.B or Wiimote.RawForceX > 60
else
enter = Wiimote.B
endif
endif
F = Wiimote.Minus
I = Wiimote.Home
M = Wiimote.Plus
Up = Wiimote.Up
Down = Wiimote.Down
Left = Wiimote.Left
Right = Wiimote.Right
rightcontrol = Wiimote.Nunchuk.CButton
escape = wiimote.One
if enter
Wiimote.Rumble = 1
wait 300ms
Wiimote.Rumble = 0
endif
If wiimote.Led1 = 0
If wiimote.two
Wait 300ms
wiimote.Led1 = 1
Endif
Endif
If wiimote.Led1 = 1
If wiimote.two
Wait 300ms
wiimote.Led1 = 0
Endif
Endif
|
|
|
| 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
|