Vá em data/creaturescripts/creaturescripts.xml e adicione a seguinte tag:
<event type="kill" name="bossKill" script="bosskill.lua"/>Em data/creaturescripts/scripts crie o arquivo bosskill.lua com o seguinte conteúdo:
local config = {
boss = "Nome do Boss",
storage = 724800
}
function onKill(cid, target, damage, flags)
if isMonster(target) then
if getCreatureName(target) == config.boss and getPlayerStorageValue(cid, config.storage) == -1 then
setPlayerStorageValue(cid, config.storage, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens por matar o boss " .. config.boss .. ", pode pegar sua recompensa.")
doSendMagicEffect(getCreaturePosition(cid), 66)
end
end
return true
endAinda em data/creaturescripts/scripts adicione isso em login.lua antes do ultimo return true:
registerCreatureEvent(cid, "bossKill")Agora vá em data/actions/actions.xml e coloque a seguinte tag:
<action actionid="4213" script="rewardBoss.lua" />E para finalizar, em data/actions/scripts crie o arquivo rewardBoss.lua com o seguinte conteúdo:
local config = {
questStorage = 724877,
bossStorage = 724800,
item = {18422, 5} -- itemid, amount
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, config.bossStorage) >= 1 then
if getPlayerStorageValue(cid, config.questStorage) >= 1 then
doPlayerSendTextMessage(cid, 25, "Desculpe, mas voce ja completou essa quest!")
return false
end
doPlayerAddItem(cid, config.item[1], config.item[2])
setPlayerStorageValue(cid, config.questStorage, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens! Voce recebeu "..config.item[2].." "..getItemNameById(config.item[1])..".")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
return true
else
doPlayerSendTextMessage(cid, 25, "The chest is empty.")
end
return false
end
amigo todo script q vc deseja transformar só para premium, procure a função onUse, onSay, onStep seja la qual for e em baixo dela adicione:
if not isPremium(cid) then
return doPlayerSendCancel(cid, "You need premium to use this command.")
end
local MIN_HEALTH = 200
local MAX_HEALTH = 600
local MIN_MANA = 110
local MAX_MANA = 390
local EMPTY_POTION = 7635
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (not isPremium(cid)) then
return FALSE
end
if isPlayer(itemEx.uid) == FALSE then
return FALSE
end
if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
if((not(isPaladin(itemEx.uid)) or getPlayerLevel(itemEx.uid) < 80) and getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) == FALSE) then
doCreatureSay(itemEx.uid, "Only paladins of level 80 or above may drink this fluid.", TALKTYPE_ORANGE_1)
return TRUE
end
if doCreatureAddHealth(itemEx.uid, math.random(MIN_HEALTH, MAX_HEALTH)) == LUA_ERROR or doPlayerAddMana(itemEx.uid, math.random(MIN_MANA, MAX_MANA)) == LUA_ERROR then
return FALSE
end
Bom, para seu numero 1, basta modificar seus codigos de Potion em actions/scripts/liquids.. Veja um exemplo da mana potion...
local MIN = 70
local MAX = 130
local EMPTY_POTION = 7636
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isPlayer(itemEx.uid) == FALSE then
return FALSE
end
if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
return FALSE
end
doAddCondition(cid, exhaust)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid, 1)
doPlayerAddItem(cid, EMPTY_POTION, 1)
return TRUE
end
Modifiquei por..
local MIN = 70
local MAX = 130
local EMPTY_POTION = 7636
local ehPremmy = getPlayerPremiumDays(cid)
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(ehPremmy >= 1) then
if isPlayer(itemEx.uid) == FALSE then
return FALSE
end
if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
return FALSE
end
doAddCondition(cid, exhaust)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid, 1)
doPlayerAddItem(cid, EMPTY_POTION, 1)
return TRUE
else
doPlayerSendTextMessage(cid, 27, "Você não é premium account !")
end
end
Pronto, agora acho que só usa quem for Premmy Account.
Possíveis erros:
- Você utiliza um sistema de premium diferente do global;
- O player restaura mana, mas ao invez dos efeitos ele retorna a mensagem de que não é premium;
Bom, caso ele continue cosneguindo usar a potion, talvez você deva mecher aqui :
Em actions/scripts/liquids no arquivo potions.lua :
local config = {
removeOnUse = "no",
usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
splashable = "no",
realAnimation = "no", -- make text effect visible only for players in range 1x1
healthMultiplier = 1.0,
manaMultiplier = 1.0,
}
config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)
local POTIONS = {
[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
[7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion
[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion
[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion
[8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion
[7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion
[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
[7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion
[8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(not potion) then
return false
end
if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
if(not config.splashable) then
return false
end
if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPos(item.uid)
end
doDecayItem(doCreateItem(2016, potion.splash, toPosition))
doTransformItem(item.uid, potion.empty)
return true
end
if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end
if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return true
end
local health = potion.health
if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
return false
end
local mana = potion.mana
if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
return false
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
if(not realAnimation) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
else
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
if(isPlayer(tid)) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
end
end
end
doAddCondition(cid, exhaust)
if(not potion.empty or config.removeOnUse) then
doRemoveItem(item.uid, 1)
return true
end
doRemoveItem(item.uid, 1)
doPlayerAddItem(cid, potion.empty, 1)
return true
end
Modifiquei por:
local config = {
removeOnUse = "no",
usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
splashable = "no",
realAnimation = "no", -- make text effect visible only for players in range 1x1
healthMultiplier = 1.0,
manaMultiplier = 1.0,
TemPremmy = getPlayerPremiumDays(cid)
}
config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)
local POTIONS = {
[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
[7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion
[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion
[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion
[8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion
[7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion
[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
[7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion
[8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(config.TemPremmy >= 1) then
if(not potion) then
return false
end
if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
if(not config.splashable) then
return false
end
if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPos(item.uid)
end
doDecayItem(doCreateItem(2016, potion.splash, toPosition))
doTransformItem(item.uid, potion.empty)
return true
end
if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end
if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return true
end
local health = potion.health
if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
return false
end
local mana = potion.mana
if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
return false
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
if(not realAnimation) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
else
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
if(isPlayer(tid)) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
end
end
end
doAddCondition(cid, exhaust)
if(not potion.empty or config.removeOnUse) then
doRemoveItem(item.uid, 1)
return true
end
doRemoveItem(item.uid, 1)
doPlayerAddItem(cid, potion.empty, 1)
return true
else
doPlayerSendTextMessage(cid, 27, "Você não é premium account !")
end
end
Em outras palavras, antes de executar o código que adiciona mana para os players, eu testei se ele era premium, se fosse, executava o código, se não, parava.
-Primeiro: Entre no Map editor e coloque os npcs no lugar certo, se nao tiver basta ir em file/import/npc
-Segundo: olhe no script do azerus3 (data/monster/azerus) e verifique se as cordenadas estao certo (logicamente nao estao pois mude!)
-Terceiro: Totalmente normal, pois quando azerus3 morrer tem que apareser o teleport pros player entrar e depois de certo tempo sumir! pra quest continuar
-Quarto: Segue o "primeiro" acima!
Vai em data/creaturescripts/scripts, duplica um arquivo e renomeia para aoldeath e nele cole:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
local aolID = 2130 -- id do aol
local lossExp = false -- perde xp 'false' para falso ou 'true' para verdadeiro
local lossItems = false -- perde items
if isPlayer(cid) then
if ((getPlayerSlotItem(cid, 2).itemid == aolID) and (getCreatureSkullType(cid) ~= SKULL_RED)) then
if (lossExp == false) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
end
doCreatureSetDropLoot(cid, lossItems)
return true
end
end
return true
end
Agora vai em data/creaturescripts/creaturescripts.xml e cola a tag:
Sóh adicionar mais conditions antes da função onAttack
Fire:
local condition = createConditionObject(CONDITION_FIRE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000) -- aqui vai o tempo de fire, 1000 = 1 segundo
setConditionFormula(condition, 0, 0, 0, 0)
setCombatCondition(combat, condition)
Ice:
local condition = createConditionObject(CONDITION_FREEZING)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000) -- aqui vai o tempo de fire, 1000 = 1 segundo
setConditionFormula(condition, 0, 0, 0, 0)
setCombatCondition(combat, condition)