• 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!

Sloved

Try this:
Code:
function onCastSpell(cid, var)
doCreatureSay(cid, "Come to me demon!", TALKTYPE_SAY)
doSummonMonster(cid, "Demon")
local de = getCreatureSummons(cid)[1]
doCreatureSetLookDir(de, 2)
doConvinceCreature(cid, de)
end
 
@up
To get the demon uid just use: local de = doSummonMonster(cid, "Demon")
I think doConvince~ wont work as it checks if the player can convince the monster..
 
Some time ago when i'm using older engine if i don't convince summon they don't attack with me. And this script work then. But he need to tried it and tell us is it work good.
 
LUA:
function onUse(cid, item, fromPosition, itemEx, topos)
if(getTilePzInfo(getCreaturePosition(cid)) == true) then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't summon in pz.")
	return true
end
if table.maxn(getCreatureSummons(cid)) <= 0 then -- ändra till max antalet summons
doSummonMonster(cid, "Demon")
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You already have a summon.")
end
return true
end

This will summon a demon and remove the rune. don't forget to add the lines in actions.xml.

I'm really tired so if I missunderstood what you wanted please explain better :)


edit: liten uppdatering av scriptet
 
Last edited:
LUA:
local config = {
	monsters = {
		['Demon'] = {}
		}
	}

function onCastSpell(cid, var)
if isMonster(getTopCreature(var.pos).uid) then
if config.monsters[getCreatureName(getTopCreature(var.pos).uid)] then
if math.random(10) == 1 then
local container = doPlayerAddItem(cid, 2272)-- change to right itemid
doItemSetAttribute(container, "description", "It contains a captured " .. getCreatureName(getTopCreature(var.pos).uid) .. ".")
doRemoveCreature(getTopCreature(var.pos).uid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry didn't work.") -- remove if you want
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry can't use with this animal.") -- remove if you want
return false
end
end
return true
end

It is possible to fix this for more monsters, just need to add a little more.. but for now it only works with demon.. you can use a global or something to store the name and then get the global in the other script where you summon it.

rep me =)
 
REP ++ please

LUA:
local config = {
	monsters = {
		['Demon'] = {}
		}
	}
 
function onCastSpell(cid, var)
if isMonster(getTopCreature(var.pos).uid) then
if isSummon(getTopCreature(var.pos).uid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't catch summons.")
return true
end
if config.monsters[getCreatureName(getTopCreature(var.pos).uid)] then
if math.random(10) == 1 then
local container = doPlayerAddItem(cid, 2272)-- change to right itemid
doItemSetAttribute(container, "description", "It contains a captured " .. getCreatureName(getTopCreature(var.pos).uid) .. ".")
doRemoveCreature(getTopCreature(var.pos).uid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry didn't work.") -- remove if you want
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry can't use with this animal.") -- remove if you want
return false
end
end
return true
end
 
There is nothing called isSummon as far as I know, not on tfs 0.3.6 atleast

LUA:
local config = {
	monsters = {
		['Demon'] = {}
		}
	}

function onCastSpell(cid, var)
if not(getCreatureMaster(getTopCreature(var.pos).uid) == getTopCreature(var.pos).uid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do this to summons.")
return false
end
if isMonster(getTopCreature(var.pos).uid) then
if config.monsters[getCreatureName(getTopCreature(var.pos).uid)] then
if math.random(10) == 1 then
local container = doPlayerAddItem(cid, 2272)-- change to right itemid
doItemSetAttribute(container, "description", "It contains a captured " .. getCreatureName(getTopCreature(var.pos).uid) .. ".")
doRemoveCreature(getTopCreature(var.pos).uid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry didn't work.") -- remove if you want
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry can't use with this animal.") -- remove if you want
return false
end
end
return true
end
this will work
 
LUA:
local config = {
	monsters = {
		['Demon'] = {}
		}
	}

function onCastSpell(cid, var)
local container = doPlayerAddItem(cid, 2272)-- change to right itemid
if getCreatureMaster(getTopCreature(var.pos).uid) == cid then
doItemSetAttribute(container, "description", "It contains a captured " .. getCreatureName(getTopCreature(var.pos).uid) .. ".")
doRemoveCreature(getTopCreature(var.pos).uid)
return true
end
if not(getCreatureMaster(getTopCreature(var.pos).uid) == getTopCreature(var.pos).uid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do this to summons.")
return false
end
if isMonster(getTopCreature(var.pos).uid) then
if config.monsters[getCreatureName(getTopCreature(var.pos).uid)] then
if math.random(10) == 1 then
doItemSetAttribute(container, "description", "It contains a captured " .. getCreatureName(getTopCreature(var.pos).uid) .. ".")
doRemoveCreature(getTopCreature(var.pos).uid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry didn't work.") -- remove if you want
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry can't use with this animal.") -- remove if you want
return false
end
end
return true
end

there =) rep ++ if you haven't already
 
Back
Top