Evor 72 Posted February 16, 2014 Share Posted February 16, 2014 Hello. I want to write the new trigger function called "hit". I was basically looking at "kill" triggering, but i place quest::CQuestManager::instance().Hit(pkAttacker->GetPlayerID(), pkVictim->GetRaceNum()); in battle.cpp. Also i write some sys_log information to trigger when the function is executed etc. Everything seems to be same as kill, but when kill begin - works fine when hit begin - doesn't work ;/ So my code: QuestManager.cpp void CQuestManager::Hit(unsigned int pc, unsigned int npc){ PC * pPC; sys_log(0, "CQuestManager::HIT QUEST_HIT_EVENT (pc=%d, npc=%d)", pc, npc); if ((pPC = GetPC(pc))){ if (!CheckQuestLoaded(pPC)) return; m_mapNPC[npc].OnHit(*pPC); } else sys_err("QUEST: no such pc id : %d", pc); } QuestNpc.cpp bool NPC::OnHit(PC& pc) { sys_log(0,"NPC::OnHit QUEST_HIT_EVENT PC: %d",pc); if (m_vnum) { //PROF_UNIT puOnKill1("onk1"); //return HandleEvent(pc, QUEST_HIT_EVENT); sys_log(0,"NPC::OnHit HandleEvent PC: %d, QUEST_HIT_EVENT",pc); return HandleEvent(pc, QUEST_HIT_EVENT); } else { //PROF_UNIT puOnKill2("onk2"); //return HandleReceiveAllEvent(pc, QUEST_HIT_EVENT); sys_log(0,"NPC::OnHit HandleReceiveAllEvent PC: %d, QUEST_HIT_EVENT",pc); return HandleReceiveAllEvent(pc, QUEST_HIT_EVENT); } } Ofc. i add QUEST_HIT_EVENT to quest.h and m_mapEventName.insert(TEventNameMap::value_type("hit", QUEST_HIT_EVENT)); to questmanager.cpp. Help me Thanks in advance! PS. My quest -- EVOR TESTUJE FUNKCJE npc. quest npc_function begin state start begin when hit begin chat("test") -- that dosen't work ;/ end when kill begin chat("test kill") -- that works just fine end end end PS2. Syslog: Feb 16 14:16:01.660000 :: [TEST_SERVER] Attack : EvorTest type 0, MobBattleType 0 Feb 16 14:16:01.660000 :: battle_melee_attack : [EvorTest] attack to [Głodny Wilk] Feb 16 14:16:01.660000 :: battle_melee_attack : [EvorTest] attack to [Głodny Wilk] Feb 16 14:16:01.660000 :: battle_melee_attack : [EvorTest] attack to [Głodny Wilk] Feb 16 14:16:01.660000 :: battle_hit : [EvorTest] attack to [Głodny Wilk] : dam :175 type :244485752 Feb 16 14:16:01.660000 :: CQuestManager::HIT QUEST_HIT_EVENT (pc=58855, npc=172) Feb 16 14:16:01.660000 :: NPC::OnHit QUEST_HIT_EVENT PC: 798260784 Feb 16 14:16:01.660000 :: NPC::OnHit HandleReceiveAllEvent PC: 798260784, QUEST_HIT_EVENT Feb 16 14:16:01.660000 :: Click Quest : MatchingQuest Feb 16 14:16:01.660000 :: Powinnno wytrigerować hit Feb 16 14:16:01.660000 :: Bonus Exp : Ramadan Candy: 0 MallExp: 0 PointExp: 0 Feb 16 14:16:01.660000 :: CQuestManager::Kill QUEST_KILL_EVENT (pc=58855, npc=172) Feb 16 14:16:01.660000 :: NPC::OnKill HandleReceiveAllEvent PC:798260784 Feb 16 14:16:01.660000 :: Click Quest : MatchingQuest Feb 16 14:16:01.660000 :: Click Quest : MatchingQuest Feb 16 14:16:01.676000 :: NPC::OnKill HandleReceiveAllEvent PC:798260784 Feb 16 14:16:01.676000 :: Click Quest : MatchingQuest Feb 16 14:16:01.676000 :: QUEST Setting flag npc_function.__status 0 Link to comment Share on other sites More sharing options...
Evor 72 Posted February 17, 2014 Author Share Posted February 17, 2014 Nobody? Link to comment Share on other sites More sharing options...
Rumor 2624 Posted February 17, 2014 Share Posted February 17, 2014 I looked but I'm not really experienced in this sorry Link to comment Share on other sites More sharing options...
Evor 72 Posted February 17, 2014 Author Share Posted February 17, 2014 Oh okey. Have to find another way ;p (maybe do in the src directly) Link to comment Share on other sites More sharing options...
Active Member ATAG 311 Posted February 17, 2014 Active Member Share Posted February 17, 2014 I think you must make a call quest::CQuestManager::instance().Hit(pkKiller->GetPlayerID(), quest::QUEST_NO_NPC); somewhere in char_battle.cpp Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19764 Posted February 17, 2014 Honorable Member Share Posted February 17, 2014 I think you have to put your code into this function in battle.cpp: int battle_melee_attack(LPCHARACTER ch, LPCHARACTER victim) Try it. Link to comment Share on other sites More sharing options...
Evor 72 Posted February 18, 2014 Author Share Posted February 18, 2014 I think you have to put your code into this function in battle.cpp: int battle_melee_attack(LPCHARACTER ch, LPCHARACTER victim) Try it. Yea. Game is triggering hit properly, but quest has some problems with reading it. I exactly do as penger suggest, but no such luck either. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now