Jump to content

Recommended Posts

Hello, if someone can help me out with this that'd be great :)!

So, my character has a perk to "focus" and when this is happening I want that the player can zoom into "10" distance instead of default "15" min distance of followcamera.lua, and make the max zoomout halved so "25" instead of "50", would something like this be possible and if it is maybe someone knows how to do it?

If that's not possible is there just a way to change followcamera.lua is minimum distance to 10 instead of 15? Thanks for reading :wilson_smile:!

Edited by SuperDavid

There seems to be a few client_only mods that affect the camera: http://steamcommunity.com/sharedfiles/filedetails/?id=1161850231

This one in particular allows for a larger zoomout distance, I am sure that somebody could adapt the code for a custom character.

Hopefully somebody with more experience with this can give us some pointers.

Cheers,

Iron_Hunter

 

Hi there, I'm curious that when your character is in "focus", would the rest of the world slow down while only your character acts at normal speed by any chance? Because I wanted to give my character this feature but was terrified at the thought of the complexity of the code.

23 hours ago, nicknightyx said:

Hi there, I'm curious that when your character is in "focus", would the rest of the world slow down while only your character acts at normal speed by any chance? Because I wanted to give my character this feature but was terrified at the thought of the complexity of the code.

No, sorry and yeah that does seem like it would be a really complex thing to do, sorry I don't know how to help out :wilson_dorky:!

Hang in there, we talked in private about this. This is what I got to share for anybody else interested.

Spoiler

AddClassPostConstruct("cameras/followcamera", function(self)
	local oldZoomIn = self.ZoomIn
	self.ZoomIn = function(self)
		local focalpointparent = self.target and self.target.entity:GetParent() or nil
		if focalpointparent:HasTag("sneaking") then
			local MINDIST = focalpointparent:HasTag("sneaking") and 10 or self.mindist
			self.distancetarget = math.max(MINDIST, self.distancetarget - self.zoomstep)
			self.time_since_zoom = 0
		else
			return oldZoomIn(self)--the intention is to provide better compatibility with other camera mods if they modify this class properly.
		end
	end
	local oldZoomOut = self.ZoomOut
    self.ZoomOut = function(self)
		local focalpointparent = self.target and self.target.entity:GetParent() or nil
		if focalpointparent:HasTag("sneaking") then
			local MAXDIST = focalpointparent:HasTag("sneaking") and 25 or self.maxdist
			self.distancetarget = math.min(MAXDIST, self.distancetarget + self.zoomstep)
			self.time_since_zoom = 0
		else
			return oldZoomOut(self)--the intention is to provide better compatibility with other camera mods if they modify this class properly.
			--I am pretty certain the client side camera mods will overide this as I don't think they were built with compatibility in mind.
		end
    end
end)

 

Tested on a caves enabled server by myself. I haven't been able to test it with multiple players, but it works as you described.

Cheers,

Iron_Hunter

Edited by IronHunter
Retested and fixed using tags instead of inst.variables.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...