360 controller free look.

Go down

360 controller free look. Empty 360 controller free look.

Post by JonZom on Mon 16 Sep 2013, 06:29

This is for use with 360 type controllers. I don't know if anyone uses the 360 controller for Dragon Rising but I do. This GlovePie script enables you to look about while driving or as a passenger using the right stick on a 360 controller. I used ThePhantomMenace's GlovePie script as a point of reference and you will also need Templar GFX's Unrestricted camera mod so a big thanks to those two guys. The script has worked in every campaign, map and vehicle I have tried but there could be bugs. I apologies if this has been done before but I couldn't find anything on the net regarding the 360 controller free look.

1: Unpack this file and then install the folder into the OF Dragon Rising root folder.

http://www.mediafire.com/download/nwtqzyy0jqz/Island+War+2-0+Unrestricted+Freelook+Mod+%28for+1-00%29.zip

2: Download GlovePie. I used version 0.45 free version

3: Run GlovePie and copy and paste this script into it. Change the two resolution lines to you game resolution.
Code:
//Aiming - Moving Control - Right Stick -
Pie.MouseDPI = 800 //Insert Your Mouse DPI if you know it
If Xinput1.LeftThumb then
Fakemouse.DirectInputX        =  Var.DirectInputXOutput
Fakemouse.DirectInputY        =  Var.DirectInputYOutput
 
Mouse.LeftButton              =  XInput.RightTrigger
Mouse.RightButton             =  XInput.LeftTrigger
 

Delta(Var.DirectInputXOutput) =  Delta(Var.DirectInputXInput)
Delta(Var.DirectInputYOutput) =  Delta(Var.DirectInputYInput)
}
 
If (DeadZone(( XInput.RightStickX), Var.DeadzoneAmount) <> 0 or DeadZone(( XInput.RightStickY), Var.DeadzoneAmount) <> 0) {
Delta(Var.DirectInputXInput)  =  DeadZone(( XInput.RightStickX * Var.NormalSpeed), Var.DeadzoneAmount)
Delta(Var.DirectInputYInput)  =  DeadZone((-XInput.RightStickY * Var.NormalSpeed), Var.DeadzoneAmount)
}
 
//Settings:
Var.SlowSpeed                 =  50%
Var.NormalSpeed               =  1000%
Var.DeadzoneAmount            =  13% //Recomended above 5%
//If it starts drifting, try turning the deadzone up some.
end if
 
 
 
var.resx = 1360 //horizontal resolution in game
var.resy = 768  //vertical resolution in game
var.centre = 1  //0 = do not recentre view 1 = centre view
if key.LeftAlt then
  if var.freelook == 0
    if var.firststep == 0  then //this centres the mouse on the first frame
      mouse.CursorPosX = var.resx/2
      mouse.CursorPosY = var.resy/2
      var.firststep = 1
    end if
    var.freelook = 1
  else
    var.freelook = 0
  end if
  wait 500ms
end if

  FakeTrackIR.yaw = MapRange(mouse.CursorPosX, 0, var.resx,-65,65)
  FakeTrackIR.pitch = MapRange(mouse.CursorPosY, 0, var.resy,60,-60)
end if



4: Run the Script and start Dragon Rising.

To use the the free look press Left Alt to enable free look and play your game. Once you enter a vehicle click left stick and hold it down while moving the right stick to look about. Not to useful at high speeds but slower speeds it enables you to assess your surroundings without leaving the vehicle. Tested on 1.0 version of Dragon Rising. I am going to try and make it so if you click the left stick once it will centre the view if I can work out how to do it. If anyone knows how give it a shot.

JonZom

Points : 12
Reputation : 3
Join date : 2013-09-15

Back to top Go down

360 controller free look. Empty Re: 360 controller free look.

Post by ThePhantomMenace on Mon 16 Sep 2013, 13:44

Very well done!!  I've thought many times of making this script for the 360 controller.  Nice shot!!

Cheers Very Happy

ThePhantomMenace

Points : 31
Reputation : 8
Join date : 2013-05-20

Back to top Go down

360 controller free look. Empty Re: 360 controller free look.

Post by JoeDogs on Mon 16 Sep 2013, 14:02

Not working for  2.0 version hm?

JoeDogs
Veteran

Location : Norway
Points : 245
Reputation : 11
Join date : 2012-12-26
Age : 54

http://tomneidher.blogspot.no/

Back to top Go down

360 controller free look. Empty Re: 360 controller free look.

Post by ThePhantomMenace on Mon 16 Sep 2013, 17:30

JoeDogs wrote:Not working for  2.0 version hm?
Should work for the 1.2 acid version unless the non english operating system thing is going on.  Are you able to get the freelook mod working with the mouse??  If so, you shouldn't have to do anything different except run this script in glove pie.

Cheers Very Happy

ThePhantomMenace

Points : 31
Reputation : 8
Join date : 2013-05-20

Back to top Go down

360 controller free look. Empty Re: 360 controller free look.

Post by TheGeneral on Mon 16 Sep 2013, 18:01

Good work JonZom! glad this has been a new breakthrough for us all.

Thansk for contributing! voted you up a point!

Wink 

MD


tvig0r0us wrote:Thanks to everyone that has supported and stuck with OFDR along the way. It is a great game and is largely under appreciated, but those of us that love it are happy to have others to enjoy it with.

tvig


360 controller free look. Nst_md15
TheGeneral
TheGeneral
Admin

Points : 780
Reputation : 35
Join date : 2012-12-15

http://maniacaldog.wix.com/keepdralive

Back to top Go down

360 controller free look. Empty Re: 360 controller free look.

Post by JonZom on Mon 16 Sep 2013, 20:24

Cheers guys. Sorry to hear that JoeDogs I don't know really what to tell you at the moment but I will keep on working on it. As I say I have only tested it on 1.0 so far and I am a complete novice with the PC version of Dragon Rising.

I have found a small but annoying bug on further testing. It is a strange one. It doesn't happen very often but on occasions when exiting a vehicle after a spectacular crash your gun will go off automatically until you press left stick. I am looking into it. The work around Is to press the left stick as you exit the vehicle just in case. If anyone knows how to code GlovePie feel free to help out as I am no expert. It would be nice to implement Left click Centre view.

JonZom

Points : 12
Reputation : 3
Join date : 2013-09-15

Back to top Go down

360 controller free look. Empty Re: 360 controller free look.

Post by JoeDogs on Wed 18 Sep 2013, 18:40

Hope you get this working. Appreciate your work:D

JoeDogs
Veteran

Location : Norway
Points : 245
Reputation : 11
Join date : 2012-12-26
Age : 54

http://tomneidher.blogspot.no/

Back to top Go down

360 controller free look. Empty Re: 360 controller free look.

Post by ThePhantomMenace on Thu 26 Sep 2013, 01:55

OK, here it is.  JonZom, I looked over your script and made some changes.  This is tested and fully working.  The original script is by TemplarGFX, modified by me to work as a toggle with a mouse.  The input and deadzone script is by JonZom and final adjustments and tweaks by me.  If you were able to use free-look with a mouse, then you will also be able to use it with a 360 controller and this script.  As with the mouse version you may need to change var.resx and var.resy to match your screen resolution.

Code:

//Aiming - Moving Control - Right Stick -
//Settings:
var.speed = 10
var.DeadzoneAmount = .15 //Recomended above .05
var.resx = 1600 //horizontal resolution in game
var.resy = 900  //vertical resolution in game
var.centre = 1  //0 = do not recentre view 1 = centre view
//If it starts drifting, try turning the deadzone up some.
If (DeadZone(( XInput.RightStickX), var.DeadzoneAmount) <> 0 or DeadZone(( XInput.RightStickY), var.DeadzoneAmount) <> 0) then
   Delta(var.DirectInputXInput)  =  DeadZone(( XInput.RightStickX * var.speed), var.DeadzoneAmount)
   Delta(var.DirectInputYInput)  =  DeadZone((-XInput.RightStickY * var.speed), var.DeadzoneAmount)
endif
if key.LeftAlt then
  if var.freelook == 0
    if var.firststep == 0  then //this centres the mouse on the first frame
      var.DirectInputXInput = var.resx/2
      var.DirectInputYInput = var.resy/2
      var.firststep = 1
    end if
    var.freelook = 1
  else
    var.freelook = 0
  end if
  wait 500ms
end if
if var.freelook == 0 then
  if var.centre == 1 then //recenters trackir
    if FakeTrackIR.yaw > 0 then
      FakeTrackIR.yaw = FakeTrackIR.yaw - ((FakeTrackIR.yaw/10)+0.1)
      if FakeTrackIR.yaw < 0 then
        FakeTrackIR.yaw = 0
      end if
    end if
    if FakeTrackIR.yaw < 0 then
      FakeTrackIR.yaw = FakeTrackIR.yaw - ((FakeTrackIR.yaw/10)-0.1)
      if FakeTrackIR.yaw > 0 then
        FakeTrackIR.yaw = 0
      end if
    end if
    if FakeTrackIR.pitch > 0 then
      FakeTrackIR.pitch = FakeTrackIR.pitch - ((FakeTrackIR.pitch/10)+0.1)
      if FakeTrackIR.pitch < 0 then
        FakeTrackIR.pitch = 0
      end if
    end if
    if FakeTrackIR.pitch < 0 then
      FakeTrackIR.pitch = FakeTrackIR.pitch - ((FakeTrackIR.pitch/10)-0.1)
      if FakeTrackIR.pitch > 0 then
        FakeTrackIR.pitch = 0
      end if
    end if
  end if
  var.firststep = 0
else  //the following converts the stick to trackir data
  FakeTrackIR.yaw = MapRange(var.DirectInputXInput, 0, var.resx,-65,65)
  FakeTrackIR.pitch = MapRange(var.DirectInputYInput, 0, var.resy,60,-60)
end if
Since you have to remove the line numbers from the script to make it work I've uploaded a text file to Media Fire containing the script here.

Enjoy!

Cheers Very Happy

ThePhantomMenace

Points : 31
Reputation : 8
Join date : 2013-05-20

Back to top Go down

360 controller free look. Empty Re: 360 controller free look.

Post by ThePhantomMenace on Sun 29 Sep 2013, 18:16

I made some changes to the script.  Added left stick press activates and deactivates the freelook now so no need to touch the keyboard.  It also centers the view.  I also added limitations to the freelook scope so you can't twist your head off with it.  The only trouble is that if it's active when you get into a vehicle you may be looking in some strange direction.  Just press the left stick to center your view again.

Code:

//Aiming - Moving Control - Right Stick -

//Settings:
var.speed = 8
var.DeadzoneAmount = .15 //Recomended above .05
var.resx = 1600 //horizontal resolution in game
var.resy = 900  //vertical resolution in game
var.centre = 1  //0 = do not recentre view 1 = centre view
//If it starts drifting, try turning the deadzone up some.

If (DeadZone(( XInput1.Joy2X), var.DeadzoneAmount) <> 0 or DeadZone(( XInput1.Joy2Y), var.DeadzoneAmount) <> 0) then
  Delta(var.DirectInputX)  =  DeadZone(( XInput1.Joy2X * var.speed), var.DeadzoneAmount)
  Delta(var.DirectInputY)  =  DeadZone((-XInput1.Joy2Y * var.speed), var.DeadzoneAmount)
endif

if xinput.LeftThumb then
  if var.freelook == 0
    if var.firststep == 0  then //this centres the mouse on the first frame
      var.DirectInputX = var.resx/2
      var.DirectInputY = var.resy/2
      var.firststep = 1
    endif
    var.freelook = 1
  else
    var.freelook = 0
  endif
  wait 500ms
endif

if var.freelook == 0 then
  if var.centre == 1 then //recenters trackir
    if FakeTrackIR.yaw > 0 then
      FakeTrackIR.yaw = FakeTrackIR.yaw - ((FakeTrackIR.yaw/10)+0.1)
      if FakeTrackIR.yaw < 0 then
        FakeTrackIR.yaw = 0
      endif
    endif
    if FakeTrackIR.yaw < 0 then
      FakeTrackIR.yaw = FakeTrackIR.yaw - ((FakeTrackIR.yaw/10)-0.1)
      if FakeTrackIR.yaw > 0 then
        FakeTrackIR.yaw = 0
      endif
    endif
    if FakeTrackIR.pitch > 0 then
      FakeTrackIR.pitch = FakeTrackIR.pitch - ((FakeTrackIR.pitch/10)+0.1)
      if FakeTrackIR.pitch < 0 then
        FakeTrackIR.pitch = 0
      endif
    endif
    if FakeTrackIR.pitch < 0 then
      FakeTrackIR.pitch = FakeTrackIR.pitch - ((FakeTrackIR.pitch/10)-0.1)
      if FakeTrackIR.pitch > 0 then
        FakeTrackIR.pitch = 0
      endif
    endif
  endif
  var.firststep = 0
else  //the following converts the stick to trackir data
  if var.DirectInputX < 0 then
    var.DirectInputX = 0
  elseif var.DirectInputX > var.resx then
    var.DirectInputX = var.resx
  endif
  if var.DirectInputY < 0 then
    var.DirectInputY = 0
  elseif var.DirectInputY > var.resx then
    var.DirectInputY = var.resx
  endif
  FakeTrackIR.yaw = MapRange(var.DirectInputX, 0, var.resx,-65,65)
  FakeTrackIR.pitch = MapRange(var.DirectInputY, 0, var.resy,60,-60)
endif
Enjoy!

Cheers Very Happy

ThePhantomMenace

Points : 31
Reputation : 8
Join date : 2013-05-20

Back to top Go down

360 controller free look. Empty Re: 360 controller free look.

Post by TheGeneral on Mon 30 Sep 2013, 11:05

Excellent work phantom! Voted you two points there for your work. Keep it up mate:D ! 

Does this only work in vehicles or can work whilst on foot?


tvig0r0us wrote:Thanks to everyone that has supported and stuck with OFDR along the way. It is a great game and is largely under appreciated, but those of us that love it are happy to have others to enjoy it with.

tvig


360 controller free look. Nst_md15
TheGeneral
TheGeneral
Admin

Points : 780
Reputation : 35
Join date : 2012-12-15

http://maniacaldog.wix.com/keepdralive

Back to top Go down

360 controller free look. Empty Re: 360 controller free look.

Post by ThePhantomMenace on Mon 30 Sep 2013, 12:48

Thanks Mdog!  It only works in vehicles.  I don't know if there's any way to get a freelook going on foot, but that would be interesting too.  Since the right stick is tied into the cyclic and rotor it's not very good to use in a helicopter, but then again, the mouse freelook wasn't all that great in helicopters either.

Cheers Very Happy

ThePhantomMenace

Points : 31
Reputation : 8
Join date : 2013-05-20

Back to top Go down

360 controller free look. Empty Re: 360 controller free look.

Post by JonZom on Mon 30 Sep 2013, 18:42

Good work Phantom but the helicopter controls was one of the reasons I made it so you had to hold left stick down while using the Right stick to look round so it doesn't interfere with the helicopter controls as it uses the right stick to hover up and down, Left and Right. Good work getting the centre view working. Good to have choices anyway. I shall try it. Cheers.

On another note I could not get any of these scripts working on 1.2 or 1.3. It must be down to the TemplarGFX mod only being for 1.0 or have you got it to work with 1.2? I used the Acidx patch to no avail.

JonZom

Points : 12
Reputation : 3
Join date : 2013-09-15

Back to top Go down

360 controller free look. Empty Re: 360 controller free look.

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum