normally,You can send an event when it happens.
but this is very abstract and there are a lot of work to do.
for example, a palyer or a NPC information changes (for instance 'HP'), you should send it(using network module organized into a package) when it changed(HP =100 -> HP =50).
Here I have a code in disguise,
NFIObject* pObject = new NFCObject(NFIDENTID(0, 1), pPluginManager);
pObject->GetPropertyManager()->AddProperty(pObject->Self(), "HP", TDATA_STRING, true, true, true, true, 0, "");
pObject->SetPropertyInt("HP", 100);
pObject->AddPropertyCallBack("HP", this, &HelloWorld2::OnPropertyCallBackEvent);
pObject->SetPropertyInt("HP", 50);
int HelloWorld2::OnPropertyCallBackEvent( const NFIDENTID& self, const std::string& strProperty, const NFIDataList& oldVarList, const NFIDataList& newVarList, const NFIDataList& argVarList )
{
//it will be call when 'HP' has changed, u can send message in this funciton, like this:
NFMsg::ObjectPropertyInt xPropertyInt;
NFMsg::Ident* pIdent = xPropertyInt.mutable_player_id();
*pIdent = NFToPB(self);
NFMsg::PropertyInt* pDataInt = xPropertyInt.add_property_list();
pDataInt->set_property_name( strPropertyName );
pDataInt->set_data( newVar.Int( 0 ) );
for ( int i = 0; i < valueBroadCaseList.GetCount(); i++ )
{
NFIDENTID identOld = valueBroadCaseList.Object( i );
NF_SHARE_PTR<BaseData> pData = mRoleBaseData.GetElement(identOld);
if (pData.get())
{
NF_SHARE_PTR<ServerData> pProxyData = mProxyMap.GetElement(pData->nGateID);
if (pProxyData.get())
{
SendMsgPB(NFMsg::EGMI_ACK_PROPERTY_INT, xPropertyInt, pProxyData->nFD, NFIDENTID(0, pData->nFD));
}
}
}
}
return 0;
}
this code is my open source engine tutorial code[http://www.yowoyo.com/forum.php?mod=forumdisplay&fid=46]
details you can refer at https://github.com/ketoo/NoahGameFrame