marcinfilipiak
Well-Known Member
Welcome.
Recently searched and searched until I found the basis for the script to catch the system, go / back under 8.7.
It is about a system for RPG server (not Pokemon), catch the Djinn in the lamp, and you can still hunt.
The script is clear and it works but there are a few features that I'd like to add your help.
For example:
-Max 1 summon, as it appears in Pokémon.
-The life and memory of the NPC, who healed the service of our dead Djin.
-Item, which at the time expienia help us heal the dead Djin.
-The so-called evolution, just as it looks in the Pokémon.
I think it will help me, because as I am bad at this game, I think that will help. Of course, after completing the work of the script will be fully released under the GPL.
Sorry for any mistakes I use a translator.
The base consists of several files:
lamp.lua - This file is placed exactly where our server config lua.
Catch.lua, which is responsible for catching.
The second file is goback.lua
In addition to creaturescript added something like "goback.lua"
The actions.xml:
The creaturescripts.xml:
The login.lua:
If anyone can do it in a smaller number of files it would be fun.
I wish it was like a script from the Pokemon just that the version 8.7. Because after many attempts of Pokemon OT scripts do not work.
Regards, Tracer.
Recently searched and searched until I found the basis for the script to catch the system, go / back under 8.7.
It is about a system for RPG server (not Pokemon), catch the Djinn in the lamp, and you can still hunt.
The script is clear and it works but there are a few features that I'd like to add your help.
For example:
-Max 1 summon, as it appears in Pokémon.
-The life and memory of the NPC, who healed the service of our dead Djin.
-Item, which at the time expienia help us heal the dead Djin.
-The so-called evolution, just as it looks in the Pokémon.
I think it will help me, because as I am bad at this game, I think that will help. Of course, after completing the work of the script will be fully released under the GPL.
Sorry for any mistakes I use a translator.
The base consists of several files:
lamp.lua - This file is placed exactly where our server config lua.
Code:
config = {lamp_id = 2141, used_lamp = 4873, summoned = 6453}
t = {["Djin"] = {["100"] = 10},} -- MODEL: ["MONSTER_NAME"] = {["CHANCE_PERCENT"] = LIFE_PERCENT},
t2 = {[1001] = "Djin",} -- MODEL: [MONSTER_STORAGE] = "MONSTER_NAME",
-- KAŻDY MONSTER MUSI MIEĆ INNE STORAGE
function string.trim(str)
return (string.gsub(str, "^%s*(.-)%s*$", "%1"))
end
function string.explode(str, sep)
local pos, t = 1, {}
if #sep == 0 or #str == 0 then return end
for s, e in function() return string.find(str, sep, pos) end do
table.insert(t, string.trim(string.sub(str, pos, s-1)))
pos = e+1
end
table.insert(t, string.trim(string.sub(str, pos)))
return t
end
Catch.lua, which is responsible for catching.
Code:
dofile("./lamp.lua")
function onUse(cid, item, fromPosition, itemEx, toPosition)
for k,v in pairs(t) do
for kk,vv in pairs(v) do
if getCreatureName(itemEx.uid) == k then
if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(itemEx.uid)) <= 1 then
if getCreatureHealth(itemEx.uid) <= getCreatureMaxHealth(itemEx.uid)/vv then
if math.random(1,100) <= tonumber(kk) then
doRemoveCreature(itemEx.uid)
doSendMagicEffect(toPosition, CONST_ME_FIREWORK_BLUE)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Yo u cought a wild ".. k .."!")
doRemoveItem(item.uid, 1)
mb = doPlayerAddItem(cid, config.lamp_id, 1)
doItemSetAttribute(mb, "description", "It contains ".. k)
else
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT, "Your lamp broke!")
doSendMagicEffect(toPosition, CONST_ME_POFF)
end
else
doPlayerSendCancel(cid, "You have to do some attacks before catch.")
end
else
doPlayerSendCancel(cid, "You need to be closer.")
end
end
end
end
return true
end
The second file is goback.lua
Code:
dofile("./lamp.lua")
function onUse(cid, item, fromPosition, itemEx, toPosition)
for k,v in pairs(t2) do
if item.itemid == config.lamp_id then
if string.explode(getItemAttribute(item.uid, "description"), " ")[3] == v then
doTransformItem(item.uid, config.used_lamp)
x = doCreateMonster(v, getThingPos(cid))
doConvinceCreature(cid, x)
doSendMagicEffect(getThingPos(x), CONST_ME_TELEPORT)
doCreatureSay(cid, v ..", go!", MESSAGE_FIRST)
setPlayerStorageValue(cid, config.summoned, 1)
if getPlayerStorageValue(cid, k) == -1 then
doCreatureAddHealth(x, getCreatureMaxHealth(x)-getCreatureHealth(x))
else
doCreatureAddHealth(x, - getCreatureHealth(x) + getPlayerStorageValue(cid, k))
end
else
doPlayerSendTextMessage(cid, 22, "ERROR[1]:: Please send this message to admin.")
end
else
if #getCreatureSummons(cid) <= 0 then
doTransformItem(item.uid, config.lamp_id)
else
doCreatureSetStorage(cid, k, getCreatureHealth(getCreatureSummons(cid)[1]))
doSendMagicEffect(getThingPos(getCreatureSummons(c id)[1]), CONST_ME_TELEPORT)
if doRemoveCreature(getCreatureSummons(cid)[1]) then end
doTransformItem(item.uid, config.lamp_id)
setPlayerStorageValue(cid, config.summoned, -1)
doCreatureSay(cid, v ..", back!", MESSAGE_FIRST)
end
end
end
return true
end
In addition to creaturescript added something like "goback.lua"
Code:
dofile("./lamp.lua")
function onLogout(cid, interval)
if isPlayer(cid) then
if getPlayerStorageValue(cid, config.summoned) ~= -1 then
setPlayerStorageValue(cid, config.summoned, -1)
end
end
return true
end
The actions.xml:
Code:
<!-- Lamp -->
<action itemid="4863" event="script" value="catch.lua" allowfaruse="1"/>
<action itemid="2141;4873" event="script" value="goback.lua" allowfaruse="1"/>
Code:
<!-- Go/Back -->
<event type="logout" name="goback" event="script" value="goback.lua"/>
The login.lua:
Code:
registerCreatureEvent(cid, "goback")
If anyone can do it in a smaller number of files it would be fun.
I wish it was like a script from the Pokemon just that the version 8.7. Because after many attempts of Pokemon OT scripts do not work.
Regards, Tracer.