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 

Close to perfect Halo: Combat Evolved Script Here
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
Leight



Joined: 30 Jan 2007
Posts: 16

Digg It
PostPosted: Wed Mar 14, 2007 11:59 pm    Post subject: Close to perfect Halo: Combat Evolved Script Here

Dr_Zoidberg made the Mouse Aiming.
Elmerohueso made the Base Script.
I made the controls.

I avoided having the ''1'' key because that is for menus and will mess up your aiming if your ingame.(thank you Dr_Zoidberg for clearing that up)

Uses 2 IR points.
B = Shoot
A = Throw Grenade
Z+B = Punch
C = Jump
Z = Crouch
D-pad Up = Zoom
D-pad Right = Flash Light
D-pad Left = Switch Grenade Type
D-pad Down = Switch Weapon
D-pad Up + 2 = ESC
Plus = Reload
Minus = Exchange Weapon
Home = Use
Nunchuk analog stick = WASD


Quote:
//Halo:Combat Evolved
//by Dr_Zoidberg, Leight, and elmerohueso


//0 = directinput or xy = 1

if wiimote.One = true then
var.input = 1
endif
if wiimote.two = true then
var.input = 0
endif

pie.FrameRate = 125

//rotation deadzone
var.rn = 36

pie.MouseDPI = 1600
//smoothsoftdeadzone
var.deadzone = 1



//adjust sensitivty mousedpi/100 works best
If not var.scrmultchngd = 1 then
var.scrmult = 16
endif

//areas for IR pointing ----------------

//direct pointing area
var.czonex = (screen.Width/1.5)/var.scrmult
var.czoney = (screen.Height/1.5)/var.scrmult

//faster direct pointing area
var.izonex = (screen.Width/3)/var.scrmult
var.izoney = (screen.Height/3)/var.scrmult

//continous movment around inner area

//-------------------------------------

//speed factors-----------------------
var.cfactor = 1
var.ifactor = 1/16
var.0factor = 1/40

//y-axis adjustment
var.factory = 1/1.1

//acceleration adjust
var.cpower = 0.02
var.ipower = 1.2
var.0power = 0.1
//-------------------------------------

//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/768-1)*((abs(var.sinpitch)^1)*(var.dist-1))/(1024-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 = (1024/2)- wiimote.dot1x
var.d0y = (768/2) - wiimote.dot1y

var.dot2f = 2
var.dot1f = 1
else

var.d0x = (1024/2)- wiimote.dot2x
var.d0y = (768/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 = (1024/2)- wiimote.dot2x
var.d2y = (768/2) - wiimote.dot2y

var.d1x = (1024/2)- wiimote.dot1x
var.d1y = (768/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)))/((768))*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


if wiimote.Up then
var.scrmultchngd = 1
var.scrmult = var.scrmult*0.99
endif
if wiimote.Down then
var.scrmultchngd = 1
var.scrmult=var.scrmult/0.99
endif

//Nunchuckpart ----------------------

var.accsens = 15

if var.acc = 0 then

if abs(wiimote.Nunchuk.RelAccY) > var.accsens
var.acc = 1
keyboard.f = true
wait 10ms
keyboard.f = false
endif


if abs(wiimote.Nunchuk.RelAccX) > var.accsens
var.acc = 1
keyboard.g = true
wait 10ms
keyboard.g = false
endif

if abs(wiimote.Nunchuk.RelAccZ) > var.accsens
var.acc = 1
keyboard.e = true
wait 10ms
keyboard.e = false
endif

else
wait 500ms
var.acc = 0
endif


var.joysens = 0.3

var.wait = 20

var.nunjoydead0 = 1.5
var.nunjoydead1 = 0.05

var.waitpowert = 2
var.waitpowerf = 0.5

Space = Wiimote.Nunchuk.CButton
LeftControl = Wiimote.Nunchuk.ZButton
Z = Wiimote.Up
Tab = Wiimote.Down
G = Wiimote.Left
Q = Wiimote.Right
Esc = Wiimote.Up and Wiimote.2
Mouse.RightButton = Wiimote.A
Mouse.LeftButton = Wiimote.B
Wiimote.Rumble = Wiimote.Home
R = Wiimote.Plus
X = Wiimote.Minus
E = Wiimote.Home
F = Wiimote.Nunchuk.Zbutton and Wiimote.B


//B = Shoot
//A = Throw Grenade
//Z+B = Punch
//C = Jump
//Z = Crouch
//D-pad Up = Zoom
//D-pad Right = Flash Light
//D-pad Left = Switch Grenade Type
//D-pad Down = Switch Weapon
//D-pad Up + 2 = ESC
//Plus = Reload
//Minus = Exchange Weapon
//Home = Use
//




// Uncomment the following 4 lines to make the analog stick emulate WASD
A = (-1.2 < wiimote.Nunchuk.JoyX < -0.5)
D = (0.5 < wiimote.Nunchuk.JoyX < 1.2)
W = (-1.2 < wiimote.Nunchuk.JoyY < -0.5)
S = (0.5 < wiimote.Nunchuk.JoyY < 1.2)




debug = ("dot1x: " + wiimote.dot1x+ " dot1y: " +wiimote.dot1y + " dot2x: " +wiimote.dot2x + " dot2y: " + wiimote.dot2y +" var.x: " +var.x + " var.y: " +var.y + " rot: " + var.rot +" roll: " + var.roll + " mouse: " + mouse.DirectInputPos +" batt: " +wiimote.Battery)
Back to top
View user's profile Send private message AIM Address
kiddo7



Joined: 05 Feb 2007
Posts: 42

Digg It
PostPosted: Thu Mar 15, 2007 2:59 am    Post subject:

Ok, I have one question right of the bat, mind you I have not tried this script yet because i do not have a wii remote at the moment.
You said that

Z=crouch
B=Shoot
Z+B=punch

So my question is, Is it possible to crouch while shooting using your script?
I might be the only one but I distinctly remember doing that a lot while playing halo on my pc.
How about punching while crouching? Can't recall ever doing that but I think it is still a fair question.
Back to top
View user's profile Send private message
Leight



Joined: 30 Jan 2007
Posts: 16

Digg It
PostPosted: Thu Mar 15, 2007 7:21 pm    Post subject:

You can do both of those things.
Back to top
View user's profile Send private message AIM Address
kiddo7



Joined: 05 Feb 2007
Posts: 42

Digg It
PostPosted: Fri Mar 16, 2007 5:20 am    Post subject:

I hope you can forgive me for this because I know that Now I am becoming a pain in the ass.

Quote:
You can do both of those things.

How?
Back to top
View user's profile Send private message
Leight



Joined: 30 Jan 2007
Posts: 16

Digg It
PostPosted: Mon Mar 19, 2007 9:19 pm    Post subject:

kiddo7 wrote:
I hope you can forgive me for this because I know that Now I am becoming a pain in the ass.

Quote:
You can do both of those things.

How?


Uhh....

by pressing them at the same time ftw?
Back to top
View user's profile Send private message AIM Address
Sab0o



Joined: 31 Dec 2006
Posts: 10

Digg It
PostPosted: Sat Mar 24, 2007 12:43 pm    Post subject:

Wow, nice script, the turning at the edge of the screen needs to be a tad more sensitive though imo.

kiddo7 - No you can not crouch and shoot at the same time.
Back to top
View user's profile Send private message
SMKOUT333



Joined: 29 Mar 2007
Posts: 9

Digg It
PostPosted: Tue Apr 03, 2007 1:50 am    Post subject: Great script

this script is awesome, however turning could be improved through ir and compensation. I would do this myself, but dont know how to improve what you have already done, or if it can be improved further.
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