function onLogin(cid)
if getPlayerLevel(cid) < 6 and getPlayerVocation(cid) ~= 0 then
doTeleportThing(cid, ROOK_TEMPLE)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
doPlayerSetTown(cid, ROOK_TOWN_ID)
doPlayerSendCancel(cid, "Nottinghster rocks \o/")
end
return true
end
@Jakkess
It's on login.lua man, here's an example
Code:function onLogin(cid) if getPlayerLevel(cid) < 6 and getPlayerVocation(cid) ~= 0 then doTeleportThing(cid, ROOK_TEMPLE) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) doPlayerSetTown(cid, ROOK_TOWN_ID) doPlayerSendCancel(cid, "Nottinghster rocks \o/") end return true end
If you want to chance it without editing in the sources you can just edit a exhaust value on every spell at spells.xml@Nottinghster @Ezzz
I have 2 questions
First :
Now i can use utani gran hur + exura vita
how to do that on all spells and runes was one exhausted ?
And second :
I can change protocol for 7.4 or 7.6 and use client 7.7 ( with change directx ) ?
<instant name="Energy Strike" words="exori vis" lvl="12" maglv="3" mana="20" direction="1" customexhaust="1000" script="attack/energy_strike.lua">
<vocation name="Sorcerer"/> <vocation name="Master Sorcerer"/>
<vocation name="Druid"/> <vocation name="Elder Druid"/>
</instant>
There is a way to get something similar to db.executeQuery function on OTHire?Sending players with vocation to rook keeping their skills?
Else you have to remove few lines in:
creature.cpp
game.cpp
player.cpp
@EvulMastah
Now I saw, forgot to add the setPlayerVocation(cid, 0)
@Jakkess
With this example, you can do the rest, and don't forget to check if players have house, blesses
Changing vocation but still keeping skills and equipment? Not a good example.
function doPlayerAddMagicLevel(cid, value)
local getmana = getPlayerRequiredMana(cid, getPlayerMagLevel(cid))
local spendedmana = ((getPlayerRequiredMana(cid, getPlayerMagLevel(cid) + value)) / getConfigValue("rate_mag"))
if isPlayer(cid) then
doPlayerAddSpentMana(cid, (getmana + spendedmana))
else
error("Player not found in function doPlayerAddMagicLevel")
end
end
-- Storage for Rook System
STORAGE_ROOK = 3000000
local firstItems = {2050, 2382}
function onLogin(cid)
if getPlayerLastLogin(cid) == 0 or getPlayerStorageValue(cid, STORAGE_ROOK) == 1 then
for i = 1, #firstItems do
doPlayerAddItem(cid, firstItems[i], 1)
end
doPlayerAddItem(cid, getPlayerSex(cid) == 0 and 2651 or 2650, 1)
local bag = doPlayerAddItem(cid, 1987, 1)
doAddContainerItem(bag, 2674, 1)
setPlayerStorageValue(cid, STORAGE_ROOK, 1)
end
return true
end
function onLogin(cid)
if getPlayerLevel(cid) < 6 and getPlayerVocation(cid) ~= 0 then -- Check if player level is lower than 6 and vocation is different from No Vocation
for i = 1, 10 do
local slotItem = getPlayerSlotItem(cid, i)
if slotItem.itemid > 0 then
doRemoveItem(slotItem.uid) -- Remove All Equipments from Player
end
end
doPlayerRemoveLevel(cid, getPlayerLevel(cid)) -- Set Player Level to 1
setPlayerStorageValue(cid, STORAGE_ROOK, 1) -- First Items
doPlayerSetVocation(cid, 0) -- Set Player No Vocation
setCreatureMaxHealth(cid, 150)
setCreatureMaxMana(cid, 0)
doPlayerSetMaxCapacity(cid, 440) -- Set Max Capacity to 440 (Default Rookgaard)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) -- Set Max Health to 150 (Default Rookgaard)
doCreatureAddMana(cid, getCreatureMaxMana(cid)) -- Set Max Mana to 0 (Default Rookgaard)
doPlayerSetTown(cid, TOWN_ROOKGAARD) -- Set Player Town to Rookgaard, remember to change to your Rookgaard TOWN ID
doPlayerAddMagicLevel(cid, -getPlayerMagLevel(cid)) -- Set Magic Level to 0
doPlayerAddSkillTry(cid, 0, -getPlayerSkillLevel(cid, 0)) -- Set Fist Fighting Skill to 10 (Default Rookgaard)
doPlayerAddSkillTry(cid, 1, -getPlayerSkillLevel(cid, 1)) -- Set Club Fighting Skill to 10 (Default Rookgaard)
doPlayerAddSkillTry(cid, 2, -getPlayerSkillLevel(cid, 2)) -- Set Sword Fighting Skill to 10 (Default Rookgaard)
doPlayerAddSkillTry(cid, 3, -getPlayerSkillLevel(cid, 3)) -- Set Axe Fighting Skill to 10 (Default Rookgaard)
doPlayerAddSkillTry(cid, 4, -getPlayerSkillLevel(cid, 4)) -- Set Distance Fighting Skill to 10 (Default Rookgaard)
doPlayerAddSkillTry(cid, 5, -getPlayerSkillLevel(cid, 5)) -- Set Shielding Skill to 10 (Default Rookgaard)
doPlayerAddSkillTry(cid, 6, -getPlayerSkillLevel(cid, 6)) -- Set Fishing Skill to 10 (Default Rookgaard)
if(getPlayerSex(cid) == PLAYERSEX_FEMALE) then
lookOutfit = 136
else
lookOutfit = 128
end
doCreatureChangeOutfit(cid, {lookType=lookOutfit, lookHead=78, lookBody=69, lookLegs=58, lookFeet=76}) -- Set Rookgaard Outfit
doTeleportThing(cid, getPlayerMasterPos(cid, TOWN_ROOKGAARD)) -- Teleport to Rookgaard
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) -- Some gay effect ;)
end
return true
end
<event name="RookSystem" type="login" script="rook_system.lua"/>
//doSavePlayer(cid)
lua_register(m_luaState, "doSavePlayer", LuaScriptInterface::luaDoSavePlayer);
//getPlayerRequiredMana(cid, magicLevel)
lua_register(m_luaState, "getPlayerRequiredMana", LuaScriptInterface::luaGetPlayerRequiredMana);
//doSavePlayer(cid)
int LuaScriptInterface::luaDoSavePlayer(lua_State *L)
{
uint32_t cid = popNumber(L);
ScriptEnviroment* env = getScriptEnv();
Player* player = env->getPlayerByUID(cid);
if (player){
if (IOPlayer::instance()->savePlayer(player)){
lua_pushboolean(L, true);
return 1;
} else {
lua_pushboolean(L, false);
}
} else {
lua_pushboolean(L, false);
}
return 0;
}
int LuaScriptInterface::luaGetPlayerRequiredMana(lua_State* L)
{
//getPlayerRequiredMana(cid, magicLevel)
uint32_t magLevel = popNumber(L);
ScriptEnviroment* env = getScriptEnv();
if(Player* player = env->getPlayerByUID(popNumber(L)))
lua_pushnumber(L, player->vocation->getReqMana(magLevel));
else
{
reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}
static int luaDoPlayerAddMana(lua_State *L);
static int luaGetPlayerRequiredMana(lua_State* L);
Bro please im very noob making this how and wich software i need use to do this ? explain me please if u have time thanksDid you started mysql server?
This server needs a database on MySql running on background (you have to import schema), then you change the options that @Emky said on config.lua