• 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 Bless icon

adric21

Well-Known Member
Joined
Apr 26, 2016
Messages
277
Solutions
1
Reaction score
73
I would like to know how I could do to make this icon appear when using the! Bless command, I do not know if it is necessary to modify the sources or a simple script. I am currently using tfs 1.2
Anyone can give me the code for edit the source?

12345
 
Rules for the Support board
2. Double Post:
- You have to wait 24 hours to post after your own post in a thread.
- There is 1 exception to this rule. If you solved a problem you can post it with the solution in the thread regardless of the amount of time between your new post and your last one.
If your thread isn't on the first page anymore by the time you solved it, set your thread prefix to solved and edit your first or last post and add the solution.
 
I tried this too:

Lua:
    local condition = Condition(CONDITION_DAZZLED)
   condition:setParameter(CONDITION_PARAM_SUBID, 1)
   condition:setParameter(CONDITION_PARAM_TICKS, 33000)
   player:addCondition(condition)
   print(condition:getIcons())

Nothing happens, it works if I change CONDITION_DAZZLED for CONDITION_HASTE

Output:
Lua:
1024
 
Wibbenz can post the complete code?, +repp

Taken from here; Lua - Condition tfs 0.4
Lua:
local condition = Condition(CONDITION_DAZZLED)
condition:setParameter(CONDITION_PARAM_TICKS, -1)

function onSay(player, words, param)
    print(condition:getIcons())
    player:addCondition(condition)

    return true
end
 
I tried this too:

Lua:
    local condition = Condition(CONDITION_DAZZLED)
   condition:setParameter(CONDITION_PARAM_SUBID, 1)
   condition:setParameter(CONDITION_PARAM_TICKS, 33000)
   player:addCondition(condition)
   print(condition:getIcons())

Nothing happens, it works if I change CONDITION_DAZZLED for CONDITION_HASTE

Output:
Lua:
1024

So 1024 is the haste icon?
In that case something went wrong when you added the source code.
 
I havent yet added any source code since im on tfs 1.2, i would have to change the code as well then.

1024 is dazzled condition

But you need to modify the source code aswell, so the server tells the client to display the icon when the condition is active.
 
This is what I did:

Condition.cpp

Code:
       case CONDITION_PARALYZE:
           return new ConditionSpeed(id, type, ticks, buff, subId, param);

       case CONDITION_DAZZLED:
           return new ConditionDazzled(id, type, ticks, buff, subId);

Code:
uint32_t ConditionSpeed::getIcons() const
{
   uint32_t icons = Condition::getIcons();
   switch (conditionType) {
       case CONDITION_HASTE:
           icons |= ICON_HASTE;
           break;

       case CONDITION_PARALYZE:
           icons |= ICON_PARALYZE;
           break;

       default:
           break;
   }
   return icons;
}

uint32_t ConditionDazzled::getIcons() const
{
   uint32_t icons = Condition::getIcons();
   switch (conditionType) {
       case CONDITION_DAZZLED:
           icons |= ICON_DAZZLED;
           break;

       default:
           break;
   }
   return icons;
}

Condition.h

Code:
class ConditionSpeed final : public Condition
{
   public:
       ConditionSpeed(ConditionId_t id, ConditionType_t type, int32_t ticks, bool buff, uint32_t subId, int32_t changeSpeed) :
           Condition(id, type, ticks, buff, subId), speedDelta(changeSpeed) {}

       bool startCondition(Creature* creature) final;
       bool executeCondition(Creature* creature, int32_t interval) final;
       void endCondition(Creature* creature) final;
       void addCondition(Creature* creature, const Condition* condition) final;
       uint32_t getIcons() const final;

       ConditionSpeed* clone() const final {
           return new ConditionSpeed(*this);
       }

       bool setParam(ConditionParam_t param, int32_t value) final;

       void setFormulaVars(float mina, float minb, float maxa, float maxb);

       //serialization
       void serialize(PropWriteStream& propWriteStream) final;
       bool unserializeProp(ConditionAttr_t attr, PropStream& propStream) final;

   protected:
       void getFormulaValues(int32_t var, int32_t& min, int32_t& max) const;

       int32_t speedDelta;

       //formula variables
       float mina = 0.0f;
       float minb = 0.0f;
       float maxa = 0.0f;
       float maxb = 0.0f;
};

class ConditionDazzled final : public Condition
{
   public:
       ConditionDazzled(ConditionId_t id, ConditionType_t type, int32_t ticks, bool buff, uint32_t subId) :
           Condition(id, type, ticks, buff, subId) {}

       bool startCondition(Creature* creature) final;
       bool executeCondition(Creature* creature, int32_t interval) final;
       void endCondition(Creature* creature) final;
       void addCondition(Creature* creature, const Condition* condition) final;
       uint32_t getIcons() const final;

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

       bool setParam(ConditionParam_t param, int32_t value) final;

       void setFormulaVars(float mina, float minb, float maxa, float maxb);

       //serialization
       void serialize(PropWriteStream& propWriteStream) final;
       bool unserializeProp(ConditionAttr_t attr, PropStream& propStream) final;

   protected:
       void getFormulaValues(int32_t var, int32_t& min, int32_t& max) const;

       int32_t speedDelta;

       //formula variables
       float mina = 0.0f;
       float minb = 0.0f;
       float maxa = 0.0f;
       float maxb = 0.0f;
};

Compiles fine except nothing happens when I login.

I've also added it in here:

Code:
uint32_t ConditionGeneric::getIcons() const
{
   uint32_t icons = Condition::getIcons();

   switch (conditionType) {
       case CONDITION_MANASHIELD:
           icons |= ICON_MANASHIELD;
           break;

       case CONDITION_INFIGHT:
           icons |= ICON_SWORDS;
           break;

       case CONDITION_DRUNK:
           icons |= ICON_DRUNK;
           break;

       case CONDITION_DAZZLED:
           icons |= ICON_DAZZLED;
           break;

       default:
           break;
   }

   return icons;
}
 
This is what I did:

Condition.cpp

Code:
       case CONDITION_PARALYZE:
           return new ConditionSpeed(id, type, ticks, buff, subId, param);

       case CONDITION_DAZZLED:
           return new ConditionDazzled(id, type, ticks, buff, subId);

Code:
uint32_t ConditionSpeed::getIcons() const
{
   uint32_t icons = Condition::getIcons();
   switch (conditionType) {
       case CONDITION_HASTE:
           icons |= ICON_HASTE;
           break;

       case CONDITION_PARALYZE:
           icons |= ICON_PARALYZE;
           break;

       default:
           break;
   }
   return icons;
}

uint32_t ConditionDazzled::getIcons() const
{
   uint32_t icons = Condition::getIcons();
   switch (conditionType) {
       case CONDITION_DAZZLED:
           icons |= ICON_DAZZLED;
           break;

       default:
           break;
   }
   return icons;
}

Condition.h

Code:
class ConditionSpeed final : public Condition
{
   public:
       ConditionSpeed(ConditionId_t id, ConditionType_t type, int32_t ticks, bool buff, uint32_t subId, int32_t changeSpeed) :
           Condition(id, type, ticks, buff, subId), speedDelta(changeSpeed) {}

       bool startCondition(Creature* creature) final;
       bool executeCondition(Creature* creature, int32_t interval) final;
       void endCondition(Creature* creature) final;
       void addCondition(Creature* creature, const Condition* condition) final;
       uint32_t getIcons() const final;

       ConditionSpeed* clone() const final {
           return new ConditionSpeed(*this);
       }

       bool setParam(ConditionParam_t param, int32_t value) final;

       void setFormulaVars(float mina, float minb, float maxa, float maxb);

       //serialization
       void serialize(PropWriteStream& propWriteStream) final;
       bool unserializeProp(ConditionAttr_t attr, PropStream& propStream) final;

   protected:
       void getFormulaValues(int32_t var, int32_t& min, int32_t& max) const;

       int32_t speedDelta;

       //formula variables
       float mina = 0.0f;
       float minb = 0.0f;
       float maxa = 0.0f;
       float maxb = 0.0f;
};

class ConditionDazzled final : public Condition
{
   public:
       ConditionDazzled(ConditionId_t id, ConditionType_t type, int32_t ticks, bool buff, uint32_t subId) :
           Condition(id, type, ticks, buff, subId) {}

       bool startCondition(Creature* creature) final;
       bool executeCondition(Creature* creature, int32_t interval) final;
       void endCondition(Creature* creature) final;
       void addCondition(Creature* creature, const Condition* condition) final;
       uint32_t getIcons() const final;

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

       bool setParam(ConditionParam_t param, int32_t value) final;

       void setFormulaVars(float mina, float minb, float maxa, float maxb);

       //serialization
       void serialize(PropWriteStream& propWriteStream) final;
       bool unserializeProp(ConditionAttr_t attr, PropStream& propStream) final;

   protected:
       void getFormulaValues(int32_t var, int32_t& min, int32_t& max) const;

       int32_t speedDelta;

       //formula variables
       float mina = 0.0f;
       float minb = 0.0f;
       float maxa = 0.0f;
       float maxb = 0.0f;
};

Compiles fine except nothing happens when I login.
you need to rewrite the class from the ground up and not copy things
use another class as a template, you have no serialization methods for dazzled nor an enum for CONDITION_DAZZLED in luascript.cpp
you also need a new enum in enums.h inside of ConditionType_t (CONDITION_DAZZLED = 1 << 28,)
if you can't handle writing it i will later, whenever i feel like doing it
 
Back
Top