local regenCondition = Condition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
regenCondition:setParameter(CONDITION_PARAM_HEALTHGAIN, 50) -- amount
regenCondition:setParameter(CONDITION_PARAM_HEALTHTICKS, 1000) -- ms
regenCondition:setParameter(CONDITION_PARAM_MANAGAIN, 50)
regenCondition:setParameter(CONDITION_PARAM_MANATICKS, 1000)
regenCondition:setTicks(-1) -- -1 means infinite time
player:addCondition(regenCondition) -- put wherever you wanna trigger it
if youre hungry it does not work because its condition regeneration.LUA:local regenCondition = Condition(CONDITION_REGENERATION, CONDITIONID_DEFAULT) regenCondition:setParameter(CONDITION_PARAM_HEALTHGAIN, 50) -- amount regenCondition:setParameter(CONDITION_PARAM_HEALTHTICKS, 1000) -- ms regenCondition:setParameter(CONDITION_PARAM_MANAGAIN, 50) regenCondition:setParameter(CONDITION_PARAM_MANATICKS, 1000) regenCondition:setTicks(-1) -- -1 means infinite time
LUA:player:addCondition(regenCondition) -- put wherever you wanna trigger it
local regenCondition = Condition(CONDITION_REGENERATION)
regenCondition:setParameter(CONDITION_PARAM_HEALTHGAIN, 50) -- amount
regenCondition:setParameter(CONDITION_PARAM_HEALTHTICKS, 1000) -- ms
regenCondition:setParameter(CONDITION_PARAM_MANAGAIN, 50)
regenCondition:setParameter(CONDITION_PARAM_MANATICKS, 1000)
regenCondition:setParameter(CONDITION_PARAM_SUBID, 789)
regenCondition:setParameter(CONDITION_PARAM_TICKS, -1)
AddingregenCondition:setParameter(CONDITION_PARAM_SUBID, 789)
subId
should make it not overwrite normal regeneration condition.Your problem should be solved with code above.I cant believe how useless this game engine is and how limited the developers were inside of their head
It's not the solution that is invalid, the solution you have in this thread is correct, just seems that you don't know how to use it, which is perfectly fine, nobody started with all the knowledge, just learned it over time. But being that rude won't help you...it resets regeneration time (e.g food to -1) aka 0 so its invalid solution sorry
I cant believe how useless this game engine is and how limited the developers were inside of their head never thinking this or that could potentially be used in different way. they really went by the book.
local regenCondition = Condition(CONDITION_REGENERATION)
regenCondition:setParameter(CONDITION_PARAM_SUBID, 2789)
regenCondition:setParameter(CONDITION_PARAM_TICKS, -1)
regenCondition:setParameter(CONDITION_PARAM_HEALTHGAIN, 1)
regenCondition:setParameter(CONDITION_PARAM_HEALTHTICKS, 1000)
regenCondition:setParameter(CONDITION_PARAM_MANAGAIN, 1)
regenCondition:setParameter(CONDITION_PARAM_MANATICKS, 1000)
if not player:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT, 2789) then
player:addCondition(regenCondition)
end
for real though why is there no solid documentations but we refer for any request to this forum it be much easier if everything was explained on the wiki yet nobody is putting in the work. especially half the stuff could be just links instead of actual wiki on the wiki to otland so it be easier to find the tutorials and have peoples feedback comments etc.
maybe even a board on the forum called Documentation and would fill as we go?
the basics are not explained and if they are you get "lua tutorial" nobody needs that anymore we just need solid basics explained and how stuff works to give an edge to the new guys comming in and doing the work ^.^ there is too big of skill gap with it all between newbs and pros and the pros are too busy irl to play with it while the new guys cant work it out.]
ps. it works now but when I added subid 2 days ago It did not.
I ment for lua / revscripts and all type stuff not to how to run a linux machine for dumbs this "OTS Guide" barely even explains 10% of the functions inside lua.
yeah I was working on the revscript version, but like I said... no one even used it anywaysI ment for lua / revscripts and all type stuff not to how to run a linux machine for dumbs this "OTS Guide" barely even explains 10% of the functions inside lua.
maybe because its so hard to find. I did not ever seen the top bar of the site other than my account and notifications because it does not stand out in any way its same color as footer and the center div has everything for browsing /searching maybe adding Emojis likeyeah I was working on the revscript version, but like I said... no one even used it anyways
I doubt that the problem is the lack of docu or difficult to find tutorial. Nowadays reading and slowly chasing the goal is just not comfortable, not as much as getting the answer quickly, just like that. People prefer to get their answet quickly, without an effort of reading and understanding and putting more effort into it. Obviously, I'm generalising, does not apply to everyone, but I can suppose it is true with huge part of many communities, not only here.maybe because its so hard to find. I did not ever seen the top bar of the site other than my account and notifications because it does not stand out in any way its same color as footer and the center div has everything for browsing /searching maybe adding Emojis likebeside ot guide would get some magic going remember people are visual monkeys
![]()
Id do
Whats New Newspaper emoji
Resources A Letter or Paper blank
Members of course human emoji
Github emm Github emoji? custom ico?
Tools Wrench
Ots Guide Gear wheel
Lua guide magnifying glass? (since we do c++ functions via lua so its kind of like magnifying functions)
Rules !
it would definately start catching an eye for a user.
If you bothered to read the comment in the example code, I explicitly explained how there was a change in the variable name to demonstrate that you can name them whatever you like... its not "DEPRACATED".also reference to itemEx while we are using target nowadays DEPRACATED
proves my point this game engine could actually bring a lot more people if we invested into teaching people tutorials and generalizing 2d rpg game tag on youtube.
maybe a lot of people would decide to use this instead of rpg makerand maybe we would get a lot more games innit
![]()
if (Player* player = creature->getPlayer()) {
if (getSubId() <= 200) {
int32_t getTotalHealthGain() const {
int32_t totalHealthGain = vocation ? vocation->getHealthGainAmount() : 0;
// Add charm bonus
int32_t charmValue = 0;
//storage representing charm or some skill
if (getStorageValue(656006, charmValue) && charmValue > 0) {
totalHealthGain += charmValue;
}
// Add fish event bonus
int32_t fishevent_status = 0;
//storage set to player on login if the world event i son
if (getStorageValue(8100026, fishevent_status) && fishevent_status > 0) {
totalHealthGain += fishevent_status;
}
return totalHealthGain;
}
int32_t getTotalHealthTicks() const {
return vocation ? vocation->getHealthGainTicks() * 1000 : 12000;
}
int32_t getTotalManaGain() const {
return vocation ? vocation->getManaGainAmount() : 1;
}
int32_t getTotalManaTicks() const {
return vocation ? vocation->getManaGainTicks() * 1000 : 12000;
}
void Player::updateRegeneration() {
if (!vocation) {
return;
}
Condition* condition = getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT);
if (condition) {
condition->setParam(CONDITION_PARAM_HEALTHGAIN, getTotalHealthGain());
condition->setParam(CONDITION_PARAM_HEALTHTICKS, getTotalHealthTicks());
condition->setParam(CONDITION_PARAM_MANAGAIN, getTotalManaGain());
condition->setParam(CONDITION_PARAM_MANATICKS, getTotalManaTicks());
}
}