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

Lua TFS 1.4 Script Item that bursts Please

VagosClubTM

Active Member
Joined
Aug 16, 2019
Messages
219
Reaction score
32
Location
Chile
good friend I am requesting this script more than anything because I am migrating from 7.6 xml to TFS 1.4 760 as well and I need some scripts that it is impossible for me to develop them for now, it would be helpful if you help me with this.

Well more than anything I request that item 2140 and 2366 when right clicking on them appears a creature (created by me), and the item disappears from the backpack or hand or ground. Also that the item asks for a level to use it.

I'll leave a script from my 7.6 xml server, maybe it could be a guide to better explain what I'm looking for.

Lua:
-- Create monster--
function onUse(cid, item, frompos, item2, topos)
pos = getPlayerPosition(cid)
if getTilePzInfo(topos) == 0 then
if getTilePzInfo(pos) == 0 then
if item.itemid == 2140 then
doTransformItem(item.uid,4342)
doSummonCreature("vip", pos)
doSendMagicEffect(topos,12)
doPlayerSay(cid,"Despierta Vip",1)
doRemoveItem(item.uid,item.type)
else
doPlayerSendCancel(cid,"You cannot use that.")
end
else
doPlayerSendCancel(cid,"No puedes usar esto estas en zona protegida.")
end
else
doPlayerSendCancel(cid,"No puedes usar esto estas en zona protegida.")
end
return 1
end

@Xikini
 
Solution
Client's generally shouldn't be crashing when you spawn a creature.. but I can script around it.

Lua:
local config = {
    [2140] = {levelRequired = 50, creature = "rat", isSummon = true},
    [2366] = {levelRequired = 70, creature = "troll", isSummon = false},
}

local actions_createCreature = Action()

function actions_createCreature.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local index = config[item:getId()]
    if player:getLevel() < index.levelRequired then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Your level is too low.")
        return true
    end
    local position = player:getPosition()
    if Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then...
Lua:
local config = {
    [2140] = {levelRequired = 50, creature = "rat", isSummon = true},
    [2366] = {levelRequired = 70, creature = "troll", isSummon = false},
}

local actions_createCreature = Action()

function actions_createCreature.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local index = config[item:getId()]
    if player:getLevel() < index.levelRequired then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Your level is too low.")
        return true
    end
    local position = player:getPosition()
    if Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "This item cannot be activated by a player standing in a protection zone.")
        return true
    end
    local creature = Game.createMonster(index.creature, position, true, true) -- extended and force
    if creature and index.isSummon then
        creature:setMaster(player)
    end
    item:remove()
    return true
end

for v, k in pairs(config) do
    actions_createCreature:id(v)
end
actions_createCreature:register()
 
Lua:
local config = {
    [2140] = {levelRequired = 50, creature = "rat", isSummon = true},
    [2366] = {levelRequired = 70, creature = "troll", isSummon = false},
}

local actions_createCreature = Action()

function actions_createCreature.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local index = config[item:getId()]
    if player:getLevel() < index.levelRequired then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Your level is too low.")
        return true
    end
    local position = player:getPosition()
    if Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "This item cannot be activated by a player standing in a protection zone.")
        return true
    end
    local creature = Game.createMonster(index.creature, position, true, true) -- extended and force
    if creature and index.isSummon then
        creature:setMaster(player)
    end
    item:remove()
    return true
end

for v, k in pairs(config) do
    actions_createCreature:id(v)
end
actions_createCreature:register()
@Xikini At the moment of right-clicking it, the creature is positioned on top of the player, causing a clone of the user and causing an error in the client, forcing it to close.
 
Client's generally shouldn't be crashing when you spawn a creature.. but I can script around it.

Lua:
local config = {
    [2140] = {levelRequired = 50, creature = "rat", isSummon = true},
    [2366] = {levelRequired = 70, creature = "troll", isSummon = false},
}

local actions_createCreature = Action()

function actions_createCreature.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local index = config[item:getId()]
    if player:getLevel() < index.levelRequired then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Your level is too low.")
        return true
    end
    local position = player:getPosition()
    if Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "This item cannot be activated by a player standing in a protection zone.")
        return true
    end
    local creature = Game.createMonster(index.creature, position, true)
    if not creature then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "No available space to spawn creature.")
        return true
    end
    if index.isSummon then
        creature:setMaster(player)
    end
    item:remove()
    return true
end

for v, k in pairs(config) do
    actions_createCreature:id(v)
end
actions_createCreature:register()
 
Solution
Client's generally shouldn't be crashing when you spawn a creature.. but I can script around it.

Lua:
local config = {
    [2140] = {levelRequired = 50, creature = "rat", isSummon = true},
    [2366] = {levelRequired = 70, creature = "troll", isSummon = false},
}

local actions_createCreature = Action()

function actions_createCreature.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local index = config[item:getId()]
    if player:getLevel() < index.levelRequired then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Your level is too low.")
        return true
    end
    local position = player:getPosition()
    if Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "This item cannot be activated by a player standing in a protection zone.")
        return true
    end
    local creature = Game.createMonster(index.creature, position, true)
    if not creature then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "No available space to spawn creature.")
        return true
    end
    if index.isSummon then
        creature:setMaster(player)
    end
    item:remove()
    return true
end

for v, k in pairs(config) do
    actions_createCreature:id(v)
end
actions_createCreature:register()
@Xikini Well now if it works, but there is another problem the creature appears as a summon and it should appear as a creature since when this creature appears the user will kill it and will get experience from the creature that I summon by right clicking on it. and being a summon this does not give experience and disappears if the player disconnects
 
@Xikini Well now if it works, but there is another problem the creature appears as a summon and it should appear as a creature since when this creature appears the user will kill it and will get experience from the creature that I summon by right clicking on it. and being a summon this does not give experience and disappears if the player disconnects
Do you not the see config?

If it's not supposed to be a summon, change to false.
 
Do you not the see config?

If it's not supposed to be a summon, change to false.
@Xikini Sorry I had not noticed, it works perfect thanks. you are the best bro
Post automatically merged:

Do you not the see config?

If it's not supposed to be a summon, change to false.
I wanted to ask is it possible that we use this thread for help on tfs 1.4? or if it is better that you start one yourself, more than anything to solve doubts, well I come from the super old 7.6 xml Yurots version. and switching to tfs 1.4 was hard haha well I hope you accept or I just tag you when I post a new thread. I hope you have a good christmas and a happy new year <3
 
Back
Top