Head Swaying from damage

Discuss coding questions, pull requests, and implementation details.
User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Head Swaying from damage

Post by MeteoricDragon »

I've refined and adjusted the recoil formula with great smooth improvements, and in doing so I found out that whenever the playerObject is rotated about the x axis, it affects the object's position, and he starts moving back or forward some. If i rotate it about the y axis, no unwanted movement happens. I suspect it's the playermotor class trying to readjust the player, thinking he's supposed to slide.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Head Swaying from damage

Post by Interkarma »

There's no need to rotate the player object for this effect is there? You should just need to manipulate the camera transform. :)

R.D.
Posts: 379
Joined: Fri Oct 07, 2016 10:41 am

Re: Head Swaying from damage

Post by R.D. »

Al-Khwarizmi wrote: Wed Apr 04, 2018 6:13 pm Aren't there damage types in Daggerfall? (e.g. the thing that makes blunt weapons more damaging to skeletons). Couldn't that have an influence? Or does reverse engineering indicate that it's definitely just damage amount?
The latter. The only value passed to the function that sets the "head-shaking amount" is the damage amount.

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Head Swaying from damage

Post by MeteoricDragon »

Interkarma wrote: Thu Apr 05, 2018 4:16 am There's no need to rotate the player object for this effect is there? You should just need to manipulate the camera transform. :)
That worked!

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Head Swaying from damage

Post by MeteoricDragon »

The script is completely working now. It scales based on damage. It recoils on a random axis each time.

However, it's not configurable yet. I need to research how to put it in the pre-launch gameplay settings because I don't know which cs class has those settings. yet.

EDIT: I found the windows. And decided on using the Controls Section to store the value
Last edited by MeteoricDragon on Fri Apr 06, 2018 2:31 am, edited 1 time in total.

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Head Swaying from damage

Post by MeteoricDragon »

For some reason, I am getting several null reference exceptions.

They stop occuring if I comment out this line in SettingsManager:

Code: Select all

 CameraRecoil = GetBool(sectionControls, "CameraRecoil");
EDIT: it didn't have the default value in the defaults.ini file

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Head Swaying from damage

Post by MeteoricDragon »

First version has been submitted via PR.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Head Swaying from damage

Post by Interkarma »

Thanks for your work on this! I will check it out and merge as soon as I get a chance. Will let you know any feedback via comments on git.

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: Head Swaying from damage

Post by MeteoricDragon »

I notice that you are testing. Coincidentally I made a version with a slider in advanced settings (instead of tick mark in first page) where you can scale how severe the camera sways, with settings "Off, Low, Medium, High, and Very High" which scale the sway 0%, 25%, 50%, 75%, and 100% respectively.

If you launched a game with the first version I gave you, the settings.ini file will have CameraRecoil = True which will cause an exception when launching. can easily be fixed by setting CameraRecoil to a number from 0 to 4.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Head Swaying from damage

Post by Interkarma »

That sounds great! :)

If you remove the default setting from defaults.ini, it should be removed from the player's live settings.ini. This makes it possible to add and remove settings or change the name to force a new version type.

So instead of changing CameraRecoil setting from a bool to a float type setup, you can just change the name to something like CameraRecoilAmount (or whatever makes sense to you here as the creator). Then the old setting should sync out and the new setting take over in current code without an exception.

When you're done, send the changes to my "camera-recoil" branch. I won't merge this into master until you're done.

Post Reply