ManiacRobert 429 Posted September 24, 2019 Share Posted September 24, 2019 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) entity_view.cpp void operator () (LPENTITY ent) { // 오브젝트가 아닌 것은 거리를 계산하여 거리가 멀면 추가하지 않는다. if (!ent->IsType(ENTITY_OBJECT)) if (DISTANCE_APPROX(ent->GetX() - m_me->GetX(), ent->GetY() - m_me->GetY()) > dwViewRange) return; #ifdef HIDDEN_OX if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { LPCHARACTER chMe = (LPCHARACTER)m_me; LPCHARACTER chEnt = (LPCHARACTER)ent; if (chMe->IsPC() && chEnt->IsPC() && !chMe->IsGM() && !chEnt->IsGM() && chMe->GetMapIndex() == 113 && chEnt->GetMapIndex() == 113) return; } #endif 29 5 1 21 Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10275 Posted September 25, 2019 Forum Moderator Share Posted September 25, 2019 (edited) On 9/25/2019 at 1:50 AM, ManiacRobert said: Spoiler void operator () (LPENTITY ent) { // 오브젝트가 아닌 것은 거리를 계산하여 거리가 멀면 추가하지 않는다. if (!ent->IsType(ENTITY_OBJECT)) if (DISTANCE_APPROX(ent->GetX() - m_me->GetX(), ent->GetY() - m_me->GetY()) > dwViewRange) return; #ifdef HIDDEN_OX if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { LPCHARACTER chMe = (LPCHARACTER)m_me; LPCHARACTER chEnt = (LPCHARACTER)ent; if (chMe->IsPC() && chEnt->IsPC() && !chMe->IsGM() && !chEnt->IsGM() && chMe->GetMapIndex() == 113 && chEnt->GetMapIndex() == 113) return; } #endif Since already is a check for distance, is impossible that the entity to be in another map, so is enough to check if you're in the map. This is the hidden content, please Sign In or Sign Up Edited October 7, 2021 by VegaS™ 38 1 8 2 16 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Active Member ReFresh 2340 Posted October 1, 2019 Active Member Share Posted October 1, 2019 Could it look like this? Spoiler class CFuncViewInsert { private: int dwViewRange; public: LPENTITY m_me; CFuncViewInsert(LPENTITY ent) : dwViewRange(VIEW_RANGE + VIEW_BONUS_RANGE), m_me(ent) { } void operator () (LPENTITY ent) { // żŔşęÁ§Ć®°ˇ ľĆ´Ń °ÍŔş °Ĺ¸®¸¦ °č»ęÇĎż© °Ĺ¸®°ˇ ¸Ö¸é Ăß°ˇÇĎÁö ľĘ´Â´Ů. if (!ent->IsType(ENTITY_OBJECT)) if (DISTANCE_APPROX(ent->GetX() - m_me->GetX(), ent->GetY() - m_me->GetY()) > dwViewRange) return; // łŞ¸¦ ´ë»óżˇ Ăß°ˇ m_me->ViewInsert(ent); // µŃ´Ů Äł¸ŻĹ͸é if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { LPCHARACTER chMe = (LPCHARACTER) m_me; LPCHARACTER chEnt = (LPCHARACTER) ent; // ´ë»óŔĚ NPC¸é StateMachineŔ» Ų´Ů. if (chMe->IsPC() && !chEnt->IsPC() && !chEnt->IsWarp() && !chEnt->IsGoto()) chEnt->StartStateMachine(); } if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { const LPCHARACTER chMe = static_cast<LPCHARACTER>(m_me); const LPCHARACTER chEnt = static_cast<LPCHARACTER>(ent); if (chMe->GetMapIndex() == 113 && !chMe->IsGM() && !chEnt->IsGM()) return; } } }; Or I can remove some parts and in final it will look like this? Spoiler class CFuncViewInsert { private: int dwViewRange; public: LPENTITY m_me; CFuncViewInsert(LPENTITY ent) : dwViewRange(VIEW_RANGE + VIEW_BONUS_RANGE), m_me(ent) { } void operator () (LPENTITY ent) { // żŔşęÁ§Ć®°ˇ ľĆ´Ń °ÍŔş °Ĺ¸®¸¦ °č»ęÇĎż© °Ĺ¸®°ˇ ¸Ö¸é Ăß°ˇÇĎÁö ľĘ´Â´Ů. if (!ent->IsType(ENTITY_OBJECT)) if (DISTANCE_APPROX(ent->GetX() - m_me->GetX(), ent->GetY() - m_me->GetY()) > dwViewRange) return; // łŞ¸¦ ´ë»óżˇ Ăß°ˇ m_me->ViewInsert(ent); // µŃ´Ů Äł¸ŻĹ͸é // ´ë»óŔĚ NPC¸é StateMachineŔ» Ų´Ů. if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { const LPCHARACTER chMe = static_cast<LPCHARACTER>(m_me); const LPCHARACTER chEnt = static_cast<LPCHARACTER>(ent); if (chMe->IsPC() && !chEnt->IsPC() && !chEnt->IsWarp() && !chEnt->IsGoto()) chEnt->StartStateMachine(); if (chMe->GetMapIndex() == 113 && !chMe->IsGM() && !chEnt->IsGM()) return; } } }; I'm not sure if this part has some another functionality and if I should preserve this piece of code: Spoiler if (chMe->IsPC() && !chEnt->IsPC() && !chEnt->IsWarp() && !chEnt->IsGoto()) chEnt->StartStateMachine(); I'll be always helpful! Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10275 Posted October 1, 2019 Forum Moderator Share Posted October 1, 2019 29 minutes ago, ReFresh said: Could it look like this? No, you need to add the condition before inserting the entity. Spoiler class CFuncViewInsert { private: int dwViewRange; public: LPENTITY m_me; CFuncViewInsert(LPENTITY ent) : dwViewRange(VIEW_RANGE + VIEW_BONUS_RANGE), m_me(ent) { } void operator () (LPENTITY ent) { // 오브젝트가 아닌 것은 거리를 계산하여 거리가 멀면 추가하지 않는다. if (!ent->IsType(ENTITY_OBJECT)) if (DISTANCE_APPROX(ent->GetX() - m_me->GetX(), ent->GetY() - m_me->GetY()) > dwViewRange) return; #ifdef HIDDEN_OX if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { const LPCHARACTER chMe = static_cast<LPCHARACTER>(m_me); const LPCHARACTER chEnt = static_cast<LPCHARACTER>(ent); if (chMe->GetMapIndex() == OXEVENT_MAP_INDEX && !chMe->IsGM() && !chEnt->IsGM()) return; } #endif // 나를 대상에 추가 m_me->ViewInsert(ent); // 둘다 캐릭터면 if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { LPCHARACTER chMe = (LPCHARACTER) m_me; LPCHARACTER chEnt = (LPCHARACTER) ent; // 대상이 NPC면 StateMachine을 킨다. if (chMe->IsPC() && !chEnt->IsPC() && !chEnt->IsWarp() && !chEnt->IsGoto()) chEnt->StartStateMachine(); } } }; Don't forget: entity_view.cpp #include "OXEvent.h" service.h #define HIDDEN_OX Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Active Member ReFresh 2340 Posted October 1, 2019 Active Member Share Posted October 1, 2019 (edited) . Edited December 4, 2022 by ReFresh 1 1 2 I'll be always helpful! Link to comment Share on other sites More sharing options...
Premium Jira 458 Posted October 3, 2019 Premium Share Posted October 3, 2019 On 10/1/2019 at 4:18 AM, ReFresh said: @VegaS™ Is there another way to do it without the #ifdef? I don't want to define something in services.h. I hate these defines. Everytime you add something, you must open the services.h and add define to make it work. xd #ifdef? for you : #ifndef Link to comment Share on other sites More sharing options...
ManiacRobert 429 Posted October 3, 2019 Author Share Posted October 3, 2019 La 01.10.2019 la 4:18, ReFresh a spus: @VegaS™ Is there another way to do it without the #ifdef? I don't want to define something in services.h. I hate these defines. Everytime you add something, you must open the services.h and add define to make it work. xd Just remove #ifdef and #endif with delete button. Link to comment Share on other sites More sharing options...
Active Member hachiwari 138 Posted October 3, 2019 Active Member Share Posted October 3, 2019 Dnia 1.10.2019 o 03:18, ReFresh napisał: @VegaS™ Is there another way to do it without the #ifdef? I don't want to define something in services.h. I hate these defines. Everytime you add something, you must open the services.h and add define to make it work. xd bait? Link to comment Share on other sites More sharing options...
Active Member ReFresh 2340 Posted October 3, 2019 Active Member Share Posted October 3, 2019 @hachiwari yeah I'll be always helpful! Link to comment Share on other sites More sharing options...
CITY 38 Posted December 4, 2022 Share Posted December 4, 2022 On 9/25/2019 at 4:29 AM, VegaS™ said: Since already is a check for distance, is impossible that the entity to be in another map, so is enough to check if you're in the map. Hidden Content #ifdef HIDDEN_OX if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { const LPCHARACTER chMe = static_cast<LPCHARACTER>(m_me); const LPCHARACTER chEnt = static_cast<LPCHARACTER>(ent); if (chMe->GetMapIndex() == OXEVENT_MAP_INDEX && !chMe->IsGM() && !chEnt->IsGM()) return; } #endif Also, you should put the correct/ordered conditions, first one should be if the entity is on the map, if not that means the rest of the checks like if's GM, etc will not run, why you would check the first time if the entity is player, then if the player is game master then the map (the most important), there's no logic. Even if is a player or another type, the GetMapIndex works for all, belongs to the CHARACTER class, so, don't be afraid to use it as the first condition. Also, you don't need the IsPC check, already you did inside of IsGM, if the server running in test mode, the function will return true, if the gm_level != 0, will return true, otherwise return false < another entity than a player in this case, so with that way the players are visible to map since test_server is enabled too. As a player you will see just the GM, no players, no (Nameless Flowers 20358) < NPCs As a GM you will see everything hello How is it possible to see only the members who are in a group party? if (chMe->GetMapIndex() == OXEVENT_MAP_INDEX && !chMe->GetParty() && !chEnt->GetParty()) not work for me with GetParty()) any help for party ? 1 Link to comment Share on other sites More sharing options...
MityQ 5 Posted January 8, 2023 Share Posted January 8, 2023 #ifdef HIDDEN_OX if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { const LPCHARACTER chMe = static_cast<LPCHARACTER>(m_me); const LPCHARACTER chEnt = static_cast<LPCHARACTER>(ent); if (chMe->GetMapIndex() == OXEVENT_MAP_INDEX && !chMe->IsGM() && !chEnt->IsGM()) { if (!chMe->GetParty() || chMe->GetParty() != chEnt->GetParty()) return; } } #endif 1 Link to comment Share on other sites More sharing options...
CITY 38 Posted January 9, 2023 Share Posted January 9, 2023 22 hours ago, MityQ said: #ifdef HIDDEN_OX if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { const LPCHARACTER chMe = static_cast<LPCHARACTER>(m_me); const LPCHARACTER chEnt = static_cast<LPCHARACTER>(ent); if (chMe->GetMapIndex() == OXEVENT_MAP_INDEX && !chMe->IsGM() && !chEnt->IsGM()) { if (!chMe->GetParty() || chMe->GetParty() != chEnt->GetParty()) return; } } #endif It works perfectly How can I see only my team? I don't want them to see other teams Link to comment Share on other sites More sharing options...
Recommended Posts