adric21
Well-Known Member
- Joined
- Apr 26, 2016
- Messages
- 295
- Solutions
- 1
- Reaction score
- 82
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 had tested bro but dont work i only see icon of poisson
print(condition:getIcons())
local condition = Condition(CONDITION_DAZZLED)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_TICKS, 33000)
player:addCondition(condition)
print(condition:getIcons())
1024
Wibbenz can post the complete code?, +repp
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
I havent yet added any source code since im on tfs 1.2, i would have to change the code as well then.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
case CONDITION_PARALYZE:
return new ConditionSpeed(id, type, ticks, buff, subId, param);
case CONDITION_DAZZLED:
return new ConditionDazzled(id, type, ticks, buff, subId);
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;
}
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;
};
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;
}
you need to rewrite the class from the ground up and not copy thingsThis 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.