Game.cpp
Above It,Add This
Then in globalevents.xml
globalevents/scripts/age.lua
add
How it Looks like Ingame:
How it Works:
Each 1 minute, the player will get +1 in the storage, and each 5 points = 1 month
so if you change 60000 to 120000 it will be 1 point each 2 minutes, and so on
Known Bugs:
It's Always He
-- Fix
Not sure if it will work right now
Code:
if(player->hasCustomFlag(PlayerCustomFlag_CanSeePosition))
{
ss << std::endl << "Position: [X: " << thingPos.x << "] [Y: " << thingPos.y << "] [Z: " << thingPos.z << "]";
if(Tile* tile = getTile(thingPos))
{
if(House* house = tile->getHouse())
ss << " [House: " << house->getId() << "]";
}
ss << ".";
}
Above It,Add This
Code:
std::string year;
if (const Creature* creature = thing->getCreature())
{
if (const Player* destPlayer = creature->getPlayer())
{
destPlayer->getStorage("6723", year);
int32_t YearSay = atoi(year.c_str()) / 60;
int32_t MonthSay = ((atoi(year.c_str()) / 5) % 12)+1;
if (MonthSay > 0 || YearSay > 0)
{
if (thing != player)
ss << std::endl << "He is " << std::floor(YearSay) << " Years, " << std::floor(MonthSay) << " Months old.";
else
ss << std::endl << "You are " << std::floor(YearSay) << " Years, " << std::floor(MonthSay) << " Months old.";
}
else {
if (thing != player)
ss << std::endl << "He Was Just Born.";
else
ss << std::endl << "You Were Just Born";
}
}
}
Then in globalevents.xml
Code:
<globalevent name="age" interval="60000" event="script" value="age.lua"/>
add
Code:
function onThink(interval)
if #getPlayersOnline() >= 1 then
for i = 1,#getPlayersOnline() do
doPlayerSetStorageValue(getPlayersOnline()[i],6723, getPlayerStorageValue(getPlayersOnline()[i],6723) + 1)
end
end
return true
end
How it Looks like Ingame:
How it Works:
Each 1 minute, the player will get +1 in the storage, and each 5 points = 1 month
so if you change 60000 to 120000 it will be 1 point each 2 minutes, and so on
Known Bugs:
It's Always He
-- Fix
Code:
if (const Creature* creature = thing->getCreature())
{
if (const Player* destPlayer = creature->getPlayer())
{
destPlayer->getStorage("6723", year);
int32_t YearSay = atoi(year.c_str()) / 60;
int32_t MonthSay = ((atoi(year.c_str()) / 5) % 12)+1;
if (MonthSay > 0 || YearSay > 0)
{
if (thing != player)
ss << std::endl << (destPlayer->getSex(false) == PLAYERSEX_FEMALE ? "She" : "He") << "is" << std::floor(YearSay) << " Years, " << std::floor(MonthSay) << " Months old.";
else
ss << std::endl << "You are " << std::floor(YearSay) << " Years, " << std::floor(MonthSay) << " Months old.";
}
else {
if (thing != player)
ss << std::endl << (destPlayer->getSex(false) == PLAYERSEX_FEMALE ? "She" : "He") << " Was Just Born.";
else
ss << std::endl << "You Were Just Born";
}
}
}
Not sure if it will work right now