Witam!
Przedstawiam tu ciekawe i przydatne skrypty. Niektóre są często szukane przez "newbie" którzy niepotrzebnie zakładają nowe tematy.
UWAGA: Jeżeli ktoś założy temat że poszukuje jakiegoś z tych skryptów to dostaje ode mnie minusa!
Siekierki do rzucania
W weapons.xml
Spoiler:<distance id="2447" range="8" enabled="1" exhaustion="0" hitchance="100" ammo="removecount" script="siekierka.lua"></distance>
Teraz zawartość pliku siekierka.lua
Spoiler:local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1) setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 25) setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 0, 0)
function onUseWeapon(cid, var) return doCombat(cid, combat, var) end
Po 1. Możesz zmienić że to np. Palladyn może rzucać tymi siekierkami. Po 2. Możesz zmienić że nie skilluje Distance Fighting jak rzucasz tylko Axe Fighting. W tym celu:
Odszukujemy tą linijkę:
Spoiler:<distance id="2447" range="8" enabled="1" exhaustion="0" hitchance="100" ammo="removecount" script="siekierka.lua"></distance>
I zmieniamy ją na:
Spoiler:<melee id="2447" range="8" enabled="1" exhaustion="0" hitchance="100" ammo="removecount" script="siekierka.lua"></melee>
Po 3. Możesz zmienić sobie grafikę lecących broni.
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The Oracle
Robimy w data/npc/scripts oracle.lua
Spoiler:local LEVEL = 8
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start 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 -- OTServ event handling functions end
function oracle(cid, message, keywords, parameters, node) if(cid ~= npcHandler.focus) then return false end
local cityNode = node:getParent():getParent() local vocNode = node:getParent()
local destination = cityNode:getParameters().destination local townid = cityNode:getParameters().townid local voc = vocNode:getParameters().voc
if(destination ~= nil and voc ~= nil and townid ~= nil) then if(getPlayerLevel(cid) < parameters.level) then npcHandler:say('You must first reach level ' .. parameters.level .. '!') else doPlayerSetVocation(cid,voc) doPlayerSetTown(cid,townid) --doPlayerSetMasterPos(cid,destination) doTeleportThing(cid,destination) end else error('Destination:', destination, 'Vocation:', vocation, 'Townid:', townid) end npcHandler:resetNpc() return true end
function greetCallback(cid) if(getPlayerLevel(cid) < LEVEL) then npcHandler:say('CHILD! COME BACK WHEN YOU HAVE GROWN UP!') return false else return true end end
-- Set the greeting callback function npcHandler:setCallback(CALLBACK_GREET, greetCallback)
-- Set the greeting message. npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|. Are you prepared to face your destiny?')
-- Pre-create the yes/no nodes. local yesNode = KeywordNode:new({'yes'}, oracle, {level = LEVEL}) local noNode = KeywordNode:new({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then what vocation do you want to become?'})
-- Create the actual keyword structure... local node1 = keywordHandler:addKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'What city do you wish to live in? Carlin, Thais or Venore.'}) local node2 = node1:addChildKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 5, destination = {x=703, y=600, z=7}, text = 'The carlin, eh? So what vocation do you wish to become? Sorcerer, druid, paladin or knight?'}) local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode)
local node2 = node1:addChildKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 3, destination = {x=712, y=1059, z=7}, text = 'The thais, eh? So what vocation do you wish to become? Sorcerer, druid, paladin or knight?'}) local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode)
local node2 = node1:addChildKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 4, destination = {x=1300, y=894, z=7}, text = 'The venore, eh? So what vocation do you wish to become? Sorcerer, druid, paladin or knight?'}) local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) keywordHandler:addKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Then come back when you are ready.'})
-- Make it react to hi/bye etc. npcHandler:addModule(FocusModule:new())
-- Makes sure the npc reacts when you say hi, bye etc. npcHandler:addModule(FocusModule:new())
I w the oracle w data/npc/
Spoiler:<npc name="The Oracle" script="data/npc/scripts/oracle.lua" autowalk="0" floorchange="0" access="5" level="1" maglevel="0"> <health now="150" max="150"/> <look typeex="1448" corpse="2212"/> <parameters>
</parameters> </npc>
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Ksiądz
Po 1. Ten Ksiądz odprawia ślub. Po 2. 1) Mężczyzna wpisuje księdzu hi 2) Kobieta po mężczyźnie, również wpisuje hi 3) Można na odwrót. 4) Ksiądz rozpoczyna ceremonie. 5) Szczęśliwego życia tibijskiego.
W data/npc robimy pilk o nazwie Ksiadz.xml i wklejamy do niego to
Spoiler:<?xml version="1.0"?> <npc name="Ksiadz" script="data/npc/scripts/slub.lua" access="3" lookdir="2"> <mana now="800" max="800"/> <health now="200" max="200"/> <look type="57" head="20" body="30" legs="40" feet="50"/> </npc>
Teraz w data/npc/scripts robimy plik o nazwie slub.lua i wklejamy do niego to
Spoiler:focus1 = 0 focus2 = 0 talk_start = 0 target = 0 following = false attacking = false talkstate = 0 moved=0 function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(id, stackpos) if id == focus1 or id == focus1 then ceremonyend('Z Panem Bogiem !' 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 ceremonyend(msg) focus1 = 0 focus2 = 0 talk_start = 0 talkstate = 0 selfSay(msg) end function onCreatureSay(cid, type, msg) msg = string.lower(msg) if talkstate == 1 then if cid == focus2 then if msgcontains(msg, 'tak' then talkstate=2 selfSay('' .. creatureGetName(focus1) .. ' Powinienem rozpoczac ceremonie?' else ceremonyend('Wroccie kiedy bedziecie gotowi..' end end end if talkstate == 2 then if cid == focus1 then if msgcontains(msg, 'tak' then talkstate=3 else ceremonyend('Wroccie kiedy bedziecie gotowi.' end end end if talkstate == 9 then if cid == focus1 then if string.find(msg, '(%a*)tak(%a*)' then talkstate=10 else ceremonyend('Wroccie kiedy bedziecie gotowi.' end end end if talkstate == 11 then if cid == focus2 then if string.find(msg, '(%a*)tak(%a*)' then talkstate=12 else ceremonyend('Wroccie kiedy bedziecie gotowi.' end end end if msgcontains(msg, 'hi' and focus1 > 0 and focus2 == 0 and not(cid==focus1) and isPromoted(cid) and getDistanceToCreature(cid) < 4 then if getPlayerStorageValue(cid,2001) == -1 then selfSay('Witam, ' .. creatureGetName(cid) .. '! Jestem ksiedzem z Wieliszewa. Powinienem zaczac ceremonie?' focus2 = cid talk_start = os.clock() talkstate=1 else selfSay('Jestes po ceremonii slubu!' end end if msgcontains(msg, 'hi' and focus1 == 0 and isPromoted(cid) and getDistanceToCreature(cid) < 4 then if getPlayerStorageValue(cid,2001) == -1 then selfSay('Witam, ' .. creatureGetName(cid) .. '! Jestem ksiedzem z Wieliszewa. Moge udzielic slubu Tobie i Twojej wybrance lub wybrankowi.' focus1 = cid talk_start = os.clock() else selfSay('Jestes juz po slubie.' end end if msgcontains(msg, 'wieliszew' and (focus1 == cid or focus2 == cid) then selfSay('Wieliszew to mala miejscowosc, w ktorej wyroslem na to, czym jestem.' talk_start = os.clock() end if string.find(msg, '(%a*)bye(%a*)' and (focus1 == cid or focus2 == cid) and getDistanceToCreature(cid) < 6 then ceremonyend('Z Panem Bogiem ! ' .. creatureGetName(cid) .. '!' end end function onCreatureChangeOutfit(creature) end function onThink() if talkstate==3 and (os.clock() - talk_start) > 10 then selfSay('Polozcie tu swoje obraczki na znak swojej wiary.'; talk_start = os.clock() talkstate=4 end if talkstate==4 and (os.clock() - talk_start) > 6 then selfSay('Stoicie tu teraz razem, poniewaz udzielacie sie w przybyciu swojej przyszlosci..'; talk_start = os.clock() talkstate=5 end if talkstate==5 and (os.clock() - talk_start) > 6 then selfSay('Przeszlosc jest przeszloscia. Zarodki jednak kwitna, z troska i zaufaniem....'; talk_start = os.clock() talkstate=6 end if talkstate==6 and (os.clock() - talk_start) > 8 then selfSay('Uczciwosc i zyczliwosc, sa owocami milosci.'; talk_start = os.clock() talkstate=7 end if talkstate==7 and (os.clock() - talk_start) > 6 then selfSay('Zatem niech Pan Bog blogoslawi ten dzien i zawsze wzbogacac bedzie Wasza milosc... bez konca.'; talk_start = os.clock() talkstate=8 end if talkstate==8 and (os.clock() - talk_start) > 6 then selfSay(creatureGetName(focus1) .. ' Czy Ty obiecujesz ' .. creatureGetName(focus2) .. ' w obecnosci wyslannika Bozego ... w dobrej... i zlej doli... w bogactwie... czy biedzie... w chorobie i zdrowiu... MILOSC... WIERNOSC... I UCZCIWOSC MALZENSKA?'; talk_start = os.clock() talkstate=9 end if talkstate==10 and (os.clock() - talk_start) > 6 then selfSay(creatureGetName(focus2) .. ' Czy Ty obiecujesz ' .. creatureGetName(focus1) .. ' w obecnosci wyslannika Bozego... w dobrej... i zlej doli... w bogactwie... czy biedzie... w chorobie i zdrowiu... MILOSC... WIERNOSC... I UCZCIWOSC MALZENSKA?'; talk_start = os.clock() talkstate=11 end if talkstate==12 and (os.clock() - talk_start) > 6 then setPlayerStorageValue(focus2,2001,1) setPlayerStorageValue(focus1,2001,1) ceremonyend('Oglaszam was MEZEM i ZONA ! Zalozcie obraczki.. Niech Pan ma was w swojej opiece.'; talk_start = os.clock() end if (os.clock() - talk_start) > 100 then if focus1 > 0 or focus2 > 0 then ceremonyend('Z Panem Bogiem !' end end --if moved==0 then --x, y, z = selfGetPosition() --moveToPosition(x+1, y, z) --moved=1 --end end
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Potioner
Po 1. Ten NPC reaguje TYLKO na słowa (yo i nara) to część spolszczenia które autor próbował umieścić. Możesz to zmienić tu:
Spoiler:elseif msgcontains(msg, 'yo') elseif string.find(msg, '(%a*)nara(%a*)')
data/npc/ tworzysz Maximus.xml Treść:
Spoiler:<?xml version="1.0"?>
<npc name="Maximus" script="data/npc/scripts/runki.lua" access="3" lookdir="2" autowalk="1"> <mana now="666" max="666"/> <health now="200" max="200"/> <look type="134" head="114" body="113" legs="113" feet="113"/> </npc>
Następnie data/npc/scripts runki.lua Treść:
Spoiler:local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') focus = 0 talk_start = 0 end end
function onCreatureTurn(creature)
end
function onCreatureSay(cid, type, msg) local msg = string.lower(msg)
if msgcontains(msg, 'yo') and focus == 0 and getDistanceToCreature(cid) < 4 then selfSay('Hello ' .. creatureGetName(cid) .. '! Sellam backpacki run (bp runes).') focus = cid talk_start = os.clock()
elseif msgcontains(msg, 'yo') and focus ~= cid and getDistanceToCreature(cid) < 4 then selfSay('Przepraszam, ' .. creatureGetName(cid) .. '! czekaj chwile!.')
elseif focus == cid then talk_start = os.clock()
if msgcontains(msg, 'backpacks') or msgcontains(msg, 'bp runes') then selfSay('Selluje bp hmm (20k), bp uh (20k), bp gfb (20k), bp explosion (20k), bp sd (20k), bp mwall(20k), BP MANA POTION, HEALTH POTION, STRONG MANA POTION, GREAT MANA POTION, GREAT HEALTH POTION, STRON HEALTH POION')
elseif msgcontains(msg, 'bp sd') then buyContainer(cid,2003,2268,10,100000) elseif msgcontains(msg, 'bp hmm') then buyContainer(cid,1998,2311,100,100000) elseif msgcontains(msg, 'bp uh') then buyContainer(cid,2002,2273,10,100000) elseif msgcontains(msg, 'bp gfb') then buyContainer(cid,2000,2304,100,100000) elseif msgcontains(msg, 'bp explosion') or msgcontains(msg, 'bp explo') then buyContainer(cid,2001,2313,100,100000) elseif msgcontains(msg, 'bp mwall') then buyContainer(cid,1999,2293,100,100000) elseif msgcontains(msg, 'bp strong health potion') then buyContainer(cid,1999,7588,1,100000) elseif msgcontains(msg, 'bp strong mana potion') then buyContainer(cid,1999,7589,1,200000) elseif msgcontains(msg, 'bp mana potion') then buyContainer(cid,1999,7620,1,200000) elseif msgcontains(msg, 'bp health potion') then buyContainer(cid,1999,7618,1,200000) elseif msgcontains(msg, 'bp great mana potion') then buyContainer(cid,1999,7590,1,200000) elseif msgcontains(msg, 'bp great health potion') then buyContainer(cid,1999,7591,1,200000)
elseif string.find(msg, '(%a*)nara(%a*)') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 end end end
function onCreatureChangeOutfit(creature)
end
function onThink() 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('No narka.') focus = 0 end end end
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Death Hand God
Wchodzimy w data/items/items.xml naciskamy ctrl+f wpisujemy 7451 i szukaj powinno nas przenieść do czegoś takiego:
Spoiler:<item id="7451" name=""> <attribute key="weight" value="0"/> </item>
Zmieniamy to na:
Spoiler:<item id="7451" article="a" name="Death Hand God"> <attribute key="description" value="God make this wand to help Sorcerers in fight with demons."/> <attribute key="weight" value="3050"/> <attribute key="weaponType" value="wand"/> <attribute key="range" value="3"/>
Nazwa itemu. Opis itemu. Obszar w jakim różdżka będzie mogła atakować potwora.
Następnie w data/weapons/scripts tworzymy plik o nazwie Godhand.lua wpisujemy:
Spoiler:local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, -90, 0, -110)
function onUseWeapon(cid, var) return doCombat(cid, combat, var) end
Obrażenia minimalne. Obrażenia maxymalne.
Następnie otwieramy data/weapons/weapons.xml i dopisujemy linijkę:
Spoiler:<wand id="7451" range="3" lvl="41" mana="16" enabled="1" exhaustion="0" script="Godhand.lua"><vocation id="1"/><vocation id="5"/></wand>
To tyle z skryptów. NIEWIEM CZY SKRYPTY DZIAŁAJĄ [NIE TESTOWAŁEM]!
|