Cripplez 40 Posted October 5, 2019 Share Posted October 5, 2019 Hi, I'd like to add in source that you can't use the mount and horse while you are in a dungeon if pc.in_dungeon() then syschat("You can't use this mount while you are in a Dungeon.") return end I used this in my quest of ride.lua, but i would prefer add this in the server source and add that you can't summon/ride the horse in dungeon and if you are riding a mount/horse you unmount it. Anyone can help me to do this? Thank you again! Link to comment Share on other sites More sharing options...
Premium WeedHex 636 Posted October 5, 2019 Premium Share Posted October 5, 2019 Like this you won't ride in any map with index >=10000 it's not safe. Do the check with the dungeon index. Link to comment Share on other sites More sharing options...
Cripplez 40 Posted October 8, 2019 Author Share Posted October 8, 2019 On 10/5/2019 at 4:22 PM, WeedHex said: Like this you won't ride in any map with index >=10000 it's not safe. Do the check with the dungeon index. Only the dungeon should have >= 10000, so I don't think this could be a problem for me, it is fine if every dungeon has mount blocked. I'm trying to make that when you enter a dungeon you unmount the horse or mount, but i can't make it work This is working only for horse, if you are riding a mount it doesn't work when login with dungeon_test.beran_test_index(pc.get_map_index()) begin pc.set_warp_location (99, 1234, 5678) if pc.get_level() < 90 then warp_to_village() end timer ( "time_test_dungeon", 20 * 60 ) pc.unmount() horse.unsummon() d.setf("mobs_left", d.count_monster()) end EDIT: I resolved the mount problem adding timer ( "time_unmount", 6 ) above the other timer when time_unmount.timer with dungeon_test.beran_test_index(pc.get_map_index()) begin pc.unmount() end But i don't really like this solution..., i was wondering if there is something better Link to comment Share on other sites More sharing options...
Premium WeedHex 636 Posted October 8, 2019 Premium Share Posted October 8, 2019 Good solution. Link to comment Share on other sites More sharing options...
Contributor MrQuin 6430 Posted October 8, 2019 Contributor Share Posted October 8, 2019 Do you have combat zone installed ? My only accounts are here and on M2D, Don't trust anyone else from other shitty sites. Link to comment Share on other sites More sharing options...
Cripplez 40 Posted October 8, 2019 Author Share Posted October 8, 2019 30 minutes ago, MrQuin said: Do you have combat zone installed ? No, i don't have it 1 Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10297 Posted October 8, 2019 Forum Moderator Share Posted October 8, 2019 Not tested, but you can try to do something like: Srcs/Server/game/src/questlua_horse.cpp Spoiler // Search in horse_summon function: bool bFromFar = lua_isboolean(L, 1) ? lua_toboolean(L, 1) : false; // Add before: #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON if (ch && ch->GetDungeon()) return 0; #endif Srcs/Server/game/src/questlua_pc.cpp Spoiler // Search in pc_mount_bonus and pc_mount function: LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); // Add after: #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON if (ch && ch->GetDungeon()) return 0; #endif Srcs/Server/game/src/input_login.cpp Spoiler // Search in CInputLogin::Entergame(LPDESC d, const char * data) for: if (ch->GetHorseLevel() > 0) { DWORD pid = ch->GetPlayerID(); if (pid != 0 && CHorseNameManager::instance().GetHorseName(pid) == NULL) db_clientdesc->DBPacket(HEADER_GD_REQ_HORSE_NAME, 0, &pid, sizeof(DWORD)); } // Add after: #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON if (ch && ch->GetDungeon()) { if (ch->IsHorseRiding()) { ch->StopRiding(); ch->HorseSummon(false); } if (ch->FindAffect(AFFECT_MOUNT)) { ch->RemoveAffect(AFFECT_MOUNT); ch->RemoveAffect(AFFECT_MOUNT_BONUS); } } #endif Srcs/Server/game/service.h Spoiler #define ENABLE_BLOCK_RIDING_IN_DUNGEON 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...
Cripplez 40 Posted October 9, 2019 Author Share Posted October 9, 2019 11 hours ago, VegaS™ said: Not tested, but you can try to do something like: Srcs/Server/game/src/questlua_horse.cpp Hide contents // Search in horse_summon function: bool bFromFar = lua_isboolean(L, 1) ? lua_toboolean(L, 1) : false; // Add before: #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON if (ch && ch->GetDungeon() && ch->IsHorseRiding()) { ch->StopRiding(); ch->HorseSummon(false); return 0; } #endif Srcs/Server/game/src/questlua_pc.cpp Hide contents // Search in pc_mount_bonus function: LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); // Add after: #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON if (ch && ch->GetDungeon() && ch->FindAffect(AFFECT_MOUNT)) { ch->RemoveAffect(AFFECT_MOUNT); ch->RemoveAffect(AFFECT_MOUNT_BONUS); return 0; } #endif Srcs/Server/game/src/input_login.cpp Hide contents // Search in CInputLogin::Entergame(LPDESC d, const char * data) for: if (ch->GetHorseLevel() > 0) { DWORD pid = ch->GetPlayerID(); if (pid != 0 && CHorseNameManager::instance().GetHorseName(pid) == NULL) db_clientdesc->DBPacket(HEADER_GD_REQ_HORSE_NAME, 0, &pid, sizeof(DWORD)); } // Add after: #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON if (ch && ch->GetDungeon()) { if (ch->IsHorseRiding()) { ch->StopRiding(); ch->HorseSummon(false); } if (ch->FindAffect(AFFECT_MOUNT)) { ch->RemoveAffect(AFFECT_MOUNT); ch->RemoveAffect(AFFECT_MOUNT_BONUS); } } #endif Srcs/Server/game/service.h Hide contents #define ENABLE_BLOCK_RIDING_IN_DUNGEON Thank you, it is working for horse, but not for the mount Maybe is because first the game read if i'm riding and make me StopRiding, but if I login in a map while i was riding a mount, the game doesn't immediatly know I'm riding and update my character riding 1 second later? Sometimes when i login with a mount i see my character standing and 1 second later i am riding again my mount I'm not sure if i did this part as you write in your message, maybe the problem is here? Spoiler if (ch->GetHorseLevel() > 0) { DWORD pid = ch->GetPlayerID(); if (pid != 0 && CHorseNameManager::instance().GetHorseName(pid) == NULL) db_clientdesc->DBPacket(HEADER_GD_REQ_HORSE_NAME, 0, &pid, sizeof(DWORD)); //@fix horse_level update at login ch->SetHorseLevel(ch->GetHorseLevel()); ch->SkillLevelPacket(); #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON if (ch && ch->GetDungeon()) { if (ch->IsHorseRiding()) { ch->StopRiding(); ch->HorseSummon(false); } if (ch->FindAffect(AFFECT_MOUNT)) { ch->RemoveAffect(AFFECT_MOUNT); ch->RemoveAffect(AFFECT_MOUNT_BONUS); } } #endif } Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10297 Posted October 9, 2019 Forum Moderator Share Posted October 9, 2019 2 hours ago, Cripplez said: I'm not sure if i did this part as you write in your message, maybe the problem is here? Hide contents if (ch->GetHorseLevel() > 0) { DWORD pid = ch->GetPlayerID(); if (pid != 0 && CHorseNameManager::instance().GetHorseName(pid) == NULL) db_clientdesc->DBPacket(HEADER_GD_REQ_HORSE_NAME, 0, &pid, sizeof(DWORD)); //@fix horse_level update at login ch->SetHorseLevel(ch->GetHorseLevel()); ch->SkillLevelPacket(); #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON if (ch && ch->GetDungeon()) { if (ch->IsHorseRiding()) { ch->StopRiding(); ch->HorseSummon(false); } if (ch->FindAffect(AFFECT_MOUNT)) { ch->RemoveAffect(AFFECT_MOUNT); ch->RemoveAffect(AFFECT_MOUNT_BONUS); } } #endif } You added it wrong, not inside of GetHorseLevel > 0, outside of condition. Spoiler if (ch->GetHorseLevel() > 0) { DWORD pid = ch->GetPlayerID(); if (pid != 0 && CHorseNameManager::instance().GetHorseName(pid) == NULL) db_clientdesc->DBPacket(HEADER_GD_REQ_HORSE_NAME, 0, &pid, sizeof(DWORD)); //@fix horse_level update at login ch->SetHorseLevel(ch->GetHorseLevel()); ch->SkillLevelPacket(); } #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON if (ch && ch->GetDungeon()) { if (ch->IsHorseRiding()) { ch->StopRiding(); ch->HorseSummon(false); } if (ch->FindAffect(AFFECT_MOUNT)) { ch->RemoveAffect(AFFECT_MOUNT); ch->RemoveAffect(AFFECT_MOUNT_BONUS); } } #endif 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...
Cripplez 40 Posted October 9, 2019 Author Share Posted October 9, 2019 5 hours ago, VegaS™ said: You added it wrong, not inside of GetHorseLevel > 0, outside of condition. Reveal hidden contents if (ch->GetHorseLevel() > 0) { DWORD pid = ch->GetPlayerID(); if (pid != 0 && CHorseNameManager::instance().GetHorseName(pid) == NULL) db_clientdesc->DBPacket(HEADER_GD_REQ_HORSE_NAME, 0, &pid, sizeof(DWORD)); //@fix horse_level update at login ch->SetHorseLevel(ch->GetHorseLevel()); ch->SkillLevelPacket(); } #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON if (ch && ch->GetDungeon()) { if (ch->IsHorseRiding()) { ch->StopRiding(); ch->HorseSummon(false); } if (ch->FindAffect(AFFECT_MOUNT)) { ch->RemoveAffect(AFFECT_MOUNT); ch->RemoveAffect(AFFECT_MOUNT_BONUS); } } #endif Okay I tried like this but when i'm riding a mount it still doesn't make me unmount it with the horse it is perfect Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10297 Posted October 9, 2019 Forum Moderator Share Posted October 9, 2019 1 hour ago, Cripplez said: I tried like this but when i'm riding a mount it still doesn't make me unmount it with the horse it is perfect Then your problem is that you've costume mount slot, not the default mount, replace the code what i gave you with: #ifdef ENABLE_BLOCK_RIDING_IN_DUNGEON if (ch && ch->GetDungeon()) { const LPITEM pMount = ch->GetWear(WEAR_COSTUME_MOUNT); if (pMount && pMount->IsEquipped()) ch->UnequipItem(pMount); if (ch->IsHorseRiding()) { ch->StopRiding(); ch->HorseSummon(false); } } #endif Be careful to have on all of your vnums type: ITEM_COSTUME < 28, sub type: COSTUME_MOUNT < 2 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 636 Posted October 9, 2019 Premium Share Posted October 9, 2019 Was better with timer solution, mount begin load after other things so checking the login is useless cuz there isn't still the mount 1 Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10297 Posted October 9, 2019 Forum Moderator Share Posted October 9, 2019 On 10/9/2019 at 11:44 PM, WeedHex said: Was better with timer solution, mount begin load after other things so checking the login is useless cuz there isn't still mount at login No, we don't need a timer for this, you're right that you can't do this inside of login because the POINT_MOUNT is seted after, so, this method is for all types of mounts/horses: This is the hidden content, please Sign In or Sign Up Not tested. 6 1 1 1 7 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...
ManiacRobert 429 Posted October 9, 2019 Share Posted October 9, 2019 Why u don't move horse summon to costume_mount? Link to comment Share on other sites More sharing options...
Cripplez 40 Posted October 9, 2019 Author Share Posted October 9, 2019 VegaS helped me on AnyDesk and he resolved the problem! Now everything works perfect, he even added a list of the mount that can be used in dungeon if i want. Thank you again! 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