Jump to content

[HELP] How to make something unarmed specific?


ace43609

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...