Sign in to follow this  
EduardoAbarca

Weapon damage based on its current durability

Recommended Posts

Hello, everyone! 

I was trying to make this mod where the weapon damage is based on its current durability, but it doesn't actually calculate the current durability, but the starting one, so I don't know what am I doing wrong. 

    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(20)
    inst.components.finiteuses:SetUses(20)
    inst.components.finiteuses:SetOnFinished(inst.Remove)
    
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(inst.components.finiteuses.current * 1.5 + 30)

Any guesses?

Share this post


Link to post
Share on other sites
7 hours ago, penguin0616 said:

@EduardoAbarca I suggest you take a look at the Hambat, since it does pretty much exactly what you're trying to do.

That being said, that's because you don't have it check the current, only the starting.

I tried looking into it, but I don't understand much of coding. Would you mind explaining how to check it?

Share this post


Link to post
Share on other sites
penguin0616    1101

#1: Figure out what the durability change event name is

#2: Listen for the event on your instance

#3: Apply your formula when the event triggers

#4: Set damage to freshly calculated number

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

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
Sign in to follow this