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

Akkz

New Member
Joined
Apr 22, 2012
Messages
172
Reaction score
0
I get this error in console when I make rotworms/fire elemental, any idea someone how I fix it?

[Error - TalkAction Interface]
data/talkactions/scripts/creature.lua:onSay
Description:
(luaDoCreateMonster) Cannot create monster: rotworm
 
The error is probably that you spam the hotkey and there is no more space -> monster cannot get summoned.

Try replacing:
local ret = func(t[1], position, false)
with:
local ret = func(t[1], position, true)

to extend the area.
 
If that doesnt work, you can make a new talkaction. Name it adv. creature or something...

The script is so if there is monsters all around you, and you make a monster it will teleport the top 3 monsters up away from you.

Also makes NPC's

LUA:
local top_left = {x = getPlayerPosition(cid).x - 1, y = getPlayerPosition(cid).y + 1, z = getPlayerPostition(cid).z, stackpos = 255)
local top_middle = {x = getPlayerPosition(cid).x, y = getPlayerPosition(cid).y + 1, z = getPlayerPosition(cid).z, stackpos = 255}
local top_right = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y + 1, z = getPlayerPosition(cid).z, stackpos = 255}
local left = {x = getPlayerPosition(cid).x - 1, y = getPlayerPosition(cid).y, z = getPlayerPosition(cid).z, stackpos = 255}
local right = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y, z = getPlayerPosition(cid).z, stackpos = 255}
local bottom_left = {x = getPlayerPosition(cid).x - 1, y = getPlayerPosition(cid).y - 1, z = getPlayerPosition(cid).z, stackpos = 255}
local bottom_middle = {x = getPlayerPosition(cid).x, y = getPlayerPosition(cid).y - 1, z = getPlayerPosition(cid).z, stackpos = 255}
local bottom_right = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y - 1, z = getPlayerPosition(cid).z, stackpos = 255}
 
 
local monsters_top = {top_left, top_middle, top_right}
 
local magicEffect = CONST_ME_POFF
local allowed_to_spawn = 4
 
function onSay(cid, words, param, channel)
	if(words == "/m") then
		if getPlayerAccess(cid) >= allowed_to_spawn then
		t = string.explode(param, ",")
		t[1] = monster
		if (isMonster(monster)) then
			if (isMonster(top_left)) then
				if (isMonster(top_middle)) then
					if (isMonster(top_right)) then
						if (isMonster(left)) then
							if (isMonster(right)) then
								if (isMonster(bottom_left)) then
									if (isMonster(bottom_middle)) then
										if (isMonster(bottom_right)) then
											doTeleportThing(monsters_top, getCreaturePosition(monsters_top).x + 1, true)
											doCreateMonster(monster, getPlayerPosition(cid), true)
											doSendMagicEffect(monster, magicEffect)
											return false
											end
										else
											doCreateMonster(monster, bottom_middle)
											doSendMagicEffect(bottom_middle, magicEffect)
											return false
										end
									else
										doCreateMonster(monster, bottom_left)
										doSendMagicEffect(bottom_left, magicEffect)
										return false
										end
									else
									doCreateMonster(monster, right)
									doSendMagicEffect(right, magicEffect)
									return false
									end
									else
									doCreateMonster(monster, left)
									doSendMagicEffect(left, magicEffect)
									return false
									end
								else
								doCreateMonster(monster, top_right)
								doSendMagicEffect(top_left, magicEffect)
								return false
								end
						else
						doCreateMonster(monster, top_middle)
						doSendMagicEffect(top_middle, magicEffect)
						return false
						end
					else
					doCreateMonster(monster, top_left)
					doSendMagicEffect(top_left, magicEffect)
					return false
					end
				else
					if (isNpc(monster)) then
			if (isMonster(top_left)) then
				if (isMonster(top_middle)) then
					if (isMonster(top_right)) then
						if (isMonster(left)) then
							if (isMonster(right)) then
								if (isMonster(bottom_left)) then
									if (isMonster(bottom_middle)) then
										if (isMonster(bottom_right)) then
											doTeleportThing(monsters_top, getPlayerPosition(monsters_top).x + 1, true)
										end
										end
										end
										end
										end
										end
										end
										end
						doCreateNpc(monster, getPlayerPosition(cid), true)
						doSendMagicEffect(monster, magicEffect)
					return false
				end
				end
				else
					doPlayerSendCancel(cid, "You cannot create monsters!.")
			end
		return true
		end
return true
end

Code:
<talkaction log="yes" words="/m" access="4" event="script" value="advanced creature.lua"/>
 
Last edited:
Thank you for the help! summ it did not work to change from false to true :/, then nvm because it's not that important
 
Back
Top