• 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.x Summon Creature spell in LUA?

Michael Orsino

Premium User
Premium User
Support Team
Joined
Nov 15, 2007
Messages
854
Solutions
10
Reaction score
389
Location
Santiago, Chile (Australian)
Hey guys,

Has anyone written the summon creature spell in LUA?
I'm hoping to use a custom implementation of summon creature on a little project I'm toying with.
I have not touched Tibia in awhile and I never really looked into spells, but this is what I put together just now (it doesn't work).
Code:
function onCastSpell(player, var)

    local orig = player:getPosition()
    local creatureId = doSummonCreature(var, orig)
        if creatureId ~= false then
            local monster = Monster(creatureId)
            monster:setMaster(player)
            orig:sendMagicEffect(CONST_ME_MAGIC_RED)
        end
end

Any help would be greatly appreciated
Thanks guys,
Michael
 
You will have to forgive me, I don't really understand how exactly spell scripts work
I was hoping var would be the parameter of utevo res "

e.g. player casting " utevo res "rat" " would call this script and interpret the spell parameter (being "rat") correctly

Thanks for taking an interest in any case
 
That seems to work perfectly Ninja, thank you very much
If you care to, I would suggest you create a pull request on github (though you would probably want to deprecate the current summon function unless creatures call it?)

Thanks again, that was a great help!
 
Back
Top