Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. boontaHeraConvoHandler = Object:new {
  2. }
  3. function boontaHeraConvoHandler:getNextConversationScreen(conversationTemplate, conversingPlayer, selectedOption)
  4. -- Assign the player to variable creature for use inside this function.
  5. local creature = LuaCreatureObject(conversingPlayer)
  6. -- Get the last conversation to determine whetehr or not we're on the first screen
  7. local convosession = creature:getConversationSession()
  8. lastConversation = nil
  9. local conversation = LuaConversationTemplate(conversationTemplate)
  10. local nextConversationScreen
  11.  
  12.  
  13. -- If there is a conversation open, do stuff with it
  14. if ( conversation ~= nil ) then
  15. -- check to see if we have a next screen
  16. if ( convosession ~= nil ) then
  17. local session = LuaConversationSession(convosession)
  18. if ( session ~= nil ) then
  19. lastConversationScreen = session:getLastConversationScreen()
  20. end
  21. end
  22. -- Last conversation was nil, so get the first screen
  23. if ( lastConversationScreen == nil ) then
  24. nextConversationScreen = conversation:getScreen("first_screen")
  25. else
  26. -- Start playing the rest of the conversation based on user input
  27. local luaLastConversationScreen = LuaConversationScreen(lastConversationScreen)
  28.  
  29. -- Set variable to track what option the player picked and get the option picked
  30. local optionLink = luaLastConversationScreen:getOptionLink(selectedOption)
  31. nextConversationScreen = conversation:getScreen(optionLink)
  32.  
  33. end
  34. end
  35. -- end of the conversation logic.
  36. return nextConversationScreen
  37. end
  38.  
  39. function boontaHeraConvoHandler:runScreenHandlers(conversationTemplate, conversingPlayer, conversingNPC, selectedOption, conversationScreen)
  40. -- Plays the screens of the conversation.
  41. local player = LuaSceneObject(conversingPlayer)
  42. local screen = LuaConversationScreen(conversationScreen)
  43. local screenID = screen:getScreenID()
  44. local pConvScreen = screen:cloneScreen()
  45. local clonedConversation = LuaConversationScreen(pConvScreen)
  46. local playerFaction = self:getFactionFromHashCode(CreatureObject(conversingPlayer):getFaction())
  47. end
  48. return pConvScreen
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement