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

Lua Summons a monster for a player

Status
Not open for further replies.
Joined
Jun 19, 2009
Messages
1,852
Reaction score
5
Hello!

First off, I've disabled the utevo res spell in my server... so this is the only way to get a summon.


if you click on item id = 7726 then a "Minotaur Archer" will get summoned for you... it should basically work like utevo res

Only mino archer should be summoned and nothing else. And it will only work with vocation ids: 3, 6, 11 and max 2 mino archers.

thanks!
 
Add 7726 to actions.xml
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerVocation(cid) == isInArray({3, 6, 11}) then
		doCreateMonster(cid, "Minotaur Archer", getCreaturePosition(cid))
                doConvinceCreature(cid, "Minotaur Archer")
	return TRUE
end
 
Last edited:
Add 7726 to actions.xml
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerVocation(cid) == 3, 6, 11 then
		doSummonMonster("Minotaur Archer", getCreaturePosition(cid))
	return TRUE
end
shouldnt the "3, 6, 11" be like that "{3, 6, 11}" or am i wrong? or it should be like this:
"if isDruid or isSorcerer or isKnight" etc?
or something like this " isInArray({3, 6, 11}, getPlayerVocation(cid))"
 
Code:
local t = {
	name = 'Minotaur Archer',
	limit = 2,
	vocation = 'Paladin' -- has to be Title case!
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local foo = _G['is' ..t.vocation]
	if foo and foo(cid) then
		if #getCreatureSummons(cid) < t.limit then
			local ret = doSummonMonster(cid, t.name)
			if ret ~= RETURNVALUE_NOERROR then
				doPlayerSendDefaultCancel(cid, ret)
			end
		else
			doPlayerSendCancel(cid, "You cannot summon more creatures.")
		end
	else
		doPlayerSendCancel(cid, "Your vocation cannot use this item.")
	end
	return true
end
 
hi guys, i forgot to mention that i want it in mod version :/

thanks

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="unknown" enabled="yes">
	<action uniqueid="8000" event="script"><![CDATA[
		local t = {
			name = 'Minotaur Archer',
			limit = 2,
			vocation = 'Paladin' -- has to be Title case!
		}
		local foo = _G['is' ..t.vocation]
		if foo and foo(cid) then
			if #getCreatureSummons(cid) < t.limit then
				local ret = doSummonMonster(cid, t.name)
				if ret ~= RETURNVALUE_NOERROR then
					doPlayerSendDefaultCancel(cid, ret)
				end
			else
				doPlayerSendCancel(cid, "You cannot summon more creatures.")
			end
		else
			doPlayerSendCancel(cid, "Your vocation cannot use this item.")
		end
		return true
	]]></action>
</mod>
 
Status
Not open for further replies.
Back
Top