• 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 Condition tfs 0.4

buchaLL

Bez spiny, luźno
Joined
Apr 16, 2017
Messages
95
Solutions
18
Reaction score
79
Location
Poland
I have a small problem.
I'm trying to add condition to my talkaction script but it doesn't work.
Help me :<
Lua:
function onSay(cid, words, param)
local condition = createConditionObject(CONDITION_DAZZLED)
    setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
    setConditionParam(condition, CONDITION_PARAM_BUFF, 1)
    if isPlayer(cid) then
        doAddCondition(cid, condition)
                print("Works")
    else
                 print("Error")
        end
    return true
end

@Edit
Still need help. :/

I tried something like this but i get pz and can't logout.
Lua:
local condition = createConditionObject(CONDITION_DAZZLED)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
addDamageCondition(condition, math.random(7,11), 3000, -0)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
 
Last edited by a moderator:
Solution
condition.cpp
FIND and DELELTE: case CONDITION_DAZZLED

AFTER:
C++:
case CONDITION_PARALYZE:
            return new ConditionSpeed(_id, _type, _ticks, _buff, _subId, param);

ADD:
C++:
case CONDITION_DAZZLED:
        return new ConditionDazzled(_id, _type, _ticks, _buff, _subId);

AFTER:
C++:
Icons_t ConditionManaShield::getIcons() const
{
    Icons_t icon = Condition::getIcons();
    if(icon != ICON_NONE)
        return icon;

    return ICON_MANASHIELD;
}

ADD:
C++:
ConditionDazzled::ConditionDazzled(ConditionId_t _id, ConditionType_t _type, int32_t _ticks, bool _buff, uint32_t _subId):
ConditionGeneric(_id, _type, _ticks, _buff, _subId)
{
    //
}

Icons_t ConditionDazzled::getIcons() const
{
    Icons_t icon =...
Please read the rules; Rules for the Support board
#2, #5

Only a player can call onSay so the isPlayer if statment is not needed.
Also the PARAM_BUFF requires you to buff something, nothing is added to your code about that.
Right now it's like you call addHealth(0), you tell the server to give the player 0 extra health.

In other words your code does nothing as of now.

Lua:
function onSay(cid, words, param)
    local condition = createConditionObject(CONDITION_DAZZLED)
    setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
    setConditionParam(condition, CONDITION_PARAM_BUFF, true)
    doAddCondition(cid, condition)

    return true
end
 
I know the rules. If possible please join first post with second.
As for the script, it does not work.

I would like to see this icon.
wem8kv.png
 
Still same, others work :/
Lua:
function onSay(cid, words, param)
    local condition = createConditionObject(CONDITION_DAZZLED)
    setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
    setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
    setConditionParam(condition, CONDITION_PARAM_BUFF, true)
    doAddCondition(cid, condition)
    return true
end

~~Solved! :)
I edited the source.
 
Last edited by a moderator:
Still same, others work :/
Lua:
function onSay(cid, words, param)
    local condition = createConditionObject(CONDITION_DAZZLED)
    setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
    setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
    setConditionParam(condition, CONDITION_PARAM_BUFF, true)
    doAddCondition(cid, condition)
    return true
end

~~Solved! :)
I edited the source.

Please read the rules; Rules for the Support board
#8
 
condition.cpp
FIND and DELELTE: case CONDITION_DAZZLED

AFTER:
C++:
case CONDITION_PARALYZE:
            return new ConditionSpeed(_id, _type, _ticks, _buff, _subId, param);

ADD:
C++:
case CONDITION_DAZZLED:
        return new ConditionDazzled(_id, _type, _ticks, _buff, _subId);

AFTER:
C++:
Icons_t ConditionManaShield::getIcons() const
{
    Icons_t icon = Condition::getIcons();
    if(icon != ICON_NONE)
        return icon;

    return ICON_MANASHIELD;
}

ADD:
C++:
ConditionDazzled::ConditionDazzled(ConditionId_t _id, ConditionType_t _type, int32_t _ticks, bool _buff, uint32_t _subId):
ConditionGeneric(_id, _type, _ticks, _buff, _subId)
{
    //
}

Icons_t ConditionDazzled::getIcons() const
{
    Icons_t icon = Condition::getIcons();
    if(icon != ICON_NONE)
        return icon;

    return ICON_DAZZLED;
}

condition.h
AFTER:
C++:
class ConditionManaShield : public ConditionGeneric
{
    public:
        ConditionManaShield(ConditionId_t _id, ConditionType_t _type, int32_t _ticks, bool _buff, uint32_t _subId);
        virtual ~ConditionManaShield() {}

        virtual Icons_t getIcons() const;

        virtual ConditionManaShield* clone() const {return new ConditionManaShield(*this);}
};

ADD:
C++:
class ConditionDazzled : public ConditionGeneric
{
    public:
        ConditionDazzled(ConditionId_t _id, ConditionType_t _type, int32_t _ticks, bool _buff, uint32_t _subId);
        virtual ~ConditionDazzled() {}

        virtual Icons_t getIcons() const;

        virtual ConditionDazzled* clone() const {return new ConditionDazzled(*this);}
};



SCRIPT:
Lua:
function onSay(cid, words, param)
local condition = createConditionObject(CONDITION_DAZZLED)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)

    doAddCondition(cid, condition)
    return true
end
 
Solution
Yes, works! :D
login.lua
Lua:
local condd = createConditionObject(CONDITION_DAZZLED)
    setConditionParam(condd, CONDITION_PARAM_TICKS, -1)

if getPlayerBlessing(cid, 5) then
        doAddCondition(cid, condd)
end

Add the same to your bless script.
 
Back
Top