numNum 37 Posted December 2, 2019 Share Posted December 2, 2019 Hi Let us get into it straight away well i did this function void CParty::JumpParty(LPPARTY pParty, int x, int y) { FWarpToPosition f(x, y); pParty->ForEachNearMember(f); } in party.cpp it is for warp all party members the thing is that after warp all players will be in same position , i want that after warp each party member have some distance between each other ( not all in same position ) some dev gave me this but it didn't work void CParty::JumpParty(LPPARTY pParty, int x, int y) { /// POSITION_MARKING int iPixelPos[PARTY_MAX_MEMBER][2] = { {50, 50}, {50, 0}, {50, -50}, {50, 50}, {50, 0}, {50, -50}, {50, 0}, {50, -50}, }; /// END_OF_POSITION_MARKING int n = 0; while (n < GetNearMemberCount()) { FWarpToPosition f(x + iPixelPos[n][0], y + iPixelPos[n][1]); pParty->ForEachNearMember(f); ++n; } } any clue ? Link to comment Share on other sites More sharing options...
Premium r00t 123 Posted December 2, 2019 Premium Share Posted December 2, 2019 What u mean with "not work" ? Compiling error or what? 1 1 Link to comment Share on other sites More sharing options...
numNum 37 Posted December 2, 2019 Author Share Posted December 2, 2019 2 hours ago, r00t said: What u mean with "not work" ? Compiling error or what? i mean that nothing changed in game .. Link to comment Share on other sites More sharing options...
ManiacRobert 429 Posted December 2, 2019 Share Posted December 2, 2019 Why while statement lol struct FWarpToPosition { long lMapIndex; long x; long y; FWarpToPosition(long lMapIndex, long x, long y) : lMapIndex(lMapIndex), x(x), y(y) {} void operator()(LPENTITY ent) { if (!ent->IsType(ENTITY_CHARACTER)) { return; } LPCHARACTER ch = (LPCHARACTER)ent; if (!ch->IsPC()) { return; } if (ch->GetMapIndex() == lMapIndex) { ch->Show(lMapIndex, x, y, 0); ch->Stop(); } else { BYTE RandomNumber = number(0, 15); ch->WarpSet(x + RandomNumber, y + RandomNumber, lMapIndex); } } }; 1 Link to comment Share on other sites More sharing options...
numNum 37 Posted December 2, 2019 Author Share Posted December 2, 2019 9 minutes ago, ManiacRobert said: Why while statement lol struct FWarpToPosition { long lMapIndex; long x; long y; FWarpToPosition(long lMapIndex, long x, long y) : lMapIndex(lMapIndex), x(x), y(y) {} void operator()(LPENTITY ent) { if (!ent->IsType(ENTITY_CHARACTER)) { return; } LPCHARACTER ch = (LPCHARACTER)ent; if (!ch->IsPC()) { return; } if (ch->GetMapIndex() == lMapIndex) { ch->Show(lMapIndex, x, y, 0); ch->Stop(); } else { BYTE RandomNumber = number(0, 15); ch->WarpSet(x + RandomNumber, y + RandomNumber, lMapIndex); } } }; thank you but this will only warp one player what i want is to warp all party members .. using this function .. pParty->ForEachNearMember(f); Link to comment Share on other sites More sharing options...
ManiacRobert 429 Posted December 2, 2019 Share Posted December 2, 2019 Acum 3 minute, jeddawee a spus: thank you but this will only warp one player what i want is to warp all party members .. using this function .. pParty->ForEachNearMember(f); Just try to replace my function with yours in dungeon.cpp ... 1 Link to comment Share on other sites More sharing options...
numNum 37 Posted December 2, 2019 Author Share Posted December 2, 2019 46 minutes ago, ManiacRobert said: Just try to replace my function with yours in dungeon.cpp ... Unfortunately not fixed after warp all party members warp to same position Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted December 2, 2019 Premium Share Posted December 2, 2019 And why exactly do you need source functions for that? For dungeons: local difference = math.random(1, 3); d.jump_all(localPositionX + difference, localPositionY + difference); --Or, if you need it for the dungeon creation: local difference = math.random(1, 3); d.new_jump_party(dungeon_index, positionX + difference, positionY + difference); Or, if you're not inside a dungeon instance: local difference = math.random(1, 3); local pids = {party.get_member_pids()}; for _, pid in ipairs(pids) do q.begin_other_pc_block(pid); pc.warp(positionX + difference, positionY + difference); q.end_other_pc_block(); end -- for -- Or, if the position is local (same map) local difference = math.random(1, 3); local pids = {party.get_member_pids()}; for _, pid in ipairs(pids) do q.begin_other_pc_block(pid); pc.warp_local(localPositionX + difference, localPositionY + difference); q.end_other_pc_block(); end -- for 3 "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10274 Posted December 2, 2019 Forum Moderator Share Posted December 2, 2019 (edited) On 12/2/2019 at 3:33 PM, ManiacRobert said: Why while statement lol The while is with a scope, he wanted to make for each player an specific position, not random position. @jeddawee You could atleast to post the FWarpToPosition from party.cpp, i see that you use the struct without the first argument as lMapIndex like dungeon.cpp, if you use another struct and not the one from dungeon.cpp, just send me a pm and let's don't make a spam topic. This is the hidden content, please Sign In or Sign Up Edited December 3, 2020 by VegaS™ 3 1 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...
Premium WeedHex 635 Posted December 2, 2019 Premium Share Posted December 2, 2019 Better LUA solution. 1 Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted December 2, 2019 Premium Share Posted December 2, 2019 If he wanted the players in the party to have specific difference in coordinates then it's also simple to do it, like this. local pids = {party.get_member_pids()}; local difference = { [1] = {["x"] = 0, ["y"] = -50}, [2] = {["x"] = 50, ["y"] = -50}, [3] = {["x"] = -50, ["y"] = -50}, [4] = {["x"] = 0, ["y"] = 50}, [5] = {["x"] = 50, ["y"] = 50}, [6] = {["x"] = -50, ["y"] = 50}, [7] = {["x"] = 0, ["y"] = 0}, [8] = {["x"] = 50, ["y"] = 0} }; for index, pid in ipairs(pids) do q.begin_other_pc_block(pid); pc.warp(positionX + difference[index]["x"], positionY + difference[index]["y"]); q.end_other_pc_block(); end -- for -- Or, if the position is local (same map) for index, pid in ipairs(pids) do q.begin_other_pc_block(pid); pc.warp_local(localPositionX + difference[index]["x"], localPositionY + difference[index]["y"]); q.end_other_pc_block(); end -- for 2 "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
numNum 37 Posted December 2, 2019 Author Share Posted December 2, 2019 3 hours ago, ManiacRobert said: Just try to replace my function with yours in dungeon.cpp ... yes your code worked i just had to x100 the number(0, 15 ) xDD But yeah as @VegaS™ said , i want the party warp in fixed order not random order 1 hour ago, Syreldar said: If he wanted the players in the party to have specific difference in coordinates then it's also simple to do it, like this. local pids = {party.get_member_pids()}; local difference = { [1] = {0, -50}, [2] = {50, -50}, [3] = {-50, -50}, [4] = {0, 50}, [5] = {50, 50}, [6] = {-50, 50}, [7] = {0, 0}, [8] = {50, 0} }; for index, pid in ipairs(pids) do q.begin_other_pc_block(pid); pc.warp(localPositionX + difference[index][1], localPositionY + difference[index][2]); q.end_other_pc_block(); end -- for -- Or, if the position is local (same map) local difference = math.random(1, 3); local pids = {party.get_member_pids()}; for index, pid in ipairs(pids) do q.begin_other_pc_block(pid); pc.warp_local(positionX + difference[index][1], positionY + difference[index][2]); q.end_other_pc_block(); end -- for thank you for helping Link to comment Share on other sites More sharing options...
Forum Moderator Solution VegaS™ 10274 Posted December 2, 2019 Forum Moderator Solution Share Posted December 2, 2019 As i thought, that's what he needed: This is the hidden content, please Sign In or Sign Up 7 2 3 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...
numNum 37 Posted December 2, 2019 Author Share Posted December 2, 2019 4 minutes ago, VegaS™ said: As i thought, that's what he needed: void CParty::JumpParty(const long lX, const long lY) { static const int32_t iPixelPos[PARTY_MAX_MEMBER][2] = { {50, 50}, {50, 0}, {50, -50}, {50, 50}, {50, 0}, {50, -50}, {50, 0}, {50, -50}, }; if (_countof(iPixelPos) < m_memberMap.size()) return; uint8_t iPos = 0; for (TMemberMap::const_iterator it = m_memberMap.begin(); it != m_memberMap.end(); ++it) { const LPCHARACTER ch = it->second.pCharacter; if (ch && it->second.bNear) { const int32_t iDiffX = iPixelPos[iPos][0]; const int32_t iDiffY = iPixelPos[iPos][1]; ch->WarpSet(lX + iDiffX, lY + iDiffY); ++iPos; } } } fixed, thank you man so much i know my explanation was bad but you could get what i need exactly xD 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