| View previous topic :: View next topic |
| Author |
Message |
Mibaranu
Joined: 13 Jan 2007 Posts: 3
Digg It |
Posted: Sun Jan 14, 2007 4:27 am Post subject: Classic Controller FPS script needs help |
|
|
Being a console gamer, using a mouse in games like counter strike with a mouse is foreign to me.
so i am attempting to finish a script for my wiimote classic controller to use the dual analog sticks.
My only problem, when i try mapping WSAD to the left analog stick using either a if or a while statement, and try it in the game, it acts as though the key were pressed constantly. if there isnt a way to use the left analog stick, i might use the control pad, sacrificing flashlight, night vision, and weapon scrolling.
here is a copy of my code so far. feel free to use/edit it (i would clean it up myself, but im just lazy) , i just want left stick support.
| Code: | //This is my counterstrike/halflife code for use with the classic controller
//button layout is mostly default, but it may be wise to make sure everything
//lines up.
//I used the Wiimote mouse script and mapped it to the right analog stick
Wiimote.Leds = 1
Mouse.LeftButton = Wiimote.Classic.R //shoot
Mouse.RightButton = Wiimote.Classic.L //weapon special
Q = Wiimote.Classic.X //quickswitch
Space = Wiimote.classic.B //jump
Z = Wiimote.Classic.ZL //crouch
X = Wiimote.Classic.ZR //walk
E = Wiimote.Classic.A //action
R = Wiimote.Classic.Y //reload
B = Wiimote.Classic.Start //buy menu
Esc = Wiimote.Classic.Home //menu
Tab = Wiimote.Classic.Minus //scores
G = Wiimote.Classic.a + Wiimote.Classic.x //drop weapon
F = Wiimote.Classic.Up //flash light
N = Wiimote.Classic.Down //night vision
M = Wiimote.Classic.Left //Switch weapon down
Comma = Wiimote.Classic.Right //Switch weapon up
var.X1 = Wiimote.Classic.RawJoy1X +97 //trim to 0
var.Y1 = Wiimote.Classic.RawJoy1Y +99 //trim to 0
var.x = Wiimote.Classic.RawJoy2X +101 //trim to 0
var.z = Wiimote.Classic.RawJoy2Y +100 //trim to 0
//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
//xaxis
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
//yaxis
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
//xaxis
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
//yaxis
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
//xaxis
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
//yaxis
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
//xaxis
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
//yaxis
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 |
|
|
| Back to top |
|
 |
squeakypants
Joined: 09 Nov 2006 Posts: 99
Digg It |
Posted: Sun Jan 14, 2007 4:52 am Post subject: |
|
|
Use either
| Code: |
if (Wiimote.Classic.Joy1X < -0.4) {
Keyboard.A = True;
} else if (Wiimote.Classic.Joy1X > 0.4) {
Keyboard.D = True;
} else {
Keyboard.A = False;
Keyboard.D = False;
}
|
or Glovepie's easier, but less clean, replacement:
| Code: |
Keyboard.A = Wiimote.Classic.Joy1X < -0.4;
Keyboard.D = Wiimote.Classic.Joy1X > 0.4;
|
Glovepie interprets the latter as the former. |
|
| Back to top |
|
 |
Mibaranu
Joined: 13 Jan 2007 Posts: 3
Digg It |
Posted: Sun Jan 14, 2007 4:55 am Post subject: |
|
|
| awesome thanks |
|
| Back to top |
|
 |
kunalkunal2
Joined: 13 Dec 2006 Posts: 279
Digg It |
Posted: Mon Jan 22, 2007 11:33 pm Post subject: |
|
|
the right anoolog stick work's but always goes to the left
any advice? _________________ Check out my collection of my wii script's
freewebs.com/kunalkunal2 |
|
| Back to top |
|
 |
slayer080
Joined: 29 Jan 2007 Posts: 26
Digg It |
Posted: Thu Feb 01, 2007 5:41 pm Post subject: |
|
|
| u know this script would be perfect if it dint move to the right constantly and the left analog worked |
|
| Back to top |
|
 |
|