zxmatzx
Advanced OT User
Hello,
I'm developing a pet system, and don't sure how to store player pet info, i think using Storing Info to store a table with all pet info and request the data in
and in
--Not sure if right section is suport or discution, sorry if i did wrong.
I'm developing a pet system, and don't sure how to store player pet info, i think using Storing Info to store a table with all pet info and request the data in
onLogin
and store in a global table
like:
Lua:
PETS = {[playerGuid] = StoringInfoRequestedData}
function Player:requestPetInfo()
if PETS[self:getGuid()] then
return PETS[self:getGuid()]
else
return self:getSpecialStorage(storageId)
end
end
onLogout
, i send back the data using player:setSpecialStorage(storageId, PETS[player:getGuid()])
and maybe a onThink
event with a certain interval to save the data or when a event trigger(pet level up, pet evolution, etc) to prevent data lost if server crash or something. What do you think? Have some better idea?--Not sure if right section is suport or discution, sorry if i did wrong.