Togu
Advanced OT User
Im thinking on give a try to make that.
I've seen that OTClient has lua calls for almost everything, for example, on skill window module:
The client connects the localPlayer to the server and receives a message when "experience changes", "level changes", and etc:
Then he calls in the same script the function that handle that information:
So, I guess that rather than using localPlayer position to render localPlayer on screen, I can get playerCasting position and render on any screen everything related to him, am I right?
I'm gonna try it and I need some tips. If I manage to make that I'll release for free anyway
I've seen that OTClient has lua calls for almost everything, for example, on skill window module:
Code:
connect(LocalPlayer, {
onExperienceChange = onExperienceChange,
onLevelChange = onLevelChange,
onHealthChange = onHealthChange,
onManaChange = onManaChange,
onSoulChange = onSoulChange,
onSkillPointsChange = onSkillPointsChange,
onFreeCapacityChange = onFreeCapacityChange,
onTotalCapacityChange = onTotalCapacityChange,
onSpeedChange = onSpeedChange,
onBaseSpeedChange = onBaseSpeedChange,
onAttackSpeedChange = onAttackSpeedChange,
onStaminaChange = onStaminaChange,
onRegenerationChange = onRegenerationChange,
onBaseMagicLevelChange = onBaseMagicLevelChange,
onMagicLevelChange = onMagicLevelChange,
onNewBaseMagicLevelChange = onNewBaseMagicLevelChange,
onBaseSkillChange = onBaseSkillChange,
onSkillChange = onSkillChange,
onNewBaseSkillChange = onNewBaseSkillChange,
})
The client connects the localPlayer to the server and receives a message when "experience changes", "level changes", and etc:
Code:
void LocalPlayer::setExperience(double experience) //client parse the changed experience sent from the server, set the new experience by calling this function and this function calls the lua script on skill window module, then the lua script sets the interface with values and etc
{
if(m_experience != experience) {
double oldExperience = m_experience;
m_experience = experience;
callLuaField("onExperienceChange", experience, oldExperience);
}
}
Then he calls in the same script the function that handle that information:
Code:
function onExperienceChange(localPlayer, value)
setSkillValue('experience', value)
end
function onLevelChange(localPlayer, value, percent)
setSkillValue('level', value)
local text = tr('You have %s percent to go', 100 - percent) .. '\n' ..
tr('%s of experience left', expToAdvance(localPlayer:getLevel(), localPlayer:getExperience()))
if localPlayer.expSpeed ~= nil then
local expPerHour = math.floor(localPlayer.expSpeed * 3600)
if expPerHour > 0 then
local nextLevelExp = expForLevel(localPlayer:getLevel()+1)
local hoursLeft = (nextLevelExp - localPlayer:getExperience()) / expPerHour
local minutesLeft = math.floor((hoursLeft - math.floor(hoursLeft))*60)
hoursLeft = math.floor(hoursLeft)
text = text .. '\n' .. tr('%d of experience per hour', expPerHour)
text = text .. '\n' .. tr('Next level in %d hours and %d minutes', hoursLeft, minutesLeft)
end
end
setSkillPercent('level', percent, text)
end
So, I guess that rather than using localPlayer position to render localPlayer on screen, I can get playerCasting position and render on any screen everything related to him, am I right?
I'm gonna try it and I need some tips. If I manage to make that I'll release for free anyway