Jump to content

Recommended Posts

I am trying to give my character special abilities only when they are unarmed (nothing equipped)

I have no idea how to specifically make it work though.

I have the ability working normally (among other restrictions to it like a sanity minimum) just need it to ONLY work with nothing in-hand.

 

I was thinking something along the lines of-

 

      If not (whatever goes here that involves having something equipped) then

           DisableHunt(inst)

           return

      end

 

I'm still kind of new at this stuff so any advice or tips are helpful and greatly appreciated.

If you check for inst.components.inventory.equipslots[EQUIPSLOTS.HANDS] it should work (BODY and HEAD work for the respective slots). So you'd have something like this:

 

local function Update(inst)

  If inst.components.inventory.equipslots[EQUIPSLOTS.HANDS] then

    EnableHunt(inst)

  else

    DisableHunt(inst)

  end

end

 

The concept you posted above (besides requiring a condition) needs to be checked regularly. Whilst there is a way to do that EDIT:regularly, you should rather try to use the event system. All you need to do in your case is to write the following two lines (in the part where "special powers" belong to):

 

inst:ListenForEvent("onequip",Update)

inst:ListenForEvent("onunequip",Update)

Edited by Mobbstar

Thank you so much, you are a beautiful person!

The thing I am trying to implement is a sanity based (because I am not experienced enough to make a meter for it) "invisibility" with a crit on out-of-stealth hits.

And I want the character's focus to be around combat using its "claws" and not any other weapons so you really helped a ton.

Thanks again, beautiful stranger!

Edited by ace43609

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