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

Summon Monster's With Levers

Apitov

Man With The Plan
Joined
Jun 9, 2008
Messages
40
Reaction score
2
Location
Louisiana, United States
As the title says could someone give me a hand or point me into the direction of a script like this, I searched my ass off and still couldnt find anything lol.
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
     if item.itemid == 1945 and item.uid == 5000 then
          doSummonCreature(cid, "Demon", pos)
          else
          doPlayerSendCancel(cid, "Error.")
     end
end
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

     demon1pos = {x=XXX, y=XXX, z=XXX}
     demon2pos = {x=XXX, y=XXX, z=XXX}
     demon3pos = {x=XXX, y=XXX, z=XXX}
     demon4pos = {x=XXX, y=XXX, z=XXX}
     demon5pos = {x=XXX, y=XXX, z=XXX}
     demon6pos = {x=XXX, y=XXX, z=XXX}

     if item.itemid == 1945 and item.uid == 5000 then
          doSummonCreature("Demon", demon1pos)
          doSummonCreature("Demon", demon2pos)
          doSummonCreature("Demon", demon3pos)
          doSummonCreature("Demon", demon4pos)
          doSummonCreature("Demon", demon5pos)
          doSummonCreature("Demon", demon6pos)
          else
          doPlayerSendCancel(cid, "Error.")
     end
end

Change the XXX to the position you want the monsters to be summoned
I don't know about the exhaust :p
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local demonPos =
{
	{x=XXX, y=XXX, z=XXX},
  	{x=XXX, y=XXX, z=XXX},
	{x=XXX, y=XXX, z=XXX},
 	{x=XXX, y=XXX, z=XXX},
   	{x=XXX, y=XXX, z=XXX},
 	{x=XXX, y=XXX, z=XXX}
}

     if item.itemid == 1945 and item.uid == 5000 then
	for i = 1, table.maxn(demonPos) do
          doSummonCreature("Demon", demonPos[i])
	end
          else
          doPlayerSendCancel(cid, "Error.")	
     end
end

better...
 
You want exhausted?
Try this one..
Lua:
-- by Shawak
     monster = "Demon" -- monster that will be summon
     minutes = 1       -- exhaust minutes
     item_uid_id = ITEM.UID ID   -- item.uid ID of the switch
     monster_pos = {   -- position where the monster will be summon
     x=xxx, 
     y=yyy, 
     z=z
}
function changeSwitch()
          doTransformItem(item.uid, 1945)
return TRUE
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
     if item.itemid == 1945 and item.uid == item_uid_id then
          doSummonCreature(monster, monster_pos)
          doTransformItem(item.uid, 1946)
          addEvent(changeSwitch, minutes * 60 * 1000, cid) 
     else
          doPlayerSendCancel(cid, "Please Wait.")
     end
     return TRUE
end

NOT testet.

Regards,
Shawak
 
You want exhausted?
Try this one..
Lua:
-- by Shawak
     monster = "Demon" -- monster that will be summon
     minutes = 1       -- exhaust minutes
     item_uid_id = ITEM.UID ID   -- item.uid ID of the switch
     monster_pos = {   -- position where the monster will be summon
     x=xxx, 
     y=yyy, 
     z=z
}
function changeSwitch()
          doTransformItem(item.uid, 1945)
return TRUE
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
     if item.itemid == 1945 and item.uid == item_uid_id then
          doSummonCreature(monster, monster_pos)
          doTransformItem(item.uid, 1946)
          addEvent(changeSwitch, minutes * 60 * 1000, cid) 
     else
          doPlayerSendCancel(cid, "Please Wait.")
     end
     return TRUE
end

NOT testet.

Regards,
Shawak

Thanks i'll test it now.

Edit.
Tested it and it didnt work kept giving an error by monster_pos
 
Last edited:
You want exhausted?
Try this one..
Lua:
-- by Shawak
     monster = "Demon" -- monster that will be summon
     minutes = 1       -- exhaust minutes
     item_uid_id = ITEM.UID ID   -- item.uid ID of the switch
     monster_pos = {   -- position where the monster will be summon
     x=xxx, 
     y=yyy, 
     z=z
}
function changeSwitch()
          doTransformItem(item.uid, 1945)
return TRUE
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
     if item.itemid == 1945 and item.uid == item_uid_id then
          doSummonCreature(monster, monster_pos)
          doTransformItem(item.uid, 1946)
          addEvent(changeSwitch, minutes * 60 * 1000, cid) 
     else
          doPlayerSendCancel(cid, "Please Wait.")
     end
     return TRUE
end

NOT testet.

Regards,
Shawak

lol why add an event when we have a LUA exhaust made by elf on tfs 0.3

Here the script:

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

local demonPos =
{
        {x=XXX, y=XXX, z=XXX},
        {x=XXX, y=XXX, z=XXX},
        {x=XXX, y=XXX, z=XXX},
        {x=XXX, y=XXX, z=XXX},
        {x=XXX, y=XXX, z=XXX},
        {x=XXX, y=XXX, z=XXX}
}
dofile(getDataDir() .. "lib/exhaustion.lua")


     if item.itemid == 1945 and item.uid == 5000 and exhaustion.check(cid, STORAGE ID YOU WANT) == FALSE then
        for i = 1, table.maxn(demonPos) do
          doSummonCreature("Demon", demonPos[i])
        end
        exhaustion.set(cid,STORAGE ID,1) // The number 1 is the second you want for the exhaust right now is set for 1 second
          else
          doPlayerSendCancel(cid, "Error.")     
     end
end
 
And what is so dramatic if I use a AddEvent function?
It's the same.

nope? is a waste of code to use event also REMEMBER you have to make clean CODES to make it use less resources and run more smooth and events is just a dirty method to make an exhaust thats why ELF made that function for US to USE IT... (Im a freak when we are talking about code cleaning)
 
Thanks guys, Migxxx yours worked perfectly rep++ to you my friend.

Edit. Shawak I got a error on yours but I changed it around a little and it worked but Migxxx was right the cleaner the script the smoother my server will run.
 
Back
Top