PDA

View Full Version : [SOLVED] BossAnnouncer.cpp



Minodevs
07-17-2016, 10:58 AM
Hello Guys i`ve using that, Script Bossannouncer.cpp but its no working i did recompiled 3x and cleaned, sulotion, didn't work yet no Announcering Boses, i triyed in group and wtihout Group



#include "ScriptMgr.h"
#include "Chat.h"
#include "Language.h"

class Boss_Announcer : public PlayerScript
{
public:
Boss_Announcer() : PlayerScript("Boss_Announcer") {}

void OnCreatureKill(Player* player, Creature* boss)
{
if (boss->isWorldBoss())
{
std::string plr = player->GetName();
std::string boss_n = boss->GetName();
std::string gender = player->getGender() == GENDER_FEMALE ? "her" : "his";
bool ingroup = player->GetGroup();
std::string tag_colour = "7bbef7";
std::string plr_colour = "ff0000";
std::string boss_colour = "18be00";
std::ostringstream stream;
stream << "|CFF" << tag_colour <<
"[News]|r:|cff" << plr_colour << " " << plr <<
"|I Killed |CFF" << boss_colour << "[" << boss_n << "]|r " <<
(ingroup ? "by " : "with ") << gender << (ingroup ? " group" : "self") << "!";
sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str());
}
};
};

void AddSC_Boss_Announcer()
{
new Boss_Announcer;
}

Rochet2
07-17-2016, 02:14 PM
does the NPC have the boss flags?
CREATURE_TYPEFLAGS_BOSS
https://github.com/TrinityCore/TrinityCore/blob/73aababbd4e4ecab5783d1ab179b47bab133a490/src/server/game/Entities/Creature/Creature.cpp#L1850
https://trinitycore.atlassian.net/wiki/display/tc/creature_template#creature_template-type_flags

Minodevs
07-17-2016, 02:25 PM
yea its has

Rochet2
07-17-2016, 02:27 PM
how did you compile the script?
Did you run cmake and then compile

Minodevs
07-17-2016, 03:20 PM
how did you compile the script?
Did you run cmake and then compile

yea its working at, Sunwell, and BT instances, and i didn't set script name the instances bosses, lol

Rochet2
07-17-2016, 04:29 PM
so it works -> there is no problem.

So this is solved?

Minodevs
07-17-2016, 05:52 PM
mate its aren't work world bosses, i did set it Scriptname { Boss_Announcer } its are just working, instances no idea why like that, Better to Look pictures

https://s32.postimg.org/eohnh44gl/image.png

https://s31.postimg.org/3usyu68or/image.png

Rochet2
07-17-2016, 06:17 PM
The script does not need any scriptname set. Its a playerscript.

Also in the second pic the NPC does not seem to have the flag I mentioned earlier. The NPC is not a world boss so its not announcing

Minodevs
07-17-2016, 06:24 PM
The script does not need any scriptname set. Its a playerscript.

Also in the second pic the NPC does not seem to have the flag I mentioned earlier. The NPC is not a world boss so its not announcing

Thanks Rochet2 i solved, it :)