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

Why does this script not work?

Erexo

Kage
Premium User
Joined
Mar 27, 2010
Messages
743
Solutions
5
Reaction score
200
Location
Pr0land
GitHub
Erexo
Hello,
im again have a small problem ;P

This is a script:

Code:
local max = 2
function onCastSpell(cid, var)
	local count, pos = #getCreatureSummons(cid), getThingPos(cid)
	if count == max then
		doPlayerSendCancel(cid, 'You cannot make more bunshins.')
		doSendMagicEffect(pos, CONST_ME_POFF)
		return false
	end
 
 
	for i = 1, max - count do
		local v = doSummonMonster(cid, 'bunshin1')
		if v ~= 1 then
			doPlayerSendDefaultCancel(cid, v)
			doSendMagicEffect(pos, CONST_ME_POFF)
			return i ~= 1
		end
		doSendMagicEffect(getThingPos(getCreatureSummons(cid)[count+i]), CONST_ME_TELEPORT)
	end
	doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
	return true
end

Its summons a creature, all is okay but...
i wanna they monsters have the same outfit/hp/mana/speed to the owner...

Im found some kind of this:
Code:
	setCreatureMaxHealth(creature, getCreatureMaxHealth(cid) / 2)
	doCreatureAddHealth(creature, getCreatureMaxHealth(cid))
	setCreatureMaxMana(creature, getCreatureMaxMana(cid) / 2)
	doCreatureAddMana(creature, getCreatureMaxMana(cid))
	doChangeSpeed(creature, getCreatureBaseSpeed(cid))
	doSetCreatureOutfit(creature, 426, -1)

But, no work...

Someone can help me? :( Please

Erexo.
 
LUA:
local max = 2

function onCastSpell(cid, var)
	local count, pos = #getCreatureSummons(cid), getThingPos(cid)
	if count == max then
		doPlayerSendCancel(cid, 'You cannot make more bunshins.')
		doSendMagicEffect(pos, CONST_ME_POFF)
		return false
	end

	for i = 1, max - count do
		local v = doSummonMonster(cid, 'bunshin1')
		if v ~= 1 then
			doPlayerSendDefaultCancel(cid, v)
			doSendMagicEffect(pos, CONST_ME_POFF)
			return i ~= 1
		end
		local k = getCreatureSummons(cid)[count+i]
		doSendMagicEffect(getThingPos(k), CONST_ME_TELEPORT)
		setCreatureMaxHealth(k, getCreatureMaxHealth(cid))
		doCreatureAddHealth(k, getCreatureMaxHealth(k))
		doChangeSpeed(k, getCreatureBaseSpeed(cid) - getCreatureBaseSpeed(k))
		doCreatureChangeOutfit(k, {lookType=426})
	end
	doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
	return true
end
 
Hehe,
work :)
Thanks you very muth...

could you change that script to be summoning character with diffrent attributes from level?
 
Hmm,
if you have 10-49lvl, you summon a dragon, with outfit 100 and 1000hp
if you have 50-99 you summon a dragon lord, with outfit 101 and 1500hp
if you have 100lvl+ you summon a demon, with outfit 102 and 2000hp

Do you understand ? ^^
 
LUA:
local max = 2

local t = {
	[{1,49}] = {name='Dragon', outfit=100, hp=1000},
	[{50,99}] = {name='Dragon Lord', outfit=101, hp=1500},
	[{1,49}] = {name='Demon', outfit=102, hp=2000}
}

function onCastSpell(cid, var)
	local count, pos = #getCreatureSummons(cid), getThingPos(cid)
	if count >= max then
		doPlayerSendCancel(cid, 'You cannot make more bunshins.')
		doSendMagicEffect(pos, CONST_ME_POFF)
		return false
	end

	local lvl = getPlayerLevel(cid)
	for a, b in pairs(t) do
		if lvl >= a[1] and lvl <= a[2] then
			for i = 1, max - count do
				local v = doSummonMonster(cid, b.name)
				if v ~= 1 then
					doPlayerSendDefaultCancel(cid, v)
					doSendMagicEffect(pos, CONST_ME_POFF)
					return i ~= 1
				end
				local k = getCreatureSummons(cid)[count+i]
				doSendMagicEffect(getThingPos(k), CONST_ME_TELEPORT)
				doChangeSpeed(k, getCreatureBaseSpeed(cid) - getCreatureBaseSpeed(k))

				setCreatureMaxHealth(k, b.hp)
				doCreatureAddHealth(k, b.hp)
				doCreatureChangeOutfit(k, {lookType=b.outfit})
			end
			break
		end
	end
	doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
	return true
end
 
Back
Top