Michcol94
Member
- Joined
- Sep 2, 2021
- Messages
- 105
- Reaction score
- 18
Hello. I created a ranged "bullet" weapon without ammunition, everything is beautiful, but how to set the accuracy of the weapon so that it is always 100% on target. Can you do it in Lua ? Do I need to change the source code? Please help I strongly care that the accuracy was 100%.
action/ball.lua
items.xml
action/ball.lua
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if target and target:isCreature() then
local damage = math.random(10,50) -- możesz dostosować minimalne i maksymalne obrażenia
target:addHealth(-damage)
return true
end
return false
end
XML:
<item id="12662" article="a" name="ball" plural="balls">
<attribute key="weight" value="500" />
<attribute key="slotType" value="two-handed" />
<attribute key="weaponType" value="distance" />
<attribute key="attack" value="50" />
<attribute key="range" value="7" />
<attribute key="shoottype" value="ball" />
</item>