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

Tfs 1.2 Party

lazarus321

Member
Joined
May 8, 2017
Messages
209
Reaction score
20
I get this Message 'No party members in range' same with party on.

Well, In my source may be missing something. Anyone know?

Protect spell;

C++:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_SUBID, 2)
condition:setParameter(CONDITION_PARAM_TICKS, 2 * 60 * 1000)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELD, 3)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

function onCastSpell(creature, variant)
    return creature:addPartyCondition(combat, variant, condition, 90)
end
 
I get this Message 'No party members in range' same with party on.

Well, In my source may be missing something. Anyone know?

Protect spell;

C++:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_SUBID, 2)
condition:setParameter(CONDITION_PARAM_TICKS, 2 * 60 * 1000)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELD, 3)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

function onCastSpell(creature, variant)
    return creature:addPartyCondition(combat, variant, condition, 90)
end
Could either be that you are not in a party with other members or the members in party are not in the range of your spell area.

This error is being triggered in one of two locations within this function:
Player:addPartyCondition

If you're sure it's neither of those problems then try replacing this function with your old one and see if it fixes it. It could be something that was fixed after 1.2
 
I try exchange for this code,
C++:
function Player:addPartyCondition(combat, variant, condition, baseMana)
    local party = self:getParty()
    if not party then
        self:sendCancelMessage(RETURNVALUE_NOPARTYMEMBERSINRANGE)
        self:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local members = party:getMembers()
    members[#members + 1] = party:getLeader()

    local position = self:getPosition()
    local affectedMembers = {}
    for _, member in ipairs(members) do
        if member:getPosition():getDistance(position) <= 36 then
            affectedMembers[#affectedMembers + 1] = member
        end
    end

    if #affectedMembers <= 1 then
        self:sendCancelMessage(RETURNVALUE_NOPARTYMEMBERSINRANGE)
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local mana = math.ceil(math.pow(0.9, #affectedMembers - 1) * baseMana * #affectedMembers)
    if self:getMana() < mana then
        self:sendCancelMessage(RETURNVALUE_NOTENOUGHMANA)
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if not combat:execute(self, variant) then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    self:addMana(baseMana - mana, false)
    self:addManaSpent(mana - baseMana)

    for _, member in ipairs(affectedMembers) do
        member:addCondition(condition)
    end
    return true
end

but get same problem. We can see in that image (have party and range"blue")

1553259057046.png
 
I tried to make a simple check of how many people are in the party, but it still does not work.

HTML:
function onCastSpell(creature, variant)
    local party = creature:getParty()
    local qtdparty = party:getMembers()
   
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, ''..qtdparty..'')
    return true
   
end

error
HTML:
attempt to index local 'party' (a nil value)
stack traceback:
        [C]: in function '__index'

Anyone can help?
 
anyone can help with this problem?

Tthis function getParty() no work here. How is it made?

Omg, nobody knows?
 
Last edited:
Party spells have since been updated to work as they were supposed to (they function the same away as in Tibia now), so in order for you to be able to cast this spell first you need the required mana, and second at least 1 member of your party has to be inside the spell area radius so that you can cast the spell, and the condition will be added only to the members inside that area radius.

On previous releases of TFS, a player would be able to cast this spell regardless if they were inside the area radius, but the condition would only be added to those members that met this check
Code:
getDistanceBetween(getCreaturePosition(pid), pos) <= 36
(position difference (distance) from the caster to the member was less than or equal to 36).

Take a loot at: otland/forgottenserver (https://github.com/otland/forgottenserver/blob/1.1/data/spells/scripts/party/protect.lua)
 
local party = Party(player:getParty())

Hi @Itutorial, i try use ur function get this error.
HTML:
Lua Script Error: [Spell Interface]
data/spells/scripts/attack/teste.lua:onCastSpell
data/spells/scripts/attack/teste.lua:19: attempt to call global 'Party' (a table value)
stack traceback:
        [C]: in function 'Party'

My script,

HTML:
function onCastSpell(creature, var)
    local player = Player(creature)
    local playerPos = creature:getPosition()

            local party = Party(player:getParty())
            local members = party:getMembers()
            
            if (members ~= nil or #members >= 1) then
            
            player:say(''..members..'', TALKTYPE_MONSTER_SAY)
            return true
            end

end
 
Hi @Dnomyar , I believe it is not that way, see in the example above with the photo I try to use the magic even with the member of the group next to me and still says that the members are out of reach.
but get same problem. We can see in that image (have party and range"blue")

your example is not for tfs 1.2 alright? I do not understand what it would be like for Tfs 1.2.

I was reading about my version of the server and realized that there were modifications on this interface. i dont know how to make it work.

Changelog 1.3

Daniel Speichert edited this page on 15 Jul 2018 · 7 revisions

Engine
  • Updated party share experience formula + moved to Lua
Script interface
  • Moved some compat functions to metatables
  • Added Player:addPartyCondition helper for spell scripts
this parte "Player:addPartyCondition" no work perfectly
 
Last edited:
Back
Top