• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua MoveEvent problem with doConvinceCreature

BugaS

Donżuan
Joined
Mar 12, 2009
Messages
1,219
Reaction score
9
Location
NYC
Hey!

I've got:
LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   if(isPlayerGhost(cid)) then
       return true
   end
   local summons = getCreatureSummons(cid)
   -- remove all summons if player already have summons ;)
   if(table.maxn(summons) > 0) then
       for _, pid in ipairs(summons) do
           doRemoveCreature(pid)
       end
   end
   if(table.maxn(summons) <= 0) then
       local monster = "Raditz"   -- change this to the monster you want to summon
       local monsterAmount = 2   -- Amount of monsters to summon
    
       for i = 1, monsterAmount do
    doConvinceCreature(monster, getCreaturePosition(cid))
end
    
   end
   return true
end

and this error:
[22:2:47.330] [Error - MoveEvents Interface]
[22:2:47.334] data/movements/scripts/summony.lua:onStepIn
[22:2:47.342] Description:
[22:2:47.346] (luaDoConvinceCreature) Creature not found

How to fix it?
 
LUA:
doConvinceCreature(cid, target)
it needs Creature Id & Target

LUA:
local monster = doSummonMonster(name, pos)
doConvinceCreature(monster, cid)
Uses Monster Name & Position

So you could use
 
I think this is what your trying to do..
LUA:
local monsterName = "Raditz"   -- change this to the monster you want to summon
local monsterAmount = 2   -- Amount of monsters to summon

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   if(isPlayerGhost(cid)) then
       return true
   end
   local summons = getCreatureSummons(cid)
   -- remove all summons if player already have summons ;)
   if(table.maxn(summons) > 0) then
       for _, pid in ipairs(summons) do
           doRemoveCreature(pid)
       end
   end
   if(table.maxn(summons) <= 0) then
       for i = 1, monsterAmount do
           local creature = doCreateMonster(monsterName, getCreaturePosition(cid))
           doConvinceCreature(cid, creature)
       end
   end
   return true
end

But why create then convince a monster, when you can just straight up summon the monster?
LUA:
local monsterName = "Raditz"   -- change this to the monster you want to summon
local monsterAmount = 2   -- Amount of monsters to summon

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   if(isPlayerGhost(cid)) then
       return true
   end
   local summons = getCreatureSummons(cid)
   -- remove all summons if player already have summons ;)
   if(table.maxn(summons) > 0) then
       for _, pid in ipairs(summons) do
           doRemoveCreature(pid)
       end
   end
   if(table.maxn(summons) <= 0) then
       for i = 1, monsterAmount do
           doSummonMonster(cid, monsterName)
       end
   end
   return true
end


--edit
LUA:
doConvinceCreature(cid, target)
it needs Creature Id & Target

LUA:
local monster = doSummonMonster(name, pos)
doConvinceCreature(monster, cid)
Uses Monster Name & Position

So you could use

Sorry didn't see your reply.
 
Last edited by a moderator:
Back
Top