skrypt nie mój
Script nie mój (Create Szuwar)
A więc zaczynamy w data\movements\movements dodajemy
Spoiler:<!-- Arena Svargrond by Szuwar --> <movevent event="AddItem" tileitem="1" actionid="3001" script="stone.lua" /> -- 1 komnata <movevent event="AddItem" tileitem="1" actionid="3002" script="stone.lua" /> -- 2 komnata <movevent event="AddItem" tileitem="1" actionid="3003" script="stone.lua" /> -- 3 komnata <movevent event="AddItem" tileitem="1" actionid="3004" script="stone.lua" /> -- 4 komnata <movevent event="AddItem" tileitem="1" actionid="3005" script="stone.lua" /> -- 5 komnata <movevent event="AddItem" tileitem="1" actionid="3006" script="stone.lua" /> -- 6 komnata <movevent event="AddItem" tileitem="1" actionid="3007" script="stone.lua" /> -- 7 komnata <movevent event="AddItem" tileitem="1" actionid="3008" script="stone.lua" /> -- 8 komnata <movevent event="AddItem" tileitem="1" actionid="3009" script="stone.lua" /> -- 9 komnata <movevent event="AddItem" tileitem="1" actionid="3010" script="stone.lua" /> -- 10 komnata
<movevent event="StepIn" actionid="2004" script="stone.lua" /> -- wejscie <movevent event="StepIn" actionid="2005" script="stone.lua" /> -- 1 komnata <movevent event="StepIn" actionid="2006" script="stone.lua" /> -- 2 komnata <movevent event="StepIn" actionid="2007" script="stone.lua" /> -- 3 komnata <movevent event="StepIn" actionid="2008" script="stone.lua" /> -- 4 komnata <movevent event="StepIn" actionid="2009" script="stone.lua" /> -- 5 komnata <movevent event="StepIn" actionid="2010" script="stone.lua" /> -- 6 komnata <movevent event="StepIn" actionid="2011" script="stone.lua" /> -- 7 komnata <movevent event="StepIn" actionid="2012" script="stone.lua" /> -- 8 komnata <movevent event="StepIn" actionid="2013" script="stone.lua" /> -- 9 komnata <movevent event="StepIn" actionid="2014" script="stone.lua" /> -- 10 komnata <!-- End Arena Svargrond -->
Sekcja czerwona sprawdza czy potwór został ubity dlatego w pomieszczeniach do podłogi dopisujemy actionid w karzdym pomieszczeniu inne 1 pomie. 3001, 2 pomie. 3002 Sekcja zielona to teleporty ale zmieniamy tylko ziemi actionid pod teleportem bez wpisywania czego kolwiek w teleport. Ziemia powinna byc bez dodatków tylko teleport na niej.
puźniej w data\movements\scripts robimy plik stone.xml i wpisujemy
Spoiler:-- Svargrond Arena by Szuwar -- Thanks to Noxitu for help
local stone1pos = {x=638,y=276,z=7,stackpos=1} local stone2pos = {x=621,y=276,z=7,stackpos=1} local stone3pos = {x=604,y=276,z=7,stackpos=1} local stone4pos = {x=587,y=276,z=7,stackpos=1} local stone5pos = {x=629,y=259,z=7,stackpos=1} local stone6pos = {x=611,y=259,z=7,stackpos=1} local stone7pos = {x=593,y=259,z=7,stackpos=1} local stone8pos = {x=619,y=242,z=7,stackpos=1} local stone9pos = {x=600,y=242,z=7,stackpos=1} local stone10pos = {x=608,y=226,z=7,stackpos=1}
function onStepIn(cid, item, pos)
local function doCheckLvl(cid, storage) if getPlayerStorageValue(cid, storage) == 1 then -- Greenhorn monsters = {"Frostfur", "Bloodpaw", "Bovinus", "Achad", "Colerian The Barbarian", "The Hairy One", "Axeitus Headbanger", "Rocky", "Cursed Gladiator", "Orcus The Cruel"} elseif getPlayerStorageValue(cid, storage) == 2 then -- Scrapper monsters = {"Avalanche", "Kreebosh the Exile", "The Dark Dancer", "The Hag", "Slim", "Grimgor Guteater", "Drasilla", "Spirit of Earth", "Spirit of Water", "Spirit of Fire"} elseif getPlayerStorageValue(cid, storage) == 3 then -- Warlord monsters = {"Webster", "Darakan the Executioner", "Norgle Glacierbeard", "The Pit Lord", "Svoren the Mad", "The Masked Marauder", "Gnorre Chyllson", "Fallen Mooh'tah Master Ghar", "Deathbringer", "The Obliverator"} end end
local function doChange(cid, pos, creature, tpos) local stone = getThingfromPos(pos) doSetItemActionId(stone.uid,6000) doTeleportThing(cid,tpos) doSendMagicEffect(pos,10) local pos = getThingPos(stone.uid) monster = doSummonCreature(creature, pos) doSendAnimatedText(tpos,"Fight!",198) end
local function doCheckStone(stonepos) local stone = getThingfromPos(stonepos) if stone.actionid ~= 6000 and stone.itemid == 1304 then return 0 elseif stone.actionid == 6000 or stone.itemid ~= 1304 then return 1 end end
local function roomBusy(cid, pos) pos.x = pos.x + 1 doTeleportThing(cid, pos) doPlayerSendTextMessage(cid, 22, "Stand in the line!") end doCheckLvl(cid, 5029) if item.actionid == 2004 and doCheckStone(stone1pos) == 0 then local npos = {x=648,y=281,z=7} doChange(cid, stone1pos, monsters[1], npos) elseif item.actionid == 2005 and doCheckStone(stone2pos) == 0 then local npos = {x=631,y=281,z=7} doChange(cid, stone2pos, monsters[2], npos) doCreateItem(1304,1,stone1pos) elseif item.actionid == 2006 and doCheckStone(stone3pos) == 0 then local npos = {x=613,y=281,z=7} doChange(cid, stone3pos, monsters[3], npos) doCreateItem(1304,1,stone2pos) elseif item.actionid == 2007 and doCheckStone(stone4pos) == 0 then local npos = {x=592,y=281,z=7} doChange(cid, stone4pos, monsters[4], npos) doCreateItem(1304,1,stone3pos) elseif item.actionid == 2008 and doCheckStone(stone5pos) == 0 then local npos = {x=639,y=264,z=7} doChange(cid, stone5pos, monsters[5], npos) doCreateItem(1304,1,stone4pos) elseif item.actionid == 2009 and doCheckStone(stone6pos) == 0 then local npos = {x=621,y=264,z=7} doChange(cid, stone6pos, monsters[6], npos) doCreateItem(1304,1,stone5pos) elseif item.actionid == 2010 and doCheckStone(stone7pos) == 0 then local npos = {x=603,y=264,z=7} doChange(cid, stone7pos, monsters[7], npos) doCreateItem(1304,1,stone6pos) elseif item.actionid == 2011 and doCheckStone(stone8pos) == 0 then local npos = {x=629,y=247,z=7} doChange(cid, stone8pos, monsters[8], npos) doCreateItem(1304,1,stone7pos) elseif item.actionid == 2012 and doCheckStone(stone9pos) == 0 then local npos = {x=610,y=247,z=7} doChange(cid, stone9pos, monsters[9], npos) doCreateItem(1304,1,stone8pos) elseif item.actionid == 2013 and doCheckStone(stone10pos) == 0 then local npos = {x=618,y=231,z=7} doChange(cid, stone10pos, monsters[10], npos) doCreateItem(1304,1,stone9pos) elseif item.actionid == 2014 then doCreateItem(1304,1,stone10pos) local npos = {x=655,y=234,z=6}doTeleportThing(cid, npos) doSendMagicEffect(npos,10) elseif doCheckStone(stone10pos) == 1 then roomBusy(cid, pos) elseif doCheckStone(stone9pos) == 1 then roomBusy(cid, pos) elseif doCheckStone(stone8pos) == 1 then roomBusy(cid, pos) elseif doCheckStone(stone7pos) == 1 then roomBusy(cid, pos) elseif doCheckStone(stone6pos) == 1 then roomBusy(cid, pos) elseif doCheckStone(stone5pos) == 1 then roomBusy(cid, pos) elseif doCheckStone(stone4pos) == 1 then roomBusy(cid, pos) elseif doCheckStone(stone3pos) == 1 then roomBusy(cid, pos) elseif doCheckStone(stone2pos) == 1 then roomBusy(cid, pos) elseif doCheckStone(stone1pos) == 1 then roomBusy(cid, pos) end end
function onAddItem(moveitem, tileitem, pos)
local function doCheckBody(moveitem, stonepos, monster)
local stone = getThingfromPos(stonepos) if moveitem.itemid == 7349 and stone.itemid ~= 0 then doRemoveItem(stone.uid,1) doRemoveItem(moveitem.uid,1) doSendMagicEffect(stonepos,2) elseif moveitem.itemid == 3058 or moveitem.itemid == 3065 then doRemoveItem(moveitem.uid,1) local pos = getThingPos(monster) doCreatureAddHealth(monster,-10000) doCreateItem(1304,1,stonepos) doSetItemActionId(stone.uid,5999) end end
if tileitem.actionid == 3001 then doCheckBody(moveitem, stone1pos, monster) elseif tileitem.actionid == 3002 then doCheckBody(moveitem, stone2pos, monster) elseif tileitem.actionid == 3003 then doCheckBody(moveitem, stone3pos, monster) elseif tileitem.actionid == 3004 then doCheckBody(moveitem, stone4pos, monster) elseif tileitem.actionid == 3005 then doCheckBody(moveitem, stone5pos, monster) elseif tileitem.actionid == 3006 then doCheckBody(moveitem, stone6pos, monster) elseif tileitem.actionid == 3007 then doCheckBody(moveitem, stone7pos, monster) elseif tileitem.actionid == 3008 then doCheckBody(moveitem, stone8pos, monster) elseif tileitem.actionid == 3009 then doCheckBody(moveitem, stone9pos, monster) elseif tileitem.actionid == 3010 then doCheckBody(moveitem, stone10pos, monster) end end
Sekcja czerwona lokalizuje połozenie kamieni które blokuja teleportyw komnatach (stone1pos blokuje w 1 komnacie itd.) zmieniamy połorzenie kamieni
Sekcja zielona jest od teleportów wpisujemy gdzie nas przenosi np. if item.actionid == 2004 and doCheckStone(stone1pos) == 0 then local npos = {x=61,y=31,z=8} odpowiada za przeniesienie z pomieszczenia gdzie zaczynamy wchodzić na arene i teleportuje nas do 1 pomieszczenia {x=61,y=31,z=8} więc tu wpisujemy położenie 1 pomieszczenia
trzeba jeszcze zrobić NPC ktury bedzie sprzedawał wejście na arene Więc w data\npc robimy plik o nazwie Halvar.xml
Spoiler:<npc name="Halvar" script="data/npc/scripts/arena.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="129" head="114" body="119" legs="114" feet="114" corpse="2212"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. Im leader of the Svargrond Arena." /> </parameters> </npc>
I w data/npc/scripts robimy plik arena.xml i wpisujemy
Spoiler: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 creatureSayCallback(cid, type, msg) -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself. if(npcHandler.focus ~= cid) then return false end
if msgcontains(msg, 'arena') then selfSay('For 1000 gp i may give you permission to Greenhorn level. For 5000 gp i give you permission to Scrapper level. Warlord level is for 10000 gp.') elseif msgcontains(msg, 'greenhorn') then selfSay('Do you want permission to Greenhorn level for 1000 gp?') talk_state = 1 elseif msgcontains(msg, 'scrapper') then selfSay('Do you want permission to Scrapper level for 5000 gp?') talk_state = 2 elseif msgcontains(msg, 'warlord') then selfSay('Do you want permission to Warlord level for 10000 gp?') talk_state = 3 -- --------------------------------- confirm yes ---------------------- elseif msgcontains(msg, 'yes') then if talk_state == 1 then doPlayerRemoveMoney(cid,1000) setPlayerStorageValue(cid, 5029, 1) selfSay('Here you go.') elseif talk_state == 2 then doPlayerRemoveMoney(cid,5000) setPlayerStorageValue(cid, 5029, 2) selfSay('Here you go.') elseif talk_state == 3 then doPlayerRemoveMoney(cid,10000) setPlayerStorageValue(cid, 5029, 3) selfSay('Here you go.') end -- -----------------------------------confirm no --------------------------- elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 34) then selfSay('Ok than.') talk_state = 0 end -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself. return true end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Jeśli zrobi sie tak jak napisałem powinno działać na Ots 8.0-8.1 Testowane na B-Fox 7 [seven]
jak sie spodoba to licze na +
|