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

Spell Silence TFS 1.0

Can change this spell for 1.1? pleaseeeeeeeeeeeeee u.u

It really only needs basic modification to be compatible with 1.1... seriously, just read around on some releases for 1.0 and 1.1 and figure out what the difference is in them, I'll give you a hint, 1.0 passes cid (also known as the creature id) as a parameter on events (such as onCastSpell) while 1.1 passes the userdata (i.e. creature object). Try to do a little reading, playing with the code, and learning, it will be WAY more beneficial in the long run. There are only a couple lines in this script that need changed and that's it, see if you can figure it out.
 
Im sorry, but im from Brazil, its hard for speak english, much more for learning about codes and others :/
 
programming is universal, doesn't matter what language you speak
 
Im sorry, but im from Brazil, its hard for speak english, much more for learning about codes and others :/
Then go ask on XTibia, OTBR or TibiaKing. I can help you there.

programming is universal, doesn't matter what language you speak
Objection. You aren't considering different paradigms.
 
Objection. You aren't considering different paradigms.


Syntax still doesn't change, everything else is just variables... If I can understand a script with variables like k = {3, 2, 1} for i = 2, 4 do blah blah blah, simple small one letter variables, why can't someone else figure it out from another language? I have read plenty of scripts written in other languages and were able to understand what they meant, why can't someone do the same for english?
 
I'm pretty sure you never had a Haskell or Lisp code in front of you :) let's fire up a topic on an offtopic board, we're polluting this question.
 
Although I can only read / write english, we could use a language library,

For instance using google translate

We can attempt to translate this function
Code:
sendTextMessage
to Portuguese
Code:
enviarMensagemDeTexto

The way to do it is pretty straight forward, we would create a variable written in Portuguese in this case enviarMensagemDeTexto and assign it the value of sendTextMessage and any arguments associated with it.

Code:
criatura = creature
enviarMensagemDeTexto = sendTextMessage
STATUS_ DA_ MENSAGEM_PEGUENO = MESSAGE_STATUS_SMALL

Given if the translation is correct we could write
Code:
creature:sendTextMessage(MESSAGE_STATUS_SMALL, "This creature is already muted")
to
Code:
criatura:enviarMensagemDeTexto(STATUS_ DA_ MENSAGEM_PEGUENO, "Esta criatura já está mudo")

This would allow people who do not know the english language well enough to understand what they are writting and eventually figure out the logic since it is written in a language they are most familiar with.
 
UPDATE

New version compatible with 1.1, 1.2, and the unofficial (current) version of 1.3.

[Lua] silence.lua - Pastebin.com

What if i want to use this function with a rune or an items, i mean i make a silence potion, and when a player use it on another player it makes him silenced for x seconds, i saw it on evolera ot but i cant make it, although i got evolera silence action script..
Can help with that?
 
Sorry for get it up now but i have a trouble here:
Lua:
local tarmonster = true -- Can we cast this spell on monsters. Default is true
local ptime = 8000 -- This is how long the spell will last on a Player. Default is 8 seconds = 8000
local mtime = 10000 -- This is how long the spell will last on a Monster. Default is 10 seconds = 10000
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, true)
local mute = Condition(CONDITION_MUTED)
function onCastSpell(creature, var)
local tar = creature:getTarget()
    if tar:getCondition(CONDITION_MUTED) then
        return creature:sendTextMessage(MESSAGE_STATUS_SMALL, "This creature is already muted")
    end
    if tar:isPlayer() then
        tar:say("^SILENCED^",TALKTYPE_MONSTER_SAY)
        mute:setParameter(CONDITION_PARAM_TICKS, ptime)
        combat:addCondition(mute)
        return combat:execute(creature, tar)
    end
    if tar:isMonster() and tarmonster then
        tar:say("^SILENCED^",TALKTYPE_MONSTER_SAY)
        mute:setParameter(CONDITION_PARAM_TICKS, mtime)
        combat:addCondition(mute)
        return combat:execute(creature, tar)
    else
        return creature:sendTextMessage(MESSAGE_STATUS_SMALL, "You can only use this spell on Players.")
    end
end

error on use:

Lua Script Error: [Spell Interface]
data/spells/scripts/silence.lua:eek:nCastSpell
attempt to index a nil value
stack traceback:
[C]: at 0x7ff7eac1f160
[C]: at 0x7ff7eabd5590
 
You are executing return combat:execute(creature, tar) wrongly.
Tar is userdata while 2nd parameter for combat:execute is var (variant).
 
change to var.
but now i get this error:

Lua Script Error: [Spell Interface]
data/spells/scripts/silence.lua:eek:nCastSpell
data/spells/scripts/silence.lua:14: attempt to index local 'tar' (a nil value)
stack traceback:
[C]: in function '__index'
data/spells/scripts/silence.lua:14: in function <data/spells/scripts/silence.lua:11>
 
You have to ckeck if target even exists after line 9, else you'll get this nil error message.
if not tar then return false end
 
Back
Top