owned
Excellent OT User
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
in creaturescripts.xml add:
in login.lua add:
and complete! Tested on 0.3.6!
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!