• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 0.X TFS 0.3.6 8.60 - HOW CAN I GET THE REFLECTION MAGIC THAT YOU NEED TO BUY FROM THE NPC? I CAN'T SET IT. CREATURE SCRIPT

samuel157

/root
Joined
Mar 19, 2010
Messages
493
Solutions
3
Reaction score
69
Location
São Paulo, Brazil
GitHub
Samuel10M
HOW CAN I GET THE REFLECTION MAGIC THAT YOU NEED TO BUY FROM THE NPC? I CAN'T SET IT. CREATURE SCRIPT

LUA:
function onStatsChange(cid, attacker, type, combat, value)
    -- Verificar se o Reflection está ativo
    if getPlayerStorageValue(cid, 12978) > os.time() then
        -- Garantir que o atacante é válido e está vivo
        if isCreature(attacker) and getCreatureHealth(attacker) > 0 then
            doCreatureAddHealth(attacker, -getCreatureHealth(attacker)) -- Matar atacante
            doSendMagicEffect(getThingPosition(attacker), CONST_ME_HOLYDAMAGE)
            doSendAnimatedText(getThingPosition(attacker), "[OWNED!]", 35)
        end
        return false -- Impede que o jogador perca vida
    else
        -- Desativar evento quando o Reflection expira
        unregisterCreatureEvent(cid, "Reflection/statschange")
        setPlayerStorageValue(cid, 12978, -1)
    end
    return true
end

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local itemID = 11192 -- id do anel
local quantRemove = 100 -- quantidade do item acima que sera removido
local storageGain = 12978 -- storage que o player vai ganhar quando o item for removido

if (msgcontains(msg, 'yes') and doPlayerRemoveItem(cid, itemID, quantRemove)) then
selfSay('Parabens Voce Ganhou Magia (Edit) Digite {Reflection} no Default...', cid)
setPlayerStorageValue(cid, storageGain, 1)
else
selfSay('Vendo Storage de Magia Digite, {Reflection} no Default Tenha [50K] de Vip Coin Digite: {yes}.', cid)
end

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Code:
local msg = "You are immortal for 24 hours."
local STORAGE = 91845
local immortal_time = 86400 -- 24 hours in seconds.

function onCastSpell(cid, var)
    -- Checks if the player is a donor
    if getPlayerStorageValue(cid, 12967) < 1 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need to be a donor to use this spell.")
        doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
        return false
    end

    -- Checks if the player is already immortal
    if getPlayerStorageValue(cid, STORAGE) > os.time() then
        doPlayerSendCancel(cid, "You are already immortal.")
        doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
        return false
    end

    -- Grants immortality to the player
    setPlayerStorageValue(cid, STORAGE, os.time() + immortal_time)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, msg)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_HOLYDAMAGE)

    return true
end
 
the storage spell add not same in onStatsChange
spell add storage 91845 onStatsChange use 12978
explain the system you want and i can do for u in c++
 

Similar threads

Back
Top