• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Summon Monster With Item

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,984
Solutions
2
Reaction score
119
Location
Germany
GitHub
Shawak
Hello,
here a litle script to summon a monster on a ground ;).
Testet with TFS 0.3.4.


How to Install?

Create a summon_item.lua in
data/actions/scripts and paste..
PHP:
--[[ 
	Summon monster with Item
	- by Shawak
]]--

function onUse(cid, item, fromPosition, itemEx, toPosition)

local config = {
	grounds = {    -- grounds // only on it you can summon a monster

	407,           -- black marbe tile // Example

	},


	monster = "Demon",       -- monster that will be summoned  
	removeItem = 1,          -- "1" or "0" // 1 = yes, 2 = no
	articleOfMonster = "a",  -- article of the monster // Example: "a" Demon
	}

	if isInArray(config.grounds,itemEx.itemid) == TRUE then
		if getTilePzInfo(fromPosition) == FALSE then
			if getTilePzInfo(toPossition) == FALSE then
				if config.removeItem >= 1 then
					doRemoveItem(item.uid,1)
				end
				doSendMagicEffect(toPosition, 10)
				doSummonCreature(config.monster, toPosition)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You summoned "..config.articleOfMonster.." "..config.monster..".")
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You can't summon a monster in a projection zone.")
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You can't summon a monster while you are in a projection zone.")
		end
	else
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You can't summon a monster there.")
	end
	return TRUE
end

Then go to..
data/actions/actions.xml
And paste..
PHP:
	<action itemid="4869" script="summon monster.lua"/>

Script FINISH

How it works?

-> I use this item for the script:
PHP:
	<item id="4869" article="a" name="botanist's container">
		<attribute key="description" value="it is empty."/>
		<attribute key="weight" value="1800"/>
	</item>
But you can change the ID, to whatever you want :thumbup:.

-> WARNING:
You can ONLY summon a monster on the grounds,
that you have set.

Here:
PHP:
local config = {
    grounds = {    -- grounds // only on it you can summon a monster

    407,           -- black marbe tile // Example

    },

Example to set more tiles
PHP:
local config = {
	grounds = {    -- grounds // only on it you can summon a monster

	407,           -- black marble tile // Example
	406,           -- white marble tile

	},
I added this:
PHP:
	406,           -- white marble tile
So you can add more and more.
I hope you like it ;).

Regards,
Shawak
 
Last edited:
Note. After last item in table do not use , .
Code:
grounds = {407, 666, 1337},
 
If you have a list with all floors, you can add them in once.
I maked this system, because without it you can summon a demon in a wall :thumbup:.

EDIT:
But if you want

Lua:
--[[ 
    Summon monster with Item
    - by Shawak
]]--

function onUse(cid, item, fromPosition, itemEx, toPosition)

local config = {
    grounds = {459}, -- ignore it

    monster = "Demon",       -- monster that will be summoned  
    removeItem = 1,          -- "1" or "0" // 1 = yes, 2 = no
    articleOfMonster = "a",  -- article of the monster // Example: "a" Demon
    }

	if isInArray(config.grounds,itemEx.itemid) == FALSE then
                if getTilePzInfo(fromPosition) == FALSE then
			if getTilePzInfo(toPossition) == FALSE then
				if config.removeItem >= 1 then
					doRemoveItem(item.uid,1)
				end
				doSendMagicEffect(toPosition, 10)
				doSummonCreature(config.monster, toPosition)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You summoned "..config.articleOfMonster.." "..config.monster..".")
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You can't summon a monster in a projection zone.")
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You can't summon a monster while you are in a projection zone.")
		end
	else
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You can't summon a monster there.")
	end
	return TRUE
end

You can try it, don't know if it's work.

Regards,
Shawak
 
Last edited:
is there a way to summon 3 random monsters? for example, dragon hatching, dragon lord hatching or frost dragon hatchling :D
 
no need grand i need it summon only
 
Back
Top