Jump to content

Recommended Posts

Hi to all who might read this thread, need some help here. Would be very grateful for it.

 

Here's the problem, trying to get the screen to shake in an onattack function when a "crit" procs. The function is in a weapon, not specific to the char.

Code is:

local CRITCHANCE = 1 -- should be math.random but 100 for now

- -

local function onattack(inst, owner, target)
	local health = target.components.health
          owner.components.sanity:DoDelta(2)
	if math.random() < CRITCHANCE then
		health:DoDelta(-999) -- absurd value to know legit kill
        owner.components.talker:Say("Crit!") -- proc success notif
		owner.components.playercontroller:ShakeAllCameras(CAMERASHAKE.VERTICAL,.5, .01, .05, owner, .01)
end
end

I think I'm doing ShakeAllCameras wrong? I just applied what I saw in another thread, forgive me if my application is entirely wrong. Also, was thinking of using groundpoundringfx component to add more of an "oomph" during the crit, any clues on how to do that?

Edited by SourNVitriol
  • Like 1

Oh my goodness I overdid it. I thought I had to specify the owner. It works now.

Thanks Warbucks, you didn't do nothing wrong.


Edited: Figured out secondary offtopic question in op about groundpoundfx.

Edited by SourNVitriol
  • Like 1

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...