Skip to content
User Avatar
#3426
Auto-translated
Following the logic, it is very easy to write such a function.
function AddPlayerResource(pl, res, delta)
if GetPlayerResource(pl, res)+delta>=0 then
SetPlayerResource(pl, res, GetPlayerResource(pl, res)+delta)
else _ERRORMESSAGE("Resource quantity cannot be negative!")
end
end

In principle, you can write every time: set the resource to CurrentResourceAmount+Addition. This is obvious. But it is better to wrap it up and make it short: AddPlayerResource(1, GOLD, -5000)

There is also a function AddResource("HeroName", ResourceID, Delta)
Simulates a hero picking up a resource; the delta will be added to the current amount, and a message with an icon and the amount received will be displayed from the hero.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________