HOOK:void OnPlayerAttack(BasePlayer attacker, HitInfo info)
ItemDefinition itemDefinition = info.Weapon.GetEntity().GetComponent<BaseProjectile>()?.primaryMagazine.ammoType;
I need to get the Item Class for ammo...
HOOK:void OnPlayerAttack(BasePlayer attacker, HitInfo info)
ItemDefinition itemDefinition = info.Weapon.GetEntity().GetComponent<BaseProjectile>()?.primaryMagazine.ammoType;
I need to get the Item Class for ammo...
What original problem are you trying to solve? If you want to know what type of ammo was used, you can check the item id or short name of the item definition.
I need to modify the properties of each bullet ...
1. Generate special bullets (eg: frozen bullets)
2. Equipment: Freeze Bullet
3. Hook OnPlayerAttack() .. Determine bullets type and execute Effect ..
so I don't know how to get bullet type。。。
A common approach for this sort of thing is to upload any random skin to workshop (even a t shirt) with a custom icon (there are YouTube tutorials for this) that looks like your freeze bullet. Then use a plugin to give players ammo with that skin id. Then check item.skin to determine if it's a "freeze bullet" based on whether the skin matches that number.
Yes But I can only get ItemDefinition ... This Class none skin() function ...
Ah, right. Come to think of it, I think I've seen this question before, but I don't recall how people solved it. There are some things you can try off the top of my head.
yes,Thank you for your patience to help me with the answer
I tried to add it ItemMod , but All of the itemDefinitions change accordingly 。。。
I implemented it in a different way,Replace consumption with other items ,It's like a magic item,is besuccessful。