[OTHIRE] bring me to to broken function at boats

Discussion in 'Support' started by Felipe93, Aug 9, 2018.

  1. Felipe93

    Felipe93 Ghost Member

    Joined:
    Mar 21, 2015
    Messages:
    942
    Likes Received:
    111
    Best Answers:
    2
    Hello otland

    i've added bring me to functions to boat npcs
    they works if i say for example:Hi, Venore, Yes it works
    buy when i say bring me to venore the npc doesn't reply
    and i get this error at my console exe
    PD:Im using OTHIRE 1.0


    Code (Text):
    1. Lua Script Error: [Npc interface]
    2. data/npc/scripts/barco_thais.lua:onCreatureSay
    3.  
    4. data/npc/scripts/barco_thais.lua:34: attempt to call method 'isFocused' (a nil value)
    5. stack traceback:
    6.         data/npc/scripts/barco_thais.lua:34: in function 'callback'
    7.         data/npc/scripts/lib/npcsystem/npchandler.lua:301: in function 'onCreatureSay'
    8.         data/npc/scripts/barco_thais.lua:11: in function <data/npc/scripts/barco_thais.lua:11>
    9.  
    10. Lua Script Error: [Npc interface]
    11. data/npc/scripts/barco_thais.lua:onCreatureSay
    12.  
    13. data/npc/scripts/barco_thais.lua:34: attempt to call method 'isFocused' (a nil value)
    14. stack traceback:
    15.         data/npc/scripts/barco_thais.lua:34: in function 'callback'
    16.         data/npc/scripts/lib/npcsystem/npchandler.lua:301: in function 'onCreatureSay'
    17.         data/npc/scripts/barco_thais.lua:11: in function <data/npc/scripts/barco_thais.lua:11>
    18.  
    THIS IS MY NPC .LUA
    Code (Lua):
    1. --------------------By Jpkulik!----------------------------
    2. local keywordHandler = KeywordHandler:new()
    3. local npcHandler = NpcHandler:new(keywordHandler)
    4. NpcSystem.parseParameters(npcHandler)
    5.  
    6.  
    7.  
    8. -- OTServ event handling functions start
    9. function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
    10. function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
    11. function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg) end
    12. -- Set the greeting message.
    13. npcHandler:setMessage(MESSAGE_GREET, HelloText)
    14. function onThink()                         npcHandler:onThink() end
    15. -- OTServ event handling functions end
    16. local function creatureSayCallback(cid, type, msg)
    17.    
    18.     local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    19.    
    20.     if (msgcontains(msg, 'bring') and msgcontains(msg, 'me') and msgcontains(msg, 'to') and msgcontains(msg, 'carlin') and (not npcHandler:isFocused(cid))) then
    21.         if doPlayerRemoveMoney(cid, 110) == TRUE then
    22.         doTeleportThing(cid,{x=32387, y=31820, z=7})
    23.         npcHandler:addFocus(cid)
    24.         else
    25.          selfSay('Sorry, you don\'t have enough money.')
    26.         end
    27.     elseif (msgcontains(msg, 'bring') and msgcontains(msg, 'me') and msgcontains(msg, 'to') and msgcontains(msg, 'ab\'dendriel') and (not npcHandler:isFocused(cid))) then
    28.         if doPlayerRemoveMoney(cid, 130) == TRUE then
    29.         doTeleportThing(cid,{x=32734, y=31669, z=7})
    30.         npcHandler:addFocus(cid)
    31.         else
    32.          selfSay('Sorry, you don\'t have enough money.')
    33.         end
    34.     elseif (msgcontains(msg, 'bring') and msgcontains(msg, 'me') and msgcontains(msg, 'to') and msgcontains(msg, 'venore') and (not npcHandler:isFocused(cid))) then
    35.         if doPlayerRemoveMoney(cid, 170) == TRUE then
    36.         doTeleportThing(cid,{x=32954, y=32022, z=7})
    37.         npcHandler:addFocus(cid)
    38.         else
    39.          selfSay('Sorry, you don\'t have enough money.')
    40.         end
    41.     elseif (msgcontains(msg, 'bring') and msgcontains(msg, 'me') and msgcontains(msg, 'to') and msgcontains(msg, 'edron') and (not npcHandler:isFocused(cid))) then
    42.         if doPlayerRemoveMoney(cid, 110) == TRUE then
    43.         doTeleportThing(cid,{x=33176, y=31767, z=7})
    44.         npcHandler:addFocus(cid)
    45.         else
    46.          selfSay('Sorry, you don\'t have enough money.')
    47.         end
    48.     elseif (msgcontains(msg, 'bring') and msgcontains(msg, 'me') and msgcontains(msg, 'to') and msgcontains(msg, 'port') and msgcontains(msg, 'hope') and (not npcHandler:isFocused(cid))) then
    49.     if isPremium(cid) == TRUE then
    50.         if doPlayerRemoveMoney(cid, 160) == TRUE then
    51.         doTeleportThing(cid,{x=32532, y=32784, z=7})
    52.         npcHandler:addFocus(cid)
    53.         else
    54.          selfSay('Sorry, you don\'t have enough money.')
    55.         end
    56.        end      
    57.     end
    58.     return true
    59. end    
    60. ---------------------------------------MENSAGES CONFIG--------------------------------------------
    61. local HelloText = 'Hello |PLAYERNAME|. Welcome to my Boat!'
    62. local HelpText = 'Do you need help?I can tell you some {destinations}.'
    63. local DestinationText = 'I can take you to {Carlin}, {Ab\'Dendriel}, {Venore}, {Edron} and {Darashia}.'          
    64. local CitysText = 'I can take you to {Carlin}, {Ab\'Dendriel}, {Kazordoon}, {Venore}, {Edron}, {Darashia}.'
    65. local JobText = 'Im an Captain, and this is my Boat.'                                                                
    66. ---------------------------------------END MENSAGES CONFIG----------------------------------------
    67.  
    68.  
    69.  
    70. ---------------------------------------CARLIN CONFIG----------------------------------------------
    71. local CarlinPosition = {x=32388, y=31821, z=7}              ----> Destination from Carlin Boat <----
    72. local CarlinCost = 110                          ----> Cost to Travel for Carlin    <----
    73. carlin = true                                            ---->TRUE:Working/FALSE:Not Working<----
    74. ---------------------------------------END CARLIN CONFIG------------------------------------------
    75.  
    76.  
    77.  
    78. ---------------------------------------AB'DENDRIEL CONFIG-----------------------------------------
    79. local AbDendrielPosition = {x=32734, y=31669, z=7}     ----> Destination from Ab\'Dendriel Boat <----
    80. local AbDendrielCost = 130                     ----> Cost to Travel for Ab\'Dendriel    <----
    81. AbDendriel = true                                 ----> TRUE:Working/FALSE:Not Working    <----
    82. ---------------------------------------END AB'DENDRIEL CONFIG-------------------------------------
    83.  
    84.  
    85.  
    86. ---------------------------------------VENORE CONFIG----------------------------------------------
    87. local VenorePosition = {x=32954, y=32022, z=7}              ----> Destination from Venore Boat <----
    88. local VenoreCost = 170                          ----> Cost to Travel for Venore    <----
    89. Venore = true                                          ----> TRUE:Working/FALSE:Not Working<---
    90. ---------------------------------------END VENORE CONFIG------------------------------------------
    91.  
    92.  
    93.  
    94. ---------------------------------------THAIS CONFIG-----------------------------------------------
    95. local ThaisPosition = {x=32313, y=32212, z=7}                ----> Destination from Thais Boat <----
    96. local ThaisCost = 110                           ----> Cost to Travel for Thais    <----
    97. Thais = true                                           ---->TRUE:Working/FALSE:Not Working<---
    98. ---------------------------------------END THAIS CONFIG-------------------------------------------
    99.  
    100.  
    101. ---------------------------------------EDRON CONFIG-----------------------------------------------
    102. local EdronPosition = {x=33176, y=31767, z=7}                ----> Destination from Edron Boat <----
    103. local EdronCost = 110                                          ----> Cost to Travel for Edron    <----
    104. Edron = true                                           ----> TRUE:Working/FALSE:Not Working<--
    105. ---------------------------------------END EDRON CONFIG-------------------------------------------
    106.  
    107.  
    108. ---------------------------------------DARASHIA CONFIG--------------------------------------------
    109. local DarashiaPosition = {x=33290, y=32481, z=7}          ----> Destination from Darashia Boat <----
    110. local DarashiaCost = 10
    111.  
    112.                     ----> Cost to Travel for Darashia    <----
    113. Darashia = false                                        ----> TRUE:Working/FALSE:Not Working <----
    114. ---------------------------------------END DARASHIA CONFIG----------------------------------------
    115.  
    116.  
    117. ---------------------------------------PORT HOPE CONFIG-------------------------------------------
    118. local PortHopePosition = {x=32532, y=32784, z=7}         ----> Destination from Port Hope Boat <----
    119. local PortHopeCost = 160                                      ----> Cost to Travel for Port Hope    <----
    120. PortHope = true                                     ----> TRUE:Working/FALSE:Not Working  <----
    121. ---------------------------------------END PORT HOPE CONFIG---------------------------------------
    122.  
    123. ---------------------------------------SVARGROND CONFIG-------------------------------------------
    124. local SvargrondPosition = {x=21478, y=21154, z=7}         ----> Destination from Svargrond <----
    125. local SvargrondHopeCost = 180                                      ----> Cost to Travel for Svargrond    <----
    126. Svargrond = true                                     ----> TRUE:Working/FALSE:Not Working  <----
    127. ---------------------------------------SVARGROND CONFIG---------------------------------------
    128.  
    129.  
    130. ---------------------------------------ANKRAHMUN CONFIG-------------------------------------------
    131. local AnkPosition = {x=33092, y=32884, z=7}              ----> Destination from Ankrahmun Boat <----
    132. local AnkCost = 150                                  ----> Cost to Travel for Ankrahmun    <----
    133. Ank = false                                       ----> TRUE:Working/FALSE:Not Working  <----
    134. ---------------------------------------END ANKRAHMUN CONFIG---------------------------------------
    135.  
    136.  
    137. ---CARLIN-----------------------------------------------------------------------------------------------------------------------------------------
    138. local CarlinText = 'Do you want to Travel to Carlin for 110 gold coins?'
    139. local CarlinTextNo = 'Ok, come back when you want then!'
    140. local NoTravel = 'Sorry, i do not travel to this city..'
    141. local CarlinLvl = 8
    142. local CarlinPremium = false --True/false
    143.  
    144. --Carlin--
    145. if carlin == true then
    146. local travelNode = keywordHandler:addKeyword({'carlin'},
    147. StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = CarlinText })
    148. travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = CarlinPremium, level = CarlinLvl, cost = CarlinCost, destination = CarlinPosition })
    149. travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = CarlinTextNo })
    150. else
    151. local travelNode = keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = NoTravel })
    152. end
    153. --End Carlin--
    154.  
    155.  
    156. ---------------------------------------------------------------------------------------------------------------------------------------------------
    157.  
    158.  
    159.  
    160. ---Venore-----------------------------------------------------------------------------------------------------------------------------------------
    161. local VenoreText = 'Do you want to Travel to Venore for 170 gold coins?'
    162. local VenoreTextNo = 'Ok, come back when you want then!'
    163. local NoTravel = 'Sorry, i do not travel to this city..'
    164. local VenoreLvl = 8
    165. local VenorePremium = false --True/false
    166.  
    167. --Venore--
    168. if Venore == true then
    169. local travelNode = keywordHandler:addKeyword({'venore'},
    170. StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = VenoreText })
    171. travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = VenorePremium, level = VenoreLvl, cost = VenoreCost, destination = VenorePosition })
    172. travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = VenoreTextNo })
    173. else
    174. local travelNode = keywordHandler:addKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = NoTravel })
    175. end
    176. --End Venore--
    177.  
    178.  
    179. ---------------------------------------------------------------------------------------------------------------------------------------------------
    180.  
    181.  
    182. ---Kazordoon-----------------------------------------------------------------------------------------------------------------------------------------
    183. local KazordoonText = 'Do you want to Travel to Kazordoon for 10 gold coins?'
    184. local KazordoonTextNo = 'Ok, come back when you want then!'
    185. local NoTravel = 'Sorry, i do not travel to this city..'
    186. local KazordoonLvl = 8
    187. local KazordoonPremium = false --True/false
    188.  
    189. --Kazordoon--
    190. if Kazordoon == true then
    191. local travelNode = keywordHandler:addKeyword({'kazordoon'},
    192. StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = KazordoonText })
    193. travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = KazordoonPremium, level = KazordoonLvl, cost = KazordoonCost, destination = KazordoonPosition })
    194. travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = KazordoonTextNo })
    195. else
    196. local travelNode = keywordHandler:addKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = NoTravel })
    197. end
    198. --End Venore--
    199.  
    200.  
    201. ---------------------------------------------------------------------------------------------------------------------------------------------------
    202.  
    203.  
    204. ---Thais-----------------------------------------------------------------------------------------------------------------------------------------
    205. local ThaisText = 'Do you want to Travel to Thais for 110 gold coins?'
    206. local ThaisTextNo = 'Ok, come back when you want then!'
    207. local NoTravel = 'Sorry, i do not travel to this city..'
    208. local ThaisLvl = 8
    209. local ThaisPremium = false --True/false
    210.  
    211. --Thais--
    212. if Thais == true then
    213. local travelNode = keywordHandler:addKeyword({'thais'},
    214. StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = ThaisText })
    215. travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = ThaisPremium, level = ThaisLvl, cost = ThaisCost, destination = ThaisPosition })
    216. travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = ThaisTextNo })
    217. else
    218. local travelNode = keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = NoTravel })
    219. end
    220. --End Thais--
    221.  
    222.  
    223. ---------------------------------------------------------------------------------------------------------------------------------------------------
    224.  
    225.  
    226. ---AbDendriel-----------------------------------------------------------------------------------------------------------------------------------------
    227. local AbDendrielText = 'Do you want to Travel to Ab\'Dendriel for 130 gold coins?'
    228. local AbDendrielTextNo = 'Ok, come back when you want then!'
    229. local NoTravel = 'Sorry, i do not travel to this city..'
    230. local AbDendrielLvl = 8
    231. local AbDendrielPremium = false --True/false
    232.  
    233. --AbDendriel--
    234. if AbDendriel == true then
    235. local travelNode = keywordHandler:addKeyword({'ab\'dendriel'},
    236. StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = AbDendrielText })
    237. travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = AbDendrielPremium, level = AbDendrielLvl, cost = AbDendrielCost, destination = AbDendrielPosition })
    238. travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = AbDendrielTextNo })
    239. else
    240. local travelNode = keywordHandler:addKeyword({'ab\'dendriel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = NoTravel })
    241. end
    242. --End AbDendriel--
    243.  
    244.  
    245. ---------------------------------------------------------------------------------------------------------------------------------------------------
    246.  
    247.  
    248. ---Edron-----------------------------------------------------------------------------------------------------------------------------------------
    249. local EdronText = 'Do you want to Travel to Edron for 110 gold coins?'
    250. local EdronTextNo = 'Ok, come back when you want then!'
    251. local NoTravel = 'Sorry, i do not travel to this city..'
    252. local EdronLvl = 8
    253. local EdronPremium = false --True/false
    254.  
    255. --Edron--
    256. if Edron == true then
    257. local travelNode = keywordHandler:addKeyword({'edron'},
    258. StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = EdronText })
    259. travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = EdronPremium, level = EdronLvl, cost = EdronCost, destination = EdronPosition })
    260. travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = EdronTextNo })
    261. else
    262. local travelNode = keywordHandler:addKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = NoTravel })
    263. end
    264. --End AbDendriel--
    265.  
    266.  
    267. ---------------------------------------------------------------------------------------------------------------------------------------------------
    268.  
    269.  
    270. ---Darashia-----------------------------------------------------------------------------------------------------------------------------------------
    271. local DarashiaText = 'Do you want to Travel to Darashia for 60 gold coins?'
    272. local DarashiaTextNo = 'Ok, come back when you want then!'
    273. local NoTravel = 'Sorry, i do not travel to this city..'
    274. local DarashiaLvl = 8
    275. local DarashiaPremium = false --True/false
    276.  
    277. --Darashia--
    278. if Darashia == true then
    279. local travelNode = keywordHandler:addKeyword({'darashia'},
    280. StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = DarashiaText })
    281. travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = DarashiaPremium, level = DarashiaLvl, cost = DarashiaCost, destination = DarashiaPosition })
    282. travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = DarashiaTextNo })
    283. else
    284. local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = NoTravel })
    285. end
    286. --End Darashia--
    287.  
    288.  
    289. ---------------------------------------------------------------------------------------------------------------------------------------------------
    290.  
    291.  
    292. ---Port Hope-----------------------------------------------------------------------------------------------------------------------------------------
    293. local PortHopeText = 'Do you want to Travel to Port Hope for 160 gold coins?'
    294. local PortHopeTextNo = 'Ok, come back when you want then!'
    295. local NoTravel = 'Sorry, i do not travel to this city..'
    296. local PortHopeLvl = 8
    297. local PortHopePremium = false --True/false
    298.  
    299. --Port Hope--
    300. if PortHope == true then
    301. local travelNode = keywordHandler:addKeyword({'port hope'},
    302. StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = PortHopeText })
    303. travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = PortHopePremium, level = PortHopeLvl, cost = PortHopeCost, destination = PortHopePosition })
    304. travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = PortHopeTextNo })
    305. else
    306. local travelNode = keywordHandler:addKeyword({'port hope'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = NoTravel })
    307. end
    308. --End Port Hope--
    309.  
    310.  
    311. ---------------------------------------------------------------------------------------------------------------------------------------------------
    312.  
    313.  
    314. ---Liberty Bay-----------------------------------------------------------------------------------------------------------------------------------------
    315. local LibertyBayText = 'Do you want to Travel to Liberty Bay for 10 gold coins?'
    316. local LibertyBayTextNo = 'Ok, come back when you want then!'
    317. local NoTravel = 'Sorry, i do not travel to this city..'
    318. local LibertyBayLvl = 8
    319. local LibertyBayPremium = false --True/false
    320.  
    321. --Liberty Bay--
    322. if LibertyBay == true then
    323. local travelNode = keywordHandler:addKeyword({'liberty bay'},
    324. StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = LibertyBayText })
    325. travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = LibertyBayPremium, level = LibertyBayLvl, cost = LibertyBayCost, destination = LibertyBayPosition })
    326. travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = LibertyBayTextNo })
    327. else
    328. local travelNode = keywordHandler:addKeyword({'liberty bay'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = NoTravel })
    329. end
    330. --End Liberty Bay--
    331.  
    332.  
    333. ---------------------------------------------------------------------------------------------------------------------------------------------------
    334.  
    335.  
    336. ---Ankrahmun-----------------------------------------------------------------------------------------------------------------------------------------
    337. local AnkText = 'Do you want to Travel to Ankrahmun for 10 gold coins?'
    338. local AnkTextNo = 'Ok, come back when you want then!'
    339. local NoTravel = 'Sorry, i do not travel to this city..'
    340. local AnkLvl = 8
    341. local AnkPremium = false --True/false
    342.  
    343. --Ankrahmun--
    344. if Ank == true then
    345. local travelNode = keywordHandler:addKeyword({'ankrahmun'},
    346. StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = AnkText })
    347. travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = AnkPremium, level = AnkLvl, cost = AnkCost, destination = AnkPosition })
    348. travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = AnkTextNo })
    349. else
    350. local travelNode = keywordHandler:addKeyword({'ankrahmun'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = NoTravel })
    351. end
    352. --End Ankrahmun--
    353.  
    354.  
    355. ---------------------------------------------------------------------------------------------------------------------------------------------------
    356.  
    357.  
    358. ---Svargrond-----------------------------------------------------------------------------------------------------------------------------------------
    359. local SvargrondText = 'Do you want to Travel to Svargrond for 180 gold coins?'
    360. local SvargrondTextNo = 'Ok, come back when you want then!'
    361. local NoTravel = 'Sorry, i do not travel to this city..'
    362. local SvargrondCost = 180
    363. local SvargrondPremium = true --True/false
    364.  
    365. --Svargrond--
    366. if Svargrond == true then
    367. local travelNode = keywordHandler:addKeyword({'svargrond'},
    368. StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = SvargrondText })
    369. travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = SvargrondPremium, level = SvargrondLvl, cost = SvargrondCost, destination = SvargrondPosition })
    370. travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = SvargrondTextNo })
    371. else
    372. local travelNode = keywordHandler:addKeyword({'svargrond'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = NoTravel })
    373. end
    374. --End AbDendriel--
    375.  
    376.  
    377. ---------------------------------------------------------------------------------------------------------------------------------------------------
    378.  
    379.  
    380. keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = DestinationText })
    381. keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = JobText })
    382. keywordHandler:addKeyword({'citys'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = CityText })
    383. keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = HelpText })
    384.  
    385. -- Makes sure the npc reacts when you say hi, bye etc.
    386. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    387. npcHandler:addModule(FocusModule:new())
    388.  
    389.  
     
    CipsoftStinks likes this.
  2. Okke

    Okke Voidcore 7.4

    Joined:
    Jul 19, 2015
    Messages:
    866
    Likes Received:
    452
    Best Answers:
    16
    It's not broken, in order to make it work the npc must be busy first.
     
    StreamSide likes this.
  3. ond

    ond Well-Known Member

    Joined:
    Mar 24, 2008
    Messages:
    2,587
    Likes Received:
    363
    Best Answers:
    12
    isFocused isn't in othire, maybe something like this:

    Code (Lua):
    1. local keywordHandler = KeywordHandler:new()
    2. local npcHandler = NpcHandler:new(keywordHandler)
    3. NpcSystem.parseParameters(npcHandler)
    4.  
    5. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
    6. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
    7. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
    8. function onThink() npcHandler:onThink() end
    9.  
    10. local topic
    11.  
    12. function onPlayerGreet(cid)
    13.     npcHandler:setMessage(MESSAGE_GREET, "a^2 + b^2 = c^2")
    14.     topic = 0
    15.     return true
    16. end
    17.  
    18. npcHandler:setCallback(CALLBACK_GREET, onPlayerGreet)
    19. npcHandler:setMessage(MESSAGE_PLACEDINQUEUE, "????????")
    20. npcHandler:setMessage(MESSAGE_WALKAWAY, "Stick")
    21. npcHandler:setMessage(MESSAGE_FAREWELL, "Kamma dig")
    22.  
    23. local bord = {
    24.     {destination = "Thais", pos = {x=100, y=100, z=7}, price = 100},
    25.     {destination = "Carlin", pos = {x=101, y=101, z=7}, price = 101},
    26. }
    27.  
    28. function creatureSayCallback(cid, type, msg)
    29.  
    30.     if npcHandler.focus ~= cid then
    31.         for _, v in ipairs(bord) do
    32.             if msgcontains(msg, v.destination) and doPlayerRemoveMoney(cid, v.price) then
    33.                 doTeleportThing(cid, v.pos)
    34.             end
    35.         end
    36.         return false
    37.     end
    38.    
    39.     local t
    40.  
    41.     if msgcontains(msg, "talk") and msgcontains(msg, "to") and msgcontains(msg, "me") then
    42.         npcHandler:say("What do you want me to say, huh?")
    43.         t = 1
    44.     elseif topic == 1 then
    45.         if msgcontains(msg, "anything") then
    46.             npcHandler:say("Only a truly free mason can run the world.")
    47.             t = 2
    48.         else
    49.             npcHandler:say("Stick")
    50.             npcHandler:releaseFocus()
    51.         end
    52.     elseif topic == 2 then
    53.         if msgcontains(msg, "lier lier pants on fire") then
    54.             npcHandler:say("<gets angry>")
    55.             npcHandler:releaseFocus()
    56.         else
    57.             npcHandler:say("Wrong keywords!")
    58.             t = 3
    59.         end
    60.     elseif topic == 3 then
    61.         if msgcontains(msg, "no it isn't") then
    62.             npcHandler:say("Hunted.")
    63.             npcHandler:releaseFocus()
    64.         else
    65.             npcHandler:say("Oh sometimes I get a good feeling, yeah.")
    66.         end
    67.     end
    68.    
    69.     topic = t
    70.     return true
    71. end
    72.  
    73. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    74. npcHandler:addModule(FocusModule:new())
     
    Felipe93 likes this.
  4. Felipe93

    Felipe93 Ghost Member

    Joined:
    Mar 21, 2015
    Messages:
    942
    Likes Received:
    111
    Best Answers:
    2
    Thanks @ond i'll try that script tomorrow
    Btw i should change isfocused function by which one? I'm on my cellphone ATM so i can't check it properly i Asks this by if can avoid re-do or use other script
     
    Last edited: Aug 10, 2018 at 1:22 AM
    CipsoftStinks likes this.
  5. Felipe93

    Felipe93 Ghost Member

    Joined:
    Mar 21, 2015
    Messages:
    942
    Likes Received:
    111
    Best Answers:
    2
    Yea but it shouldn't he given errors neither at otx this does not occurs,and i tester it in ine way you said it doesnt work either
     
    Last edited: Aug 9, 2018
    CipsoftStinks likes this.
  6. Felipe93

    Felipe93 Ghost Member

    Joined:
    Mar 21, 2015
    Messages:
    942
    Likes Received:
    111
    Best Answers:
    2
    .
     
    CipsoftStinks likes this.
  7. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,905
    Likes Received:
    637
    Best Answers:
    14
    sick way, thanks for that :)
     
  8. Felipe93

    Felipe93 Ghost Member

    Joined:
    Mar 21, 2015
    Messages:
    942
    Likes Received:
    111
    Best Answers:
    2
    Where should i look by isfosuced function to add it on source example where should i look at at tfs 0.4 to implement it on othire?
    I don't have the option "find on all files of this proyect" at msvc 2010 like in devcpp
    @ond or do you have a software to do this? I use winmerge to compare but not a software to find declarations or definitions or Even the code itself
     
    CipsoftStinks likes this.
  9. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,905
    Likes Received:
    637
    Best Answers:
    14
    lmao he actually told you the solution but its too hard to read imo
     
  10. Felipe93

    Felipe93 Ghost Member

    Joined:
    Mar 21, 2015
    Messages:
    942
    Likes Received:
    111
    Best Answers:
    2
    I'm srry to tell you this but read my latest post. It's easy to use that script
    Im asking how or where should i look to implement the function into source. So i'll be updating my source not the Lua files :s
    Wasnt that because you were looking my otx \ othire sources instead of the main ones?? Lool
    Regards
     
    Last edited: Aug 10, 2018 at 2:05 AM
    CipsoftStinks likes this.
  11. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,905
    Likes Received:
    637
    Best Answers:
    14
    You actually do not understand anything. Also I dont know what you talking about your otx/whatever shit so go kys.
    He writed the solution and if you cant understand that its because you cant add that script or edit it to make it work. Maybe both.
    Thats sad because I was trying to help you last night and you just take the working one thing and ask for another.
     
  12. Felipe93

    Felipe93 Ghost Member

    Joined:
    Mar 21, 2015
    Messages:
    942
    Likes Received:
    111
    Best Answers:
    2
    Sure.
    I'm talking about this because you menthioned that in our conversation Even more you suggested it in our pm talk(im ásking you this because you may have custom src editions on your src)
    So don't behave this way now pls...
    Don't make me post it,dont try to make me look as a fool talking related to the above post.,.
    You pmed yo my both accs searching the same thing
    GTFOH :)
     
    Last edited: Aug 10, 2018 at 2:43 AM
  13. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,905
    Likes Received:
    637
    Best Answers:
    14
    I think it was totally my fault when I tried to help you, enjoy both things I made.
     
    Last edited: Aug 10, 2018 at 2:51 AM
  14. Felipe93

    Felipe93 Ghost Member

    Joined:
    Mar 21, 2015
    Messages:
    942
    Likes Received:
    111
    Best Answers:
    2
    Ok
     
    CipsoftStinks likes this.
  15. ond

    ond Well-Known Member

    Joined:
    Mar 24, 2008
    Messages:
    2,587
    Likes Received:
    363
    Best Answers:
    12
    Edit: Nvm, try THIS instead. Been a long time.

    Code (Lua):
    1. local keywordHandler = KeywordHandler:new()
    2. local npcHandler = NpcHandler:new(keywordHandler)
    3. NpcSystem.parseParameters(npcHandler)
    4. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
    5. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
    6. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
    7. function onThink() npcHandler:onThink() end
    8.  
    9. -- initial variables
    10. local topic, cost, pos
    11.  
    12. function onPlayerGreet(cid)
    13.     npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|. Welcome to my Boat!")
    14.     topic, cost, pos = 0, 0, nil
    15.     return true
    16. end
    17.  
    18. npcHandler:setCallback(CALLBACK_GREET, onPlayerGreet)
    19. npcHandler:setMessage(MESSAGE_PLACEDINQUEUE, "Sorry |PLAYERNAME|, I am busy.")
    20. npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")
    21. npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye.")
    22.  
    23. function creatureSayCallback(cid, type, msg)
    24.  
    25.     -- table with information about posistions, price, destination name
    26.     local bord = {
    27.         [1] = {pos = {x=32387, y=31820, z=7}, cost = 110, destination = "Carlin"},
    28.         [2] = {pos = {x=32734, y=31669, z=7}, cost = 130, destination = "Ab'Dendriel"},
    29.         [3] = {pos = {x=32954, y=32022, z=7}, cost = 170, destination = "Venore"},
    30.         [4] = {pos = {x=33176, y=31767, z=7}, cost = 110, destination = "Edron"},
    31.         [5] = {pos = {x=32532, y=32784, z=7}, cost = 160, destination = "Port Hope"},
    32.     }
    33.    
    34.     local postman = getPlayerStorageValue(cid, 250) >= 2
    35.     msg = msg:lower()
    36.    
    37.     -- Fast travel
    38.     if npcHandler.focus ~= cid then
    39.         for _, v in ipairs(bord) do
    40.             if msgcontains(msg, v.destination) then
    41.                 v.cost = postman and v.cost - 10 or v.cost
    42.                 if doPlayerRemoveMoney(cid, v.cost) then
    43.                     if isPremium(cid) then
    44.                         doTeleportThing(cid, v.pos)
    45.                     else
    46.                         npcHandler:say("Only premium players are allowed to travel by boat.")
    47.                     end
    48.                 else
    49.                     npcHandler:say("Sorry, you don't have enough money.")
    50.                 end
    51.             end
    52.         end
    53.         return false
    54.     end
    55.  
    56.     -- Variables
    57.     local t, c, p
    58.    
    59.     for _, v in ipairs(bord) do
    60.         if msgcontains(msg, v.destination) then
    61.             v.cost = postman and v.cost - 10 or v.cost
    62.             npcHandler:say("Would you like to travel to " .. v.destination .. " for " .. v.cost .. " gold?")
    63.             t, c, p = 1, v.cost, v.pos
    64.         end  
    65.     end
    66.  
    67.     -- Confirm travel
    68.     if topic == 1 then
    69.         if msgcontains(msg, "yes") then
    70.             if doPlayerRemoveMoney(cid, cost) then
    71.                 if isPremium(cid) then
    72.                     npcHandler:say("Hold on!")
    73.                     doTeleportThing(cid, pos)
    74.                 else
    75.                     npcHandler:say("Sorry, only premium players are allowed to travel by boat.")
    76.                 end
    77.             else
    78.                 npcHandler:say("You don't have enough money.")
    79.             end
    80.         else
    81.             npcHandler:say("Fine with me.")
    82.         end
    83.    
    84.     -- Other keywords
    85.     elseif msgcontains(msg, "job") then
    86.         npcHandler:say("I am the captain now.")
    87.     elseif msgcontains(msg, "name") then
    88.         npcHandler:say("My name is " .. getCreatureName(getNpcCid()) .. ".")
    89.     end  
    90.        
    91.     -- Below is used so you don't have to put "topic = 0, cost = 0" after each keyword  
    92.     topic, cost, pos = t, c, p
    93.     return true
    94. end
    95. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    96. npcHandler:addModule(FocusModule:new())
    97.  
     
    Last edited: Aug 10, 2018 at 1:39 PM
    Felipe93 likes this.
  16. Felipe93

    Felipe93 Ghost Member

    Joined:
    Mar 21, 2015
    Messages:
    942
    Likes Received:
    111
    Best Answers:
    2
    amazing thanks by share this with me / us :) i liked alot the postman option at the code :*
    i gonna check it now
     
    Last edited: Aug 11, 2018 at 3:57 AM
    CipsoftStinks likes this.

Share This Page

Loading...