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 = "Rat" -- change this to the monster you want to summon
local monsterAmount = 2 -- Amount of monsters to summon
for monsterAmount do
doSummonCreature(monster, getCreaturePosition(cid))
end
end
return true
end
This should summon 2 rats when the player stepIn to a tile, if the player already have summons it should first remove the summons and then summon 2 new ones. can be added a playerStorage to make it impossible to summon new monsters
Was made for TFS 0.3.6 not tested!
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 = "Rat" -- change this to the monster you want to summon local monsterAmount = 2 -- Amount of monsters to summon for monsterAmount do doSummonCreature(monster, getCreaturePosition(cid)) end end return true end
Sorry, there is an error:
[10:11:32.533] [Error - LuaInterface::loadFile] data/movements/scripts/summony.lua:18: '=' or 'in' expected near 'do'
[10:11:32.535] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/summony.lua)
[10:11:32.535] data/movements/scripts/summony.lua:18: '=' or 'in' expected near 'do'