Active+ Member MT2Dev 566 Posted June 4 Active+ Member Share Posted June 4 (edited) INTRODUCTION & PROBLEM Hello, as you know in the horse system in the game, the player can feed his horse in an unlimited number of times, this will not cause an overflow problem due to the controls in the codes, but I think feeding a horse whose health is already full does not benefit the player. WHY & WHAT DID WE CHANGE? We made sure that the horse refuses to be fed when its health reaches the maximum level and the player receives an information message, and we also added extra controls. UPDATE - 29/06/2024 With @ HFWhite's and @Werwolf94's contribution, we updated the fix for be effective. HOW TO DO? First, open the "horse_rider.cpp" file. This is the hidden content, please Sign In or Sign Up Then, open the "char_item.cpp" file. This is the hidden content, please Sign In or Sign Up Then, open the "cmd_general.cpp" file. This is the hidden content, please Sign In or Sign Up Then open the "questlua_horse.cpp" file. This is the hidden content, please Sign In or Sign Up Now we need to change one last thing in our .quests, open the SF quest folder and find&open the "horse_menu.quest" This is the hidden content, please Sign In or Sign Up Finally, open the "locale_string.txt" and added to the end; This is the hidden content, please Sign In or Sign Up Best regards, MT2Dev. Edited Saturday at 12:03 PM by MT2Dev Last update. 27 6 9 © Link to comment Share on other sites More sharing options...
Marcos17 20 Posted June 5 Share Posted June 5 Excellent contribution bro 1 Link to comment Share on other sites More sharing options...
Active+ Member HFWhite 532 Posted June 18 Active+ Member Share Posted June 18 (edited) horse_rider.cpp:146:3: error: 'ChatPacket' was not declared in this scope ChatPacket(CHAT_TYPE_INFO, LC_TEXT ("HORSE_HEALTH_ALREADY_FULL")); I included char.h.. @ MT2Devany suggestions? Edit: Also it does not work. It still feeds the horse and -1 the item when feeding... Edited June 18 by HFWhite Link to comment Share on other sites More sharing options...
Active+ Member HFWhite 532 Posted June 18 Active+ Member Share Posted June 18 (edited) Anyway, found a better and easier fix. in cmd_general.cpp in the do_user_feed_horse command add this inside: This is the hidden content, please Sign In or Sign Up no need to modify the horse_rider.cpp open questlua_horse.cpp and find int horse_feed(lua_State* L) under LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); add: This is the hidden content, please Sign In or Sign Up Edited June 18 by HFWhite 8 1 1 Link to comment Share on other sites More sharing options...
Active+ Member MT2Dev 566 Posted June 19 Author Active+ Member Share Posted June 19 On 6/18/2024 at 11:52 PM, HFWhite said: Anyway, found a better and easier fix. in cmd_general.cpp in the do_user_feed_horse command add this inside: Hidden Content unsigned char horselevel = ch->GetHorseLevel(); if (ch->GetHorseHealth() >= c_aHorseStat[horselevel].iMaxHealth) { ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT ("Calu iti transmite: sunt full coaie")); return; } no need to modify the horse_rider.cpp open questlua_horse.cpp and find int horse_feed(lua_State* L) under LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); add: Hidden Content unsigned char horselevel = ch->GetHorseLevel(); if (ch->GetHorseHealth() >= c_aHorseStat[horselevel].iMaxHealth) { ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT ("Calu iti transmite: sunt full coaie")); return 0; } Thank you for your contribution, I am updating the topic. © Link to comment Share on other sites More sharing options...
Active+ Member HFWhite 532 Posted June 20 Active+ Member Share Posted June 20 @ MT2Dev update the post with the following: You need to also update the quest horse_menu.quest to stop the -1 of the food when the horse;s health is 100%. In order to do that search for: if pc.countitem(food) > 0 then pc.removeitem(food, 1) horse.feed() and replace with: This is the hidden content, please Sign In or Sign Up 4 1 1 Link to comment Share on other sites More sharing options...
Werwolf94 4 Posted June 23 Share Posted June 23 Sadly any of your solutions won't prevent the player to feed the horse via drag&drop a hay from inventory to the horse. I think for the simpliest prevention it's enough to check the horse health at the horse_menu.quest as HFWhite said at the last comment. 1 Link to comment Share on other sites More sharing options...
Active+ Member HFWhite 532 Posted June 23 Active+ Member Share Posted June 23 Just now, Werwolf94 said: Sadly any of your solutions won't prevent the player to feed the horse via drag&drop a hay from inventory to the horse. I think for the simpliest prevention it's enough to check the horse health at the horse_menu.quest as HFWhite said at the last comment. I didn't even think that was an option, the drag and drop wtf Link to comment Share on other sites More sharing options...
Werwolf94 4 Posted June 23 Share Posted June 23 (edited) I also don't beleive it when I first saw it's possible, but here is the proof (as you can see your quest solution worked well for me): Edited June 23 by Werwolf94 1 1 Link to comment Share on other sites More sharing options...
Active+ Member MT2Dev 566 Posted June 23 Author Active+ Member Share Posted June 23 (edited) 1 hour ago, Werwolf94 said: I also don't beleive it when I first saw it's possible, but here is the proof (as you can see your quest solution worked well for me): Honestly, I didn't know that horses could be fed by dragging until you wrote this comment , we can solve this via .quest i guess, it will be enough to add the same control to the function that feeds horses by dragging. (Idk the quest file, but i will take a look at this) @Werwolf94 After a quick look, thats what i find in serverside src; // In char_item.cpp find the; bool CHARACTER::CanReceiveItem (LPCHARACTER from, LPITEM item) const // Then find this; case 20101: case 20102: case 20103: if (item->GetVnum() == ITEM_REVIVE_HORSE_1) { if (!IsDead()) { from->ChatPacket (CHAT_TYPE_INFO, LC_TEXT ("죽지 않은 말에게 선초를 먹일 수 없습니다.")); return false; } return true; } else if (item->GetVnum() == ITEM_HORSE_FOOD_1) { if (IsDead()) { from->ChatPacket (CHAT_TYPE_INFO, LC_TEXT ("죽은 말에게 사료를 먹일 수 없습니다.")); return false; } return true; } else if (item->GetVnum() == ITEM_HORSE_FOOD_2 || item->GetVnum() == ITEM_HORSE_FOOD_3) { return false; } break; // So this is drop&drag feature for some horse vnums, if you want to disable this, just comment ITEM_HORSE_FOOD_1 else if but if we want to control this too, change like this and try again; case 20101: case 20102: case 20103: if (item->GetVnum() == ITEM_REVIVE_HORSE_1) { if (!IsDead()) { from->ChatPacket (CHAT_TYPE_INFO, LC_TEXT ("죽지 않은 말에게 선초를 먹일 수 없습니다.")); return false; } return true; } else if (item->GetVnum() == ITEM_HORSE_FOOD_1) { if (IsDead()) { from->ChatPacket (CHAT_TYPE_INFO, LC_TEXT ("죽은 말에게 사료를 먹일 수 없습니다.")); return false; } // DevFix 100 unsigned char horselevel = from->GetHorseLevel(); // DevFix 122 if (from->GetHorseHealth() >= c_aHorseStat[horselevel].iMaxHealth) { from->ChatPacket (CHAT_TYPE_INFO, LC_TEXT ("HORSE_HEALTH_ALREADY_FULL")); return false; } return true; } else if (item->GetVnum() == ITEM_HORSE_FOOD_2 || item->GetVnum() == ITEM_HORSE_FOOD_3) { return false; } break; // ATTANTION! That code block just for item vnum 50054, test this if that one work well i will give update about all vnums for sure. Edited June 23 by MT2Dev © Link to comment Share on other sites More sharing options...
Premium NeeveS 1 Posted June 23 Premium Share Posted June 23 Thanks for the content! The horse after being killed, if the player teleports, it returns with 100% health. In other words, the horse will never starve. 1 Link to comment Share on other sites More sharing options...
Active+ Member MT2Dev 566 Posted June 23 Author Active+ Member Share Posted June 23 41 minutes ago, NeeveS said: Thanks for the content! The horse after being killed, if the player teleports, it returns with 100% health. In other words, the horse will never starve. Hi there. To be honest, all the changes we've made in this topic are related to horse feeding functions, so I don't think this is causing the problem you mentioned. Could you have accidentally removed an existing system while adding it? Or is there a possibility that this problem existed before adding this system? Regards. © Link to comment Share on other sites More sharing options...
Active+ Member MT2Dev 566 Posted Saturday at 12:05 PM Author Active+ Member Share Posted Saturday at 12:05 PM #Uptaded. © Link to comment Share on other sites More sharing options...
Recommended Posts