Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[Pytanie][8.1]NPC


Rekomendowane odpowiedzi

Opublikowano

Znalazlem NPCa ktory sprzedaje magic lvl za 50 cc

Da sie zmienic te 50 cc na 5 itemkow id : 2143 ?? (zeby sprzedawal 1 magic lvl za 5 x2143 )

a jak da sie to jak ?

Skrypt :

 

local focus = 0
local talk_start = 0
local target = 0
local days = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Zegnaj, Nastepny.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Witaj ' .. creatureGetName(cid) .. '! Sprzedaje magic level i promotion.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! Rozmawiam juz z toba minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'promotion') or msgcontains(msg, 'promote') then
if getPlayerVocation(cid) > 4 then
selfSay('Sorry, masz juz promotion.')
talk_state = 0
elseif getPlayerLevel(cid) < 8 then
selfSay('Sorry, musisz miec 8lvl by kupic promotion.')
talk_state = 0
elseif not isPremium(cid) then
selfSay('Sorry, musisz miec premium by kupic promotion.')
talk_state = 0
else
selfSay('chcesz kupic promotion za 20k?')
talk_state = 1
end
elseif msgcontains(msg, 'mlvl') or msgcontains(msg, 'magic') then
selfSay('chcesz kupic magic level za 50cc?')
talk_state = 2
elseif talk_state == 1 then
if msgcontains(msg, 'yes') then
if pay(cid,20000) then
doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
selfSay('Dostales promotion!')
else
selfSay('Sorry, Nie masz tyle kasy.')
end
end
talk_state = 0
elseif talk_state == 2 then
if msgcontains(msg, 'yes') then
if pay(cid,500000) then
selfSay('/addskill '.. creatureGetName(cid) ..', magic level')
selfSay('Dostales 1 magic level!')
else
selfSay('Sorry, nie masz tyle kaski.')
end
end
talk_state = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Zegnaj, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Nastepny...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Zegnaj, Nastepny.')
focus = 0
end
end
end

 

za pomoc 5 w profilu i pare like itow :D

Opublikowano

Ten skrypt jest za bardzo rozlegle napisany, ale mam rozwiązanie ! Jesli dziala Ci runa na dodanie mlvl to wstaw tego skrypta:

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

local config = {
    itemId = 11192, -- // Tutaj id przedmiotu, ktory npc bedzie potrzebowal
    itemCount = 20, -- // Tutaj ilosc przedmiotow, z powyzszym ID
    reward = {2560, 1} -- // Tutaj nagroda czyli mlvl runa (przed przecinkiem id a po ilość)
}
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    if(msgcontains(msg, 'mlvl')) then -- Słowo "mission" zamieniamy na dowolne słowo, na które npc ma reagować.  
        if(getPlayerStorageValue(cid, storageKey) <= 100000000000000) then -- Tutaj jest sprawdzane, czy gracz juz wykonal misje czy tez nie
            npcHandler:say("Zdobadz dla mnie...", cid)  -- tekst
            talkState[talkUser] = 1 
        else
            npcHandler:say("Wykonales juz ta misje", cid)  
        end
    elseif(msgcontains(msg, 'yes')) then
        if(talkState[talkUser] == 1) then
            if(doPlayerRemoveItem(cid, config.itemId, config.itemCount)) then 
                npcHandler:say("Dziekuje za przedmioty", cid)  
                setPlayerStorageValue(cid, storageKey, 0) 
                doPlayerAddItem(cid, config.reward[1], config.reward[2])  
            else 
                npcHandler:say("Nie masz wystarczajacych przedmiotow", cid)  
            end  
            talkState[talkUser] = 0  
        end
    end
    return true
end

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

 

Ten skrypt jest za bardzo rozlegle napisany, ale mam rozwiązanie ! Jesli dziala Ci runa na dodanie mlvl to wstaw tego skrypta:





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

local config = {
    itemId = 11192, -- // Tutaj id przedmiotu, ktory npc bedzie potrzebowal
    itemCount = 20, -- // Tutaj ilosc przedmiotow, z powyzszym ID
    reward = {2560, 1} -- // Tutaj nagroda czyli mlvl runa (przed przecinkiem id a po ilość)
}
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    if(msgcontains(msg, 'mlvl')) then -- Słowo "mission" zamieniamy na dowolne słowo, na które npc ma reagować.  
        if(getPlayerStorageValue(cid, storageKey) <= 100000000000000) then -- Tutaj jest sprawdzane, czy gracz juz wykonal misje czy tez nie
            npcHandler:say("Zdobadz dla mnie...", cid)  -- tekst
            talkState[talkUser] = 1 
        else
            npcHandler:say("Wykonales juz ta misje", cid)  
        end
    elseif(msgcontains(msg, 'yes')) then
        if(talkState[talkUser] == 1) then
            if(doPlayerRemoveItem(cid, config.itemId, config.itemCount)) then 
                npcHandler:say("Dziekuje za przedmioty", cid)  
                setPlayerStorageValue(cid, storageKey, 0) 
                doPlayerAddItem(cid, config.reward[1], config.reward[2])  
            else 
                npcHandler:say("Nie masz wystarczajacych przedmiotow", cid)  
            end  
            talkState[talkUser] = 0  
        end
    end
    return true
end

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

runa na magic lvl niedziala ... ;/

dlatego chce npca zrobic :D

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...