Na początku dodajemy do folderu: data/action/script/pokeball.lua
Spoiler:local notAllowed = {"czego nie mozna lapac np. Slime", "czego nie mozna lapac np. Demon"} local storage = { status = 25650, pokeName = 25651 } local actionid_used = 7510 function onUse(cid, item, fromPos, item2, toPos) local pokeballStatus = getPlayerStorageValue(cid, storage.status) local pokeName = getPlayerStorageString(cid, storage.pokeName) pos = getPlayerPosition(cid) pos.stackpos = 0 if getTilePzInfo(toPos) == 0 and getTilePzInfo(pos) == 0 then if pokeballStatus == -1 then toPos.stackpos = 253 local pokeThing = getThingfromPos(toPos) if isCreature(pokeThing.uid) == TRUE then if isPlayer(pokeThing.uid) == FALSE then local pokename_ = getCreatureName(pokeThing.uid) if item.actionid ~= actionid_used then -- local maxHealth = 400 -- local creatureHealth = getCreatureHealth(pokeThing.uid) -- local divNum = (string.len(maxHealth)-1)^2 -- local result = math.floor((creatureHealth/divNum)/10) -- local chance = math.random(1, math.random(4, math.random(7, math.max(result, 7)))) -- if chance == result then if isInTable(notAllowed, pokename_) == TRUE then doPlayerSendCancel(cid, "Nie mozesz tego lapac!") else setPlayerStorageString(cid, storage.pokeName, pokename_) doRemoveCreature(pokeThing.uid) doSendDistanceShoot(fromPos, toPos, 37) setPlayerStorageValue(cid, storage.status, 1) doSetItemSpecialDescription(item.uid, "To zawiera " .. pokename_ .. ".") doSetItemActionId(item.uid, actionid_used) end -- else -- doSendMagicEffect(fromPos, 2) -- doPlayerSendCancel(cid, "Pokemon wolny!") -- end elseif item.actionid == actionid_used and pokename_ == pokeName then doPlayerSay(cid, pokeName .. " WRACAJ!", TALKTYPE_SAY) doRemoveCreature(pokeThing.uid) doSetItemSpecialDescription(item.uid, "To zawiera " .. pokename_ .. ".") setPlayerStorageValue(cid, storage.status, 1) doSendDistanceShoot(fromPos, toPos, 37) else doSendMagicEffect(fromPos, 2) doPlayerSendCancel(cid, "Ten pokeball jest uzywany!") end else doPlayerSendCancel(cid, "Nie mozesz tego lapac!") end else doPlayerSendCancel(cid, "Nie ma takiego potwora!") end elseif pokeballStatus == 1 then summons = getCreatureSummons(cid) -- if #summons >= 2 then -- doPlayerSendCancel(cid, "Nie mozesz przyzwac wiecej pokemonow") -- else doConvinceSummon(cid, pokeName, 0, toPos) doSendDistanceShoot(fromPos, toPos, 37) doPlayerSay(cid, pokeName .. " IDZ!", TALKTYPE_SAY) setPlayerStorageValue(cid, storage.status, -1) doSetItemSpecialDescription(item.uid, "Jest pusty.") -- end end else doPlayerSendCancel(cid, "Nie mozesz tego uzyc w PZ.") end return 1 end function isInTable(t, val) for _, v in pairs(t) do if v == val then return TRUE end end return LUA_ERROR end
Następnie do folderu: data/action/actions.xml dodajemy:
Spoiler:<action itemid="ID Pokeball'a" script="pokeball.lua" allowfaruse="1" blockwalls="1" />
Ale pamietaj!Pokeball musi byc rzecza ktora mozna uzyc "with crosshair"! Np.2152-Talon
Aha...
Dodaj do global.lua:
|
Chodziło mi o "use with", a błąd wywala bo nie masz takiej funkcji :p
Zaraz ją dam:
Dodaj do global.lua:
|
A teraz, zamień to stare w global.lua na to:
|