Masuka00 54 Report post Posted July 21, 2022 Greetings, I would like to know how to put an NPC that gives an initial greeting or starts a conversation depending on the gender of the character or the type. Spoiler function r_talk02 () Talk( 1, "Old granny: Hi! Lance." ) Talk( 1, "Old granny: Hi! Ami." ) Text( 1, "Leave", CloseTalk) If someone could give me a hand, I would really appreciate it. Quote ǤØĐ βŁ€ŞŞ ƤƗŘΔĆ¥ Share this post Link to post Share on other sites
Angelix 374 Report post Posted July 22, 2022 On 7/21/2022 at 12:47 PM, Masuka00 said: Greetings, I would like to know how to put an NPC that gives an initial greeting or starts a conversation depending on the gender of the character or the type. Hide contents function r_talk02 () Talk( 1, "Old granny: Hi! Lance." ) Talk( 1, "Old granny: Hi! Ami." ) Text( 1, "Leave", CloseTalk) If someone could give me a hand, I would really appreciate it. It’s not possible since you do not have the player’s role in the NPC function. If you’re using Corsairs file on the other hand, they created a system called “extNpc” which allows you to use the player’s role. Quote Share this post Link to post Share on other sites
V3ct0r 2,116 Report post Posted July 22, 2022 Hello @Masuka00, You can use the following example, but it covers only two cases: function px_FuncName() InitTrigger() TriggerCondition(1, CheckFunction) -- CheckFunction() is any function that returns LUA_TRUE or LUA_FALSE, accepts role, npc and other given parameters TriggerAction(1, JumpPage, 1) TriggerFailure(1, JumpPage, 2 ) Start(GetMultiTrigger(), 1) Talk( 1, "CheckFunction() returned LUA_TRUE" ) Talk( 2, "CheckFunction() returned LUA_FALSE" ) end Also look at transmittal() function from the file NpcScript02.lua. This code looks interesting: InitTrigger() TriggerCondition( 1, IsMapNpc, "garner", 96 ) TriggerAction( 1, JumpPage, 1 ) TriggerCondition( 2, IsMapNpc, "garner", 94 ) TriggerAction( 2, JumpPage, 2 ) TriggerCondition( 3, IsMapNpc, "garner", 95 ) TriggerAction( 3, JumpPage, 4 ) TriggerCondition( 4, IsMapNpc, "garner", 97 ) TriggerAction( 4, JumpPage, 5 ) TriggerCondition( 5, IsMapNpc, "garner", 55 ) TriggerAction( 5, JumpPage, 6 ) TriggerCondition( 6, IsMapNpc, "garner", 56 ) TriggerAction( 6, JumpPage, 3 ) TriggerCondition( 7, IsMapNpc, "magicsea", 50 ) TriggerAction( 7, JumpPage, 7 ) TriggerCondition( 8, IsMapNpc, "magicsea", 46 ) TriggerAction( 8, JumpPage, 8 ) TriggerCondition( 9, IsMapNpc, "darkblue", 56 ) TriggerAction( 9, JumpPage, 9 ) TriggerCondition( 10, IsMapNpc, "darkblue", 42 ) TriggerAction( 10, JumpPage, 10 ) TriggerCondition( 11, IsMapNpc, "darkblue", 46 ) TriggerAction( 11, JumpPage, 11 ) TriggerCondition( 12, IsMapNpc, "darkblue", 51 ) TriggerAction( 12, JumpPage, 12 ) Start( GetMultiTrigger(), 12 ) You can write your custom function that will check characters type: function CheckRace(role, race_id) local cha_race = GetChaTypeID(role) if cha_race == race_id then return LUA_TRUE end return LUA_FALSE end Don't forget add it in the file MissionSdk.lua: elseif conditions[i].func == CheckRace then PRINT( "ConditionsTest: CheckRace") local ret = CheckRace(character, conditions[i].p1) if ret ~= LUA_TRUE then PRINT( "ConditionsTest: CheckRace = false" ) return LUA_FALSE en Then try to write something like this: function npc_NotTested() InitTrigger() TriggerCondition(1, CheckRace, 1) TriggerAction(1, JumpPage, 1) TriggerCondition(2, CheckRace, 2) TriggerAction(2, JumpPage, 2) TriggerCondition(3, CheckRace, 3) TriggerAction(3, JumpPage, 3) TriggerCondition(4, CheckRace, 4) TriggerAction(4, JumpPage, 4) Start(GetMultiTrigger(), 4) Talk(1, "Lance") Talk(2, "Carsise") Talk(3, "Phyllis") Talk(4, "Ami") end 1 Quote Some useful links / Полезные ссылки Tips for making a topic in 'Questions & Help' / Рекомендации по созданию тем в разделе "Помощь" Server Advertising Section Rules / Правила раздела "Реклама серверов" Available e-mail domains for registration / Допустимые e-mail домены для регистрации User groups / Группы пользователей User ranks / Звания пользователей "Broken" pictures on the forum / "Битые" изображения на форуме Beware of scammers! / Осторожно, мошенники! My developments / Мои разработки Mods for client and server / Моды для клиента и сервера PKOdev.NET website for Tales of Pirates Server / PKOdev.NET веб-обвязка для сервера Пиратии I do not provide any help in private messages and outside the forum. Use 'Questions & Help' section please. Thank you for understanding! Я не оказываю какую-либо помощь в личных сообщениях и вне форума. Пожалуйста, используйте раздел "Пиратия: Помощь". Благодарю за понимание! Share this post Link to post Share on other sites
Angelix 374 Report post Posted July 23, 2022 @V3ct0r Yes, he can add a condition for each character, but if he wanted to create an NPC with 10 pages, then he can’t do that due to needing 40 pages in total and only having a limit of 32 I think? as for the transmittal function, that only check for npc ID. Quote Share this post Link to post Share on other sites
AlGhoul 66 Report post Posted July 23, 2022 6 hours ago, Angelix said: It’s not possible since you do not have the player’s role in the NPC function. 54 minutes ago, Angelix said: @V3ct0r Yes, he can add a condition for each character, but if he wanted to create an NPC with 10 pages, then he can’t do that due to needing 40 pages in total and only having a limit of 32 I think? as for the transmittal function, that only check for npc ID. Pages could be extended, it is just a matter of changing a var Quote Kind regards, AG. Share this post Link to post Share on other sites