gohamvsgoku
Member
- Joined
- Aug 21, 2017
- Messages
- 151
- Reaction score
- 9
when player loses his level 5 on mainland he is sent to rookgaard, with level 1 and all skills 10, all correctly
but my problem is with firstitems, he is not coming back with the firstitems again, I do not know why
My First Items.lua
This is the part of code on Player.cpp
I don't understand because in code have
lastLoginSaved = 0;
lastLogout = 0;
anyone know why not work?
but my problem is with firstitems, he is not coming back with the firstitems again, I do not know why
My First Items.lua
LUA:
function onLogin(player)
if player:getLastLoginSaved() <= 0 then
-- Items
if player:getSex() == PLAYERSEX_FEMALE then
player:addItem(3562, 1, true, -1, CONST_SLOT_ARMOR)
else
player:addItem(3561, 1, true, -1, CONST_SLOT_ARMOR)
end
player:addItem(3270, 1, true, -1, CONST_SLOT_LEFT)
player:addItem(2920, 1, true, -1, CONST_SLOT_RIGHT)
local container = Game.createItem(2853, 1)
container:addItem(3585, 1)
player:addItemEx(container, true, CONST_SLOT_BACKPACK)
-- Default Outfit
if player:getSex() == PLAYERSEX_FEMALE then
player:setOutfit({lookType = 136, lookHead = 78, lookBody = 68, lookLegs = 58, lookFeet = 95})
else
player:setOutfit({lookType = 128, lookHead = 78, lookBody = 68, lookLegs = 58, lookFeet = 95})
end
local town = Town("Rookgaard")
player:teleportTo(town:getTemplePosition())
player:setTown(town)
player:setDirection(DIRECTION_SOUTH)
end
return true
end
This is the part of code on Player.cpp
C++:
// Teleport newbies to newbie island
if (g_config.getBoolean(ConfigManager::TELEPORT_NEWBIES)) {
if (getVocationId() != VOCATION_NONE && level <= static_cast<uint32_t>(g_config.getNumber(ConfigManager::NEWBIE_LEVEL_THRESHOLD))) {
Town* newbieTown = g_game.map.towns.getTown(g_config.getNumber(ConfigManager::NEWBIE_TOWN));
if (newbieTown) {
// Restart stats
level = 1;
experience = 0;
levelPercent = 0;
capacity = 340;
health = 150;
healthMax = 150;
mana = 0;
manaMax = 0;
magLevel = 0;
magLevelPercent = 0;
manaSpent = 0;
setVocation(0);
// Restart skills
for (uint8_t i = SKILL_FIRST; i <= SKILL_LAST; ++i) { //for each skill
skills[i].level = 10;
skills[i].tries = 0;
skills[i].percent = 0;
}
// Restart town
setTown(newbieTown);
loginPosition = getTemplePosition();
// Restart first items
lastLoginSaved = 0;
lastLogout = 0;
// Restart items
for (int32_t slot = CONST_SLOT_FIRST; slot != CONST_SLOT_LAST; slot++)
{
Item* item = inventory[slot];
if (item) {
g_game.internalRemoveItem(item, item->getItemCount());
}
}
}
else {
std::cout << "[Warning - Player:death] Newbie teletransportation is enabled, newbie town does not exist." << std::endl;
}
}
}
}
I don't understand because in code have
lastLoginSaved = 0;
lastLogout = 0;
anyone know why not work?