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

CreatureEvent Monster Summoning Book/Paper

owned

Excellent OT User
Joined
Nov 9, 2008
Messages
2,001
Solutions
3
Reaction score
559
Location
New York
Hello Guys, Today i would like to present a script i made that someone requested i make! What it does is, if you open a writable document and type in a certain word, then it will summon a monster! U can set certain monsters to require storage values if you choose! Will have an exhuast of 60 seconds between summons, can be changed. Here Goes:

Summon.lua -- Should be placed in your scripts folder found in CreatureEvents
Lua:
--Script By Owned @Otland
local t = {
	["Demon"] = {monster = "Demon", storage = 7890, secondstorage = 8890, time = 60, message = "You are currently unable to summon this monster! In order to summon this monster, you must complete XXX Mission"}, --the first storage is the storage required to summon monster!
	["Dog"] = {monster = "Dog", storage = 7891, secondstorage = 8891, time = 60, message = "You are currently unable to summon this monster! In order to summon this monster, you must complete XXX Mission"},
	["Cat"] = {monster = "Cat", storage = 7892, secondstorage = 8892, time = 60, message = "You are currently unable to summon this monster! In order to summon this monster, you must complete XXX Mission"},
	["Troll"] = {monster = "Troll", storage = 7893, secondstorage = 8893, time = 60, message = "You are currently unable to summon this monster! In order to summon this monster, you must complete XXX Mission"}
}

function onTextEdit(cid, item, newText)

	if item.itemid == 1947 then -- Item id of the writable item.
	if isInArray({'Summons', 'summons'}, newText) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Current Summons: Demon, Dog, Cat, Troll. Remember to use Uppercase Letters when typing!!!")
	else
	
	if getTilePzInfo(getCreaturePosition(cid)) ~= false then
		doPlayerSendCancel(cid, "You cannot summon a monster in a Protection Zone!")
	return false
	end
	
	local tt = t[newText]
	if not tt then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Invalid Monster")
	return false
	end		

	local ts = tt.storage
	local tm = tt.message
	if getCreatureStorage(cid, ts) < 1 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, tm)
	return true
	end
	
	local tss = tt.secondstorage
	if getCreatureStorage(cid, tss) > os.time() then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait another " .. getCreatureStorage(cid, tss) - os.time() .. ' second' .. (getCreatureStorage(cid, tss) - os.time() == 1 and "" or "s") .. " to summon this monster again")
	return true
	end	
	
	local ttt = tt.time
	local summon = tt.monster		
		doCreateMonster(summon, getCreaturePosition(cid))
		doCreatureSetStorage(cid, tss, os.time() + ttt)
end
end
return true
end

in creaturescripts.xml add:
Lua:
<event type="textedit" name="Summon" event="script" value="summon.lua"/>

in login.lua add:
Lua:
registerCreatureEvent(cid, "Summon")

and complete! Tested on 0.3.6! :)
 
Back
Top