demon088
#088 in the Horde
Hello OtLanders!
I need your help with this action script:
I want this script to work in a box that summons random creatures from my OTS.
EXAMPLE: You use the box and then summons a Demon and if you use another box it summons a Medusa and even more creatures. I'm using TFS 1.2.
Thanks for all your help OtLand!
Oh craps! I just solved my problem xD
If someone is searching for this script. Try with this:
If you want to add more monsters just increase the maximum of:
Then add monsters here:
Like this...
I need your help with this action script:
Code:
local config = {
monsterName = 'Demon',
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getPlayerPosition(cid)
if(fromPosition.x ~= CONTAINER_POSITION) and item.itemid == 10503 then
spawnEffect = math.random(6, 7)
doRemoveItem(item.uid, 1)
doSummonCreature(monsterName, fromPosition)
doSendMagicEffect(getCreaturePosition(ret), spawnEffect)
elseif(fromPosition.x ~= CONTAINER_POSITION) == false and item.itemid == 10503 then
doPlayerSendCancel(cid,"You may open this only on the ground.")
end
return true
end
EXAMPLE: You use the box and then summons a Demon and if you use another box it summons a Medusa and even more creatures. I'm using TFS 1.2.
Thanks for all your help OtLand!
Oh craps! I just solved my problem xD
If someone is searching for this script. Try with this:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getPlayerPosition(cid)
if(fromPosition.x ~= CONTAINER_POSITION) and item.itemid == 10503 then
doRemoveItem(item.uid, 1)
random = math.random(1,2)
if random == 1 then
doSummonCreature("Demon", fromPosition)
elseif random == 2 then
doSummonCreature("Dragon Lord", fromPosition)
end
elseif(fromPosition.x ~= CONTAINER_POSITION) == false and item.itemid == 10503 then
doPlayerSendCancel(cid,"You may open this only on the ground.")
end
return true
end
Code:
random = math.random(1,2) ---> 1 to 2
example: random = math.random(1,3) ----> 1 to 3
random = math.random(1,10) 1 to 10
Code:
if random == 1 then
doSummonCreature("Demon", fromPosition)
elseif random == 2 then
doSummonCreature("Dragon Lord", fromPosition)
end
Code:
if random == 1 then
doSummonCreature("Demon", fromPosition)
elseif random == 2 then
doSummonCreature("Dragon Lord", fromPosition)
elseif random == 3 then
doSummonCreature("Medusa", fromPosition)
end
Last edited by a moderator: