Jump to content

Set a key to be held?


Pfctink
 Share

Recommended Posts

I found a crouch script on this forum, but you have you press C to toggle it on and off. If I could get a way to make it non-toggle, that would be good. I set the script to use Control though.

 

if window:KeyHit(Key.ControlKey) then

crouched = not crouched

end

 

self.entity:SetInput(self.camRotation.y, playerMovement.z, playerMovement.x, jump , crouched, 1.0, 0.5, true)

 

if self.entity:GetCrouched() then

self.camera:SetPosition(self.entity:GetPosition()+Vec3(0,1,0))

else

self.camera:SetPosition(self.entity:GetPosition()+Vec3(0,2,0))

end

 

-- Needs to be KeyDown instead of KeyHit. I figured it out.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...