Jump to content

Recommended Posts

este é um script que cria itens em aréa, onde os itens vão ficar depende da configuração do script. O problema é que os itens podem ser criados encima da água, ou até em lugares sem tile (como no print). Oque eu quero é que se o lugar onde o item for criado tiver água embaixo, ou não tiver algum tile o item não seja criado nesse local mas todos os outros seriam criados normalmente se não tivesse água ou nenhum tile embaixo do local, quem poder ajudar agradeço desde já.

 

Script:

Spoiler


local cfg = {
    items_area = {
        {
            itemid = 11497,
            area = {
                {0,0,0,0,0,0,0},
                {0,1,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,1,0,0},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11498,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,1},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,1,0,0,0}
            }
        },
        {
            itemid = 11499,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,1,0,0,0,0,0},
                {0,0,0,0,0,0,1},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11500,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {1,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11501,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,1,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,1,0,0,0,0},
                {0,0,0,0,0,0,0}
            }    
        }
    },
    remove_time = 10, -- tempo em segundos para remover
    onuse_message = "Uma area foi atingida pelo Genjutsu de %s" -- message ao usar
}

local combats = {}
for i, t in ipairs(cfg.items_area) do
    combats = createCombatObject()
    setCombatArea(combats, createCombatArea(t.area))
    function onTargetTile(cid, position)
        doCreateItem(t.itemid, 1, position)
        addEvent(function()
            local thing = getTileItemById(position, t.itemid).uid
            if(thing ~= 0) then
                doRemoveItem(thing)
            end
        end, cfg.remove_time * 1000)
    end
    setCombatCallback(combats, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
end

function onCastSpell(cid, var)

local outfit = {lookType = 90, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
local time1 = 4000 -- segundos que ficará com a outfit
local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y+1, z=getCreaturePosition(cid).z}

    for i = 1, #combats do
        doCombat(cid, combats, var)
        doSetCreatureOutfit(cid, outfit, time1)
        doSendMagicEffect(position, 193)
    end

    doBroadcastMessage(cfg.onuse_message:format(getCreatureName(cid)), MESSAGE_STATUS_WARNING)
    return true
end

123996435_fuckfuckfuckfuckfuck.PNG.c1e1fd152cf2c35579b34fc989894dd7.PNG

646313217_fuckmylife.PNG.9e035539da195853ecdcca69eafb30b6.PNG

Edited by Mark Charlotte (see edit history)
Link to post
Share on other sites

@Mark Charlotte 

Spoiler

local cfg = {
    items_area = {
        {
            itemid = 11497,
            area = {
                {0,0,0,0,0,0,0},
                {0,1,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,1,0,0},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11498,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,1},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,1,0,0,0}
            }
        },
        {
            itemid = 11499,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,1,0,0,0,0,0},
                {0,0,0,0,0,0,1},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11500,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {1,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11501,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,1,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,1,0,0,0,0},
                {0,0,0,0,0,0,0}
            }    
        }
    },
    remove_time = 10, -- tempo em segundos para remover
    onuse_message = "Uma area foi atingida pelo Genjutsu de %s" -- message ao usar
}

function isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end  

local combats = {}
for i, t in ipairs(cfg.items_area) do
    combats = createCombatObject()
    setCombatArea(combats, createCombatArea(t.area))
    function onTargetTile(cid, position)
        if isWalkable(position, true, true, true) then
            doCreateItem(t.itemid, 1, position)
            addEvent(function()
                local thing = getTileItemById(position, t.itemid).uid
                if(thing ~= 0) then
                    doRemoveItem(thing)
                end
            end, cfg.remove_time * 1000)
        end
    end
    setCombatCallback(combats, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
end

function onCastSpell(cid, var)

local outfit = {lookType = 90, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
local time1 = 4000 -- segundos que ficará com a outfit
local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y+1, z=getCreaturePosition(cid).z}

    for i = 1, #combats do
        doCombat(cid, combats, var)
        doSetCreatureOutfit(cid, outfit, time1)
        doSendMagicEffect(position, 193)
    end

    doBroadcastMessage(cfg.onuse_message:format(getCreatureName(cid)), MESSAGE_STATUS_WARNING)
    return true
end

 

 

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

Link to post
Share on other sites

@KotZletY [29/12/2018 09:37:20] [Error - Spell Interface] 
[29/12/2018 09:37:20] data/spells/scripts/itachi/genjutsu.lua:onCastSpell
[29/12/2018 09:37:20] Description: 
[29/12/2018 09:37:20] data/spells/scripts/itachi/genjutsu.lua:110: attempt to get length of upvalue 'combats' (a number value)
[29/12/2018 09:37:20] stack traceback:
[29/12/2018 09:37:20]     data/spells/scripts/itachi/genjutsu.lua:110: in function <data/spells/scripts/itachi/genjutsu.lua:104>

Link to post
Share on other sites

  • 2 weeks later...
Spoiler

local cfg = {
    items_area = {
        {
            itemid = 11497,
            area = {
                {0,0,0,0,0,0,0},
                {0,1,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,1,0,0},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11498,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,1},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,1,0,0,0}
            }
        },
        {
            itemid = 11499,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,1,0,0,0,0,0},
                {0,0,0,0,0,0,1},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11500,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {1,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11501,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,1,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,1,0,0,0,0},
                {0,0,0,0,0,0,0}
            }    
        }
    },
    remove_time = 10, -- tempo em segundos para remover
    onuse_message = "Uma area foi atingida pelo Genjutsu de %s" -- message ao usar
}

function isWalkable(pos) -- by Yan Liima
	local tile = getThingfromPos(pos)
	if hasProperty(tile.uid, 0) == true or hasProperty(tile.uid, 3) == true then 
    	return false
	end
	return true
end

local combats = {}
local pos = {x=math.random(fromPos.x,toPos.x), y=math.random(fromPos.y,toPos.y), z=math.random(fromPos.z,toPos.z)}
for i, t in ipairs(cfg.items_area) do
    combats = createCombatObject()
    setCombatArea(combats, createCombatArea(t.area))
    function onTargetTile(cid, position)
	if isWalkable(pos) then
        doCreateItem(t.itemid, 1, position)
        addEvent(function()
            local thing = getTileItemById(position, t.itemid).uid
            if(thing ~= 0) then
                doRemoveItem(thing)
            end
        end, cfg.remove_time * 1000)
    end
end	
    setCombatCallback(combats, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
end

function onCastSpell(cid, var)
local combats = {}
local outfit = {lookType = 90, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
local time1 = 4000 -- segundos que ficará com a outfit
local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y+1, z=getCreaturePosition(cid).z}

    for i = 1, #combats do
        doCombat(cid, combats, var)
        doSetCreatureOutfit(cid, outfit, time1)
        doSendMagicEffect(position, 193)
    end

    doBroadcastMessage(cfg.onuse_message:format(getCreatureName(cid)), MESSAGE_STATUS_WARNING)
    return true
end

 

 

════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═══╗

Te Ajudei? Rep + e ficamos Quits

166420979_logoyanliimaornight.png.33f822b8970081a5b3646e85dbfd5934.png

Precisando de ajuda?

discord.png.1ecd188791d0141f74d99db371a2e0a4.png.890d5a38d7bcde75543c72b624a65de1.pngDiscord: Yan Liima #3702

Programador Júnior de LUA, PHP e JavaScript

Juntos somos lendas, separados somos Mitos!

╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝

Link to post
Share on other sites

@Yan Liima 

[12/01/2019 11:45:58] [Error - Spell Interface] 
[12/01/2019 11:45:58] data/spells/scripts/itachi/genjutsu.lua
[12/01/2019 11:45:58] Description: 
[12/01/2019 11:45:58] data/spells/scripts/itachi/genjutsu.lua:78: attempt to index global 'fromPos' (a nil value)
[12/01/2019 11:45:58] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/itachi/genjutsu.lua)

Link to post
Share on other sites

Nuus nada ver a pos que coloquei ksks

 

Spoiler

local cfg = {
    items_area = {
        {
            itemid = 11497,
            area = {
                {0,0,0,0,0,0,0},
                {0,1,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,1,0,0},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11498,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,1},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,1,0,0,0}
            }
        },
        {
            itemid = 11499,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,1,0,0,0,0,0},
                {0,0,0,0,0,0,1},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11500,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {1,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11501,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,1,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,1,0,0,0,0},
                {0,0,0,0,0,0,0}
            }    
        }
    },
    remove_time = 10, -- tempo em segundos para remover
    onuse_message = "Uma area foi atingida pelo Genjutsu de %s" -- message ao usar
}

function isWalkable(pos) -- by Yan Liima
	local tile = getThingfromPos(pos)
	if hasProperty(tile.uid, 0) == true or hasProperty(tile.uid, 3) == true then 
    	return false
	end
	return true
end

local combats = {}
local pos = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y+1, z=getCreaturePosition(cid).z}
for i, t in ipairs(cfg.items_area) do
    combats = createCombatObject()
    setCombatArea(combats, createCombatArea(t.area))
    function onTargetTile(cid, position)
	if isWalkable(pos) then
        doCreateItem(t.itemid, 1, position)
        addEvent(function()
            local thing = getTileItemById(position, t.itemid).uid
            if(thing ~= 0) then
                doRemoveItem(thing)
            end
        end, cfg.remove_time * 1000)
    end
end	
    setCombatCallback(combats, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
end

function onCastSpell(cid, var)
local combats = {}
local outfit = {lookType = 90, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
local time1 = 4000 -- segundos que ficará com a outfit
local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y+1, z=getCreaturePosition(cid).z}

    for i = 1, #combats do
        doCombat(cid, combats, var)
        doSetCreatureOutfit(cid, outfit, time1)
        doSendMagicEffect(position, 193)
    end

    doBroadcastMessage(cfg.onuse_message:format(getCreatureName(cid)), MESSAGE_STATUS_WARNING)
    return true
end?

 

 

Edited by Yan Liima (see edit history)

════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═══╗

Te Ajudei? Rep + e ficamos Quits

166420979_logoyanliimaornight.png.33f822b8970081a5b3646e85dbfd5934.png

Precisando de ajuda?

discord.png.1ecd188791d0141f74d99db371a2e0a4.png.890d5a38d7bcde75543c72b624a65de1.pngDiscord: Yan Liima #3702

Programador Júnior de LUA, PHP e JavaScript

Juntos somos lendas, separados somos Mitos!

╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝

Link to post
Share on other sites

@Yan Liima 

[12/01/2019 13:07:12] [Error - Spell Interface] 
[12/01/2019 13:07:12] data/spells/scripts/itachi/genjutsu.lua
[12/01/2019 13:07:12] Description: 
[12/01/2019 13:07:12] (luaGetThingPosition) Thing not found

[12/01/2019 13:07:12] [Error - Spell Interface] 
[12/01/2019 13:07:12] data/spells/scripts/itachi/genjutsu.lua
[12/01/2019 13:07:12] Description: 
[12/01/2019 13:07:12] data/spells/scripts/itachi/genjutsu.lua:78: attempt to index a boolean value
[12/01/2019 13:07:12] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/itachi/genjutsu.lua)

Link to post
Share on other sites

39 minutos atrás, Mark Charlotte disse:

@Yan Liima 

[12/01/2019 13:07:12] [Error - Spell Interface] 
[12/01/2019 13:07:12] data/spells/scripts/itachi/genjutsu.lua
[12/01/2019 13:07:12] Description: 
[12/01/2019 13:07:12] (luaGetThingPosition) Thing not found

[12/01/2019 13:07:12] [Error - Spell Interface] 
[12/01/2019 13:07:12] data/spells/scripts/itachi/genjutsu.lua
[12/01/2019 13:07:12] Description: 
[12/01/2019 13:07:12] data/spells/scripts/itachi/genjutsu.lua:78: attempt to index a boolean value
[12/01/2019 13:07:12] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/itachi/genjutsu.lua)

 

Spoiler

local cfg = {
    items_area = {
        {
            itemid = 11497,
            area = {
                {0,0,0,0,0,0,0},
                {0,1,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,1,0,0},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11498,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,1},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,1,0,0,0}
            }
        },
        {
            itemid = 11499,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,1,0,0,0,0,0},
                {0,0,0,0,0,0,1},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11500,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {1,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11501,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,1,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,1,0,0,0,0},
                {0,0,0,0,0,0,0}
            }    
        }
    },
    remove_time = 10, -- tempo em segundos para remover
    onuse_message = "Uma area foi atingida pelo Genjutsu de %s" -- message ao usar
}

function isWalkable(position) -- by Yan Liima
	local tile = getThingfromPos(position)
	if hasProperty(tile.uid, 0) == true or hasProperty(tile.uid, 3) == true then 
    	return false
	end
	return true
end

local combats = {}
for i, t in ipairs(cfg.items_area) do
    combats = createCombatObject()
    setCombatArea(combats, createCombatArea(t.area))
    function onTargetTile(cid, position)
	if isWalkable(position) then
        doCreateItem(t.itemid, 1, position)
        addEvent(function()
            local thing = getTileItemById(position, t.itemid).uid
            if(thing ~= 0) then
                doRemoveItem(thing)
            end
        end, cfg.remove_time * 1000)
    end
end	
    setCombatCallback(combats, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
end

function onCastSpell(cid, var)
local combats = {}
local outfit = {lookType = 90, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
local time1 = 4000 -- segundos que ficará com a outfit
local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y+1, z=getCreaturePosition(cid).z}

    for i = 1, #combats do
        doCombat(cid, combats, var)
        doSetCreatureOutfit(cid, outfit, time1)
        doSendMagicEffect(position, 193)
    end

    doBroadcastMessage(cfg.onuse_message:format(getCreatureName(cid)), MESSAGE_STATUS_WARNING)
    return true
end

 

 

════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═══╗

Te Ajudei? Rep + e ficamos Quits

166420979_logoyanliimaornight.png.33f822b8970081a5b3646e85dbfd5934.png

Precisando de ajuda?

discord.png.1ecd188791d0141f74d99db371a2e0a4.png.890d5a38d7bcde75543c72b624a65de1.pngDiscord: Yan Liima #3702

Programador Júnior de LUA, PHP e JavaScript

Juntos somos lendas, separados somos Mitos!

╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝

Link to post
Share on other sites

  • 6 months later...
local cfg = {
    items_area = {
        {
            itemid = 11497,
            area = {
                {0,0,0,0,0,0,0},
                {0,1,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,1,0,0},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11498,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,1},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,1,0,0,0}
            }
        },
        {
            itemid = 11499,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,1,0,0,0,0,0},
                {0,0,0,0,0,0,1},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11500,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {1,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0}
            }
        },
        {
            itemid = 11501,
            area = {
                {0,0,0,0,0,0,0},
                {0,0,0,0,1,0,0},
                {0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0},
                {0,0,0,0,0,0,0},
                {0,0,1,0,0,0,0},
                {0,0,0,0,0,0,0}
            }    
        }
    },
    remove_time = 10, -- tempo em segundos para remover
    onuse_message = "Uma area foi atingida pelo Genjutsu de %s" -- message ao usar
}

function isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end  

local combats = {}
for i, t in ipairs(cfg.items_area) do
    combats = createCombatObject()
    setCombatArea(combats, createCombatArea(t.area))
    function onTargetTile(cid, position)
        if isWalkable(position, true, true, true) then
            doCreateItem(t.itemid, 1, position)
            addEvent(function()
                local thing = getTileItemById(position, t.itemid).uid
                if(thing ~= 0) then
                    doRemoveItem(thing)
                end
            end, cfg.remove_time * 1000)
        end
    end
    setCombatCallback(combats, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
end

function onCastSpell(cid, var)

local outfit = {lookType = 90, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
local time1 = 4000 -- segundos que ficará com a outfit
local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y+1, z=getCreaturePosition(cid).z}

    for i = 1, #combats do
        doCombat(cid, combats[i], var)
        doSetCreatureOutfit(cid, outfit, time1)
        doSendMagicEffect(position, 193)
    end

    doBroadcastMessage(cfg.onuse_message:format(getCreatureName(cid)), MESSAGE_STATUS_WARNING)
    return true
end

 

O rei de seu proprio destino é aquele que luta pela gloria do amanhã!
Discord : ZoR#9373


 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By Felippe Reine014
      uso tfs 1.3
       
      fala pessoal vim pedir a ajuda de voces com um script de equipe 
      por exemplo quando o player tiver usando um demon shield e toma um hit de 300 ai esse hit que o player levou de 300 adiciona 5% de vida para o player 
      obrigado desde ja a todos 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
    • By MIzakinha
      Salve!
       
      Estou com um projeto e para ajudar os players a progredirem mais facilmente pensei em fazer um script de uma box que da itens.
       
      Funcionaria da seguinte maneira:
       
      Ao criar o char e entrar no server pela primeira vez a box já vai estar na sua bolsa. Até essa parte tudo bem, até porque ela faz parte de outra script. kkk...
       
      Bom, agora sim, esse script deve fazer com que eu só consiga usar essa box quando eu atingir o lvl 15. Ao clicar nessa box eu irei ganhar vários itens, e um deles será outra box que eu só vou poder abrir no lvl 30. Ao clicar nessa box eu irei ganhar vários itens e outra box que eu só vou poder abrir no lvl 60. Ao abrir essa box eu irei ganha vários itens e fim. Acabou por aí.
       
      Alguém consegue me ajudar a fazer esse script?
       
      Estou usando como base um servidor DxP
       
       
       
    • By Jeff Delay
      Comecei a usar TFS 1.3 recentemente porem não entendo quase nada praticamente, quero por nessa magia a posição do efeito e o tempo que ela vai sair no target
       
      local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, 0) combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) -- combat:setParameter(COMBAT_PARAM_USECHARGES, true) function onGetFormulaValues(player, skill, attack, factor)     local min = (player:getLevel() / 5) + (skill * attack * 0.02) + 4     local max = (player:getLevel() / 5) + (skill * attack * 0.04) + 9     return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") function onCastSpell(creature, variant) local parameters = {creature = creature, variant = variant} local target = Variant.getNumber(variant) addEvent(effect, 200, target, {1,0}, 45)     return combat:execute(creature, variant) end onde em 
      200 = tempo para sair o efeito
      {1,0} = posição do efeito
      45 = efeito
      nela gostaria também de tempo para sair o danos.
    • By pedrobta
      .Qual servidor ou website você utiliza como base? 
      TFS 1.4
       
      Qual o motivo deste tópico? 
      Gostaria de solicitar a ajuda de vocês em relação a uma dúvida. Gostaria de realçar algumas cores dentro da GAMESTORE, no caso desse exemplo é o laranja.
      Estou enviando uma imagem para dúvidas.
       
      Imagem como eu gostaria de fazer.
       
      Você tem o código disponível? Segue meu GAMESTORE.LUA
       
    • By miguelprojac
      .Qual servidor ou website você utiliza como base? 
      https://github.com/opentibiabr/OTServBR-Global
       
      Bom a situação é a seguinte: quando o player está equipado com uma arma de dano físico que foi imbuida com um dano elemental, a magia de cura que o mesmo usa é diminuida conforme a porcentagem do imbue elemental.
       
      Ex: Arma imbuida nível 2 dano de fogo (25% do dano é convertido para fire)  >> Magia  cura 25% menos;
           Arma imbuida nível 3 dano de gelo (50% do dano é convertido para ice)  >> Magia  cura 50% menos;
       
      Alguem já viu algum problema parecido?  Utilizo o otservbr 12.6 TFS 1.3
          
       
  • Recently Browsing   0 members

    No registered users viewing this page.


×
×
  • Create New...

Important Information

Confirmação de Termo