• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Soul Capturing Orb Idea // need help finishing this script...

Blood BlvD Ot

Member
Joined
Jun 12, 2010
Messages
243
Reaction score
7
Code:
 function setItemName(uid,name)
		return doItemSetAttribute(uid,'name',name)
    end	
	
function onUse(cid, item, frompos, item2, topos)

local Summon = getCreatureSummons(cid)
local monsterName = getCreatureName(target)
local monsters = "Rat","Demon"
local monsterPos = getCreaturePosition(target)
local orbID = 5944
local pos = getPlayerPosition(cid)
	
	if item.uid == orbID then
		if isPlayer(target) then
			doPlayerSendCancel(cid,"You can only use this orb on sertain Monsters")
			elseif (isInArray({monsters}, getItemAttribute(item.uid, "name")) == TRUE) then
				if table.maxn(getCreatureSummons(cid)) > 0 then	
				doPlayerSendCancel(cid, "You can't summon more.")
				elseif(getTilePzInfo(getCreaturePosition(cid)) == true) then
				doCreatureSay(cid, "You cannot use in PZ!", TALKTYPE_ORANGE_1)
				else
					doConvinceCreature(cid, doCreateMonster("".. getItemAttribute(item.uid, "name") .."", pos))
				end
			elseif(isInArray({monsters}, monsterName) == TRUE) and getCreatureHealth(target) < (math.random(1000,5000)) then 
				doRemoveCreature(target)
				doSendMagicEffect(monsterPos,2)
				setItemName(uid,"".. monsterName .."")
				doRemoveItem(item.uid)
				setItemName(doPlayerAddItem(orbID,1),monsterName)
				else
		end
	end
return true
end
...
 
Last edited:
I had an idea like this too, and you can take their souls, and turn it in to an NPC for certain items :)
Say this..

Kills 1000 Demons & Takes Their Souls
Takes The Soul Orb To Nyugi (Soul Keeper)
Trades In 1000 Souls For The Axe Of 1000 Souls
 
And is it yours forever? Like say, you start out as the vocation "Soul Keeper" with a Ghost, and as you advance, if you pk a lot and kill people, your ghost turns into a demon, but if your good, your ghost turns into another monster (couldn't think of a good ghost in tibia)
 
@ Xx Shadow xX that idea is actually easier than u think.
onKill
if getplayer voc is # then
setPlayerStorageValue(#,((getPlayerStorageValue(#)+1))
.
next script,
onSay,or onCast.
if getPlayerStorageValue(#) >= 1 then
do summon first one convinced...
if getPlayerSorageValue(#) >= 100 then..
so on n so forth xD

and prob to keep the storage value from gettin too high u can do some kind of loopy thing where if one storage gets to a sertain amount u can set another to +1 and set the first one to 0 again.
 
I have a few talkactions related to summons being stored and what-not. If you want to work from there hit me up with a PM and I'll send 'em your way if you're interested.
 
Weird script, So messy :D
This:
LUA:
"Rat","Demon"
Should be this:
LUA:
{"Rat","Demon"}

Then, why are you elseifing an elseif which kinda contains the same stuff
LUA:
elseif (isInArray({monsters}, getItemAttribute(item.uid, "name")) == TRUE) then
Is the same as this:
LUA:
elseif(isInArray({monsters}, monsterName) == TRUE)
Plus, no need to put TRUE :p

Then you are elseing to nothing :o
LUA:
setItemName(doPlayerAddItem(orbID,1),monsterName)
else
		end

Andd,
Why are you settin the item a name and then removing the item and setting the name again oo
LUA:
setItemName(uid,"".. monsterName .."")
      doRemoveItem(item.uid)
      setItemName(doPlayerAddItem(orbID,1),monsterName)

So, something like this?
LUA:
function setItemName(uid,name)
		return doItemSetAttribute(uid,'name',name)
    end	
	
function onUse(cid, item, frompos, item2, topos)

local Summon = getCreatureSummons(cid)
local monsterName = getCreatureName(target)
local monsters = {"Rat","Demon"}
local monsterPos = getCreaturePosition(target)
local orbID = 5944
local pos = getPlayerPosition(cid)

if isPlayer(target) then
   doPlayerSendCancel(cid,"You can only use this orb on sertain Monsters")
end

if table.maxn(getCreatureSummons(cid)) > 0 then	
   doPlayerSendCancel(cid, "You can't summon more.")
else
    doConvinceCreature(cid, doCreateMonster("".. getItemAttribute(item.uid, "name") .."", pos))
end

if getTilePzInfo(getCreaturePosition(cid)) == true then
   doCreatureSay(cid, "You cannot use in PZ!", TALKTYPE_ORANGE_1)
end	

if item.uid == orbID then
   if isInArray({monsters}, monsterName) == true and getCreatureHealth(target) < (math.random(1000,5000)) then
      doRemoveCreature(target)
      doSendMagicEffect(monsterPos,2)
      setItemName(uid,"".. monsterName .."")
      doRemoveItem(item.uid)
      setItemName(doPlayerAddItem(orbID,1),monsterName)
   end
end
return true
end

U rox
 
Theres some problems in that too, the if in pz needs to be on the tree before the summon.

u need to send the magic effect before you remove too I believe..
remove setItemName(uid that makes no sence cuz u just remove it right after that.
 
What this does, is if the creature ur targeting is soul captureable then it removes the creatre and the item, then remakes the item to the creatures name.
in the same script it says, if using the item and it contains one of the mosnters names, docreatemonster(do summon monsters)
if not then if the target is one of the capturable monsters loop n lalalalalala its an odd idea.. lol.
 
Mazen @ OTfans has made that kind of script Action: Catch Monsters
Here is the script: Credits goes to Mazen (the script is pretty old)
LUA:
-- Options for releasing the monster with another item --
local useBreakWithItem = false -- Enable this feature
local breakWithItem = 7428 -- Item to release the monster with.
 
-- Item Options --
local setActionId = 1000 -- Action id that will be set for an used item.
local breakChanse = 500 -- Break chanse. For example: if breakChanse = 500 then break chanse will be ((CurrentHp/monsterMaxHp)*monsterMaxHp)/500).
 
-- Limits --
local playerLevel = 50 -- Player level needed.
local monsterStatus = "convinced" -- Keep it as "convinced" if you want the monster to be like a pet for the releaser, otherwise make it "wild".
local avalibleMonsters = {"Butterfly", "Dragon", "Rat", "Demon"} -- Monsters that is possible to catch. ALWAYS write the name exactly as it is written in the monster files(It maters in this case).
local validVocations = {0, 1, 2, 3, 4, 5, 6, 7, 8} -- Vocationids of vocations that are able to use this item.
 
-- Effects --
local breakEffect = CONST_ME_POFF -- This effect will apear on the item when it breakes.
local usedEffect = CONST_ME_POFF -- This effect will apear on the item if it is used.
local successEffect = CONST_ME_MAGIC_GREEN -- This effect will apear on the monster when it's catched.
local releaseEffect = CONST_ME_FIREWORK_RED -- This effect will apear when the monster is released.
 
-- Messages --
local emptyDesc = "It\'s empty." -- Description that will be set for the item when the monster is released.
 
local messageColor = TALKTYPE_ORANGE_1
local successMessages = {"You\'ve succefully caught the monster.", "Success!!"} -- Success messages when the creature is caught.
local failureMessages = {"You\'ve failed to catch the monster.", "The monster ran away."} -- Failure messages.
local usedMessages = {"This item is already used", "You\'ve already used this item."} -- One of these messages apears if the item is already used.
local abortMessages = {"You\'ve failed to catch the monster.", "The monster is too strong."} -- Abort messages if the monster is in the ignore list above.
local notOnGroundMessage = {"Please put the item on the ground first.", "You can\'t release the creature in your backpack."} -- These messages apears if the item is not on the ground.
local inOnInvalidGround = {"The item is on a protected zone.", "You can\'t release the monster here."} -- These messages apears if the item is on a protected zone.
local tooLowLevel = {"You are too low level to use this item, you'll need level ".. playerLevel .." or higher."}
local invalidVocation = {"You are not able to use this item."}
 
--------------- END OF CONFIG -------------
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerLevel(cid) < playerLevel then
		sendMessage(cid, tooLowLevel, messageColor)
		return true
	end
 
	if not isInArray(validVocations, getPlayerVocation(cid)) then
		sendMessage(cid, invalidVocation, messageColor)
		return true
	end
 
	if useBreakWithItem then
		if item.itemid == breakWithItem and releaseMonster(cid, itemEx, toPosition) then
			return true
		end
	else
		if releaseMonster(cid, item, toPosition) then
			return true
		end
	end
 
	if item.actionid > 100 then
		if item.actionid ~= setActionId then
			doItemSetAttribute(item.uid, "aid", setActionId)
		end
		sendMessage(cid, usedMessages, messageColor)
		doSendMagicEffect(getCreaturePosition(cid), usedEffect)
		return true
	end
	if isMonster(itemEx.uid) then
		monsterFullHp, monsterHp = getCreatureMaxHealth(itemEx.uid), getCreatureHealth(itemEx.uid)
		formula = (monsterHp/monsterFullHp)*monsterFullHp
		chanse, bchanse = math.random(1, formula), math.floor(formula)
		if (chanse+breakChanse) >= bchanse then
			s = 0
			for i = 1, #avalibleMonsters do
				if getCreatureName(itemEx.uid) ~= avalibleMonsters[i] then
					s = s + 1
				end
			end
			if s == #avalibleMonsters then
				sendMessage(cid, abortMessages, messageColor)
				doSendMagicEffect(getCreaturePosition(cid), breakEffect)
				return true
			end
			doItemSetAttribute(item.uid, "description", "It contains a captured ".. getCreatureName(itemEx.uid) ..".")
			doItemSetAttribute(item.uid, "aid", setActionId)
			doRemoveCreature(itemEx.uid)
			sendMessage(cid, successMessages, messageColor)
			doSendMagicEffect(toPosition, successEffect)
		else
			if getCreatureMaster(itemEx.uid) ~= cid then
				doRemoveItem(item.uid, 1)
			end
			doSendMagicEffect(getCreaturePosition(cid), breakEffect)
			sendMessage(cid, failureMessages, messageColor)
		end
	else
		doSendMagicEffect(getCreaturePosition(cid), breakEffect)
	end
	return true
end
 
function sendMessage(cid, table, color)
	if table[1] == nil then
		return nil
	end
	messageId = math.random(1, #table)
	doCreatureSay(cid, table[messageId], color)
end
 
function releaseMonster(cid, itemEx, toPosition)
	if itemEx.actionid == setActionId then
		for i = 1, #avalibleMonsters do
			desc = getItemDescriptions(itemEx.uid).special
			local fromS, toS = desc:find(avalibleMonsters[i])
			if toS then
				if toPosition.x ~= CONTAINER_POSITION then
					if not getTilePzInfo(getThingPos(itemEx.uid)) then
						monsPar = doCreateMonster(desc:sub(fromS, toS), toPosition)
						if monsterStatus == "convinced" then
							doConvinceCreature(cid, monsPar)
						end
						doItemSetAttribute(itemEx.uid, "aid", 0)
						doItemSetAttribute(itemEx.uid, "description", emptyDesc)
						doSendMagicEffect(getCreaturePosition(monsPar), releaseEffect)
					else
						sendMessage(cid, inOnInvalidGround, messageColor)
						doSendMagicEffect(getCreaturePosition(cid), breakEffect)
					end
					return true
				else
					sendMessage(cid, notOnGroundMessage, messageColor)
					doSendMagicEffect(getCreaturePosition(cid), breakEffect)
				end
				break
			end
		end
	end
	return false
end
EDIT:
He has a profile here in OTland http://otland.net/members/mazen/
 
Last edited:
Yup yup thats exactly the idea, just a 1000x smarter LUA scripter wrote it :D xD.
Thanks very much repp++

Frig, that was my next move too, was gonna make 2 seporate items. One just plain use, one to target the mosnters themselves :3.
 
Back
Top