Jump to content

Recommended Posts

Hey, I had an idea for a newspaper weapon mod I am developing.

I would like that if the weapon is wet (like with the blue bar around the item comes) that it loses durability more quickly (because paper breaks when it's wet.

But I really have no idea how to call a function like that or say that in LUA.

Is that even possible?

i think you can do something like;

--on attack function

if inst.components.moisture and inst.components.moisture:IsWet() and inst.components.finiteuses then
    inst.components.finiteuses:Use(1) -- uses 1 plus the normal use(which should be 1 too)
end

im not sure if that works for inventory items, so i'll give you this version as well

--on attack function

if inst.components.inventoryitemmoisture and inst.components.inventoryitemmoisture.iswet and inst.components.finiteuses then
    inst.components.finiteuses:Use(1) -- uses 1 plus the normal use(which should be 1 too)
end

 

btw.. why do you always name your thread "unique" or "interesting" xD

Edited by Aquaterion

 

23 minutes ago, Aquaterion said:

i think you can do something like;


--on attack function

if inst.components.moisture and inst.components.moisture:IsWet() and inst.components.finiteuses then
    inst.components.finiteuses:Use(1) -- uses 1 plus the normal use(which should be 1 too)
end

im not sure if that works for inventory items, so i'll give you this version as well


--on attack function

if inst.components.inventoryitemmoisture and inst.components.inventoryitemmoisture.iswet and inst.components.finiteuses then
    inst.components.finiteuses:Use(1) -- uses 1 plus the normal use(which should be 1 too)
end

 

btw.. why do you always name your thread "unique" or "interesting" xD

Thanks to you both! I will try that!

And I only name them unique or interesting so someone will help me faster if I am really honest. XD

And to DarkXero you are a REALLY awesome guy.

You've helped me and other new/small modders so much in the past.

I just thought someone should say that :D

Edited by Eremus007

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