Jump to content

Recommended Posts

How exactly do you make configuration options for damage sources? What do I fill in here in modmain at the ??? (I already set config name to "damage")

local ??? = GetModConfigData("damage")

And then what kind of function would I put in the actual script for the damage?

8 hours ago, JaccK1618 said:

How exactly do you make configuration options for damage sources? What do I fill in here in modmain at the ??? (I already set config name to "damage")

local ??? = GetModConfigData("damage")

And then what kind of function would I put in the actual script for the damage?

You can use TUNING
In modmain

TUNING.WP_DAMAGE = GetModConfigData("damage")


In Weapon

inst.components.weapon:SetDamage(TUNING.WP_DAMAGE )

 

10 hours ago, Haruhi Kawaii said:

You can use TUNING
In modmain

TUNING.WP_DAMAGE = GetModConfigData("damage")


In Weapon

inst.components.weapon:SetDamage(TUNING.WP_DAMAGE )

 

Alright it looks like when I try in game it says the "SetDamage" is a "nil value"

I'm using this script for the damage

    inst:AddComponent("combat")
    inst.components.combat:SetDamage(TUNING.WP_DAMAGE)
 

  • Like 1

I've gotta ask a little: Are you doing this for an item's damage, or a character's damage?

Combat component is for characters, Weapon component is, well, for weapons.

also, that function does not exist; use ...combat:SetDefaultDamage(number) instead of ...combat:SetDamage().
(edit: it exists on weapon, but not combat component.)

Edited by Baguettes

For the combat component, you need to use:

inst:AddComponent("combat")
inst.components.combat:SetDefaultDamage(TUNING.WP_DAMAGE)

Alternatively, you could also set it using a multiplier:

inst:AddComponent("combat")
inst.components.combat:SetDefaultDamage(1000)
inst.components.combat.damagemultiplier = TUNING.WP_DAMAGEMULTIPLIER

Furthermore, you might want it not to be lethal to players:

inst:AddComponent("combat")
inst.components.combat:SetDefaultDamage(TUNING.WP_DAMAGE)
inst.components.combat.playerdamagepercent = 0.1

 

20 hours ago, Baguettes said:

I've gotta ask a little: Are you doing this for an item's damage, or a character's damage?

Combat component is for characters, Weapon component is, well, for weapons.

also, that function does not exist; use ...combat:SetDefaultDamage(number) instead of ...combat:SetDamage().
(edit: it exists on weapon, but not combat component.)

I'm not actually sure if it's either, but the original script used "combat" so I'm assuming its for character. If that's the case, is "WP_DAMAGE" correct if it's not a weapon?

Ok so it's not crashing anymore but now it does not deal any damage. The script doesn't indicate it's for a weapon so is "WP_DAMAGE" even right for this?

On 9/9/2024 at 1:15 AM, JaccK1618 said:

I'm not actually sure if it's either, but the original script used "combat" so I'm assuming its for character. If that's the case, is "WP_DAMAGE" correct if it's not a weapon?

Ok so it's not crashing anymore but now it does not deal any damage. The script doesn't indicate it's for a weapon so is "WP_DAMAGE" even right for this?

WP_DAMAGE is just an example, you can use another name, it must be unique, avoid overlapping with other names
If you use TUNING.WP_DAMAGE, try the in-game console and paste this

print(TUNING.WP_DAMAGE)


if your configuration is correct you will see the value of TUNING.WP_DAMAGE, attach your code here if it still doesn't work

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