Note: This is for 3.3.5 branch
Hi all,
I’m trying to implement two scripts: OutdoorPvP and a PlayerScript. I want to have an int counter in my OutdoorPvP script that can be incremented by typing ‘#join’. I currently implement this by using the PlayerScript to “callback” to the OutdoorPvP script and increment the counter.
It looks like this being initialized:
OutdoorPvPExample::OutdoorPvPExample() {
m_TypeId = OUTDOOR_PVP_BR;
playerHandlerCallback playerHandlerCB = std::bind(&OutdoorPvPExample::PlayerHandlerCB, this, std::placeholders::_1,
std::placeholders::_2);
playerHandler = new OutdoorPvPExamplePlayerScript(playerHandlerCB);
typedef std::function<void(Player*, int)> playerHandlerCallback;
However, this is not working due to this error:
trinitycore/src/server/game/Scripting/ScriptMgr.cpp:926 in AddScript ASSERTION FAILED:
!sScriptMgr->GetCurrentScriptContext().empty()
Tried to register a script without being in a valid script context!
Can anyone help me solve this? I am hoping that to continue using this callback pattern to connect various scripts back to my OutdoorPvP script. I'm new to C++ and TrinityCore, so any advice is greatly appreciated!
Thanks!