code_junkie

Game Logic in XML Files

Nov 13th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. <dialogue id="101" condition="!npc.carsFixed">
  2. <message>Man, fix my car!</message>
  3. <choices>
  4. <choice condition="hero.carFixingSkill > 5" priority="7" id="Sure!">
  5. <command>hero.carFixingSkills += 1</command>
  6. <command>npc.carFixed = true</command>
  7. <command>hero.playSmokeAnimation()</command>
  8. <command>nextDialogue = 104</command>
  9. </choice>
  10. <choice condition="hero.carFixingSkill <= 5" id="I can't...">
  11. <command>nextDialogue = 105</command>
  12. </choice>
  13. <choice id="Fix it yourself">
  14. <command>npc.likesHero -= 1</command>
  15. </choice>
  16. </choices>
  17. </dialogue>
  18.  
  19. def dialogue101
  20. if !npc.carsFixed
  21. showMessage("Man, fix my car!")
  22. choices = []
  23. if hero.carFixingSkill > 5
  24. choices.push(Choice.new("Sure!", 7))
  25. else
  26. choices.push(Choice.new("I can't"))
  27. end
  28. choices.push(Choice.new("Fix it yourself"))
  29. choices = selectTopPriority(choices) if choices.size > 4
  30. result = showChoices(choices)
  31. case result
  32. when "Sure"
  33. hero.carFixingSkills += 1
  34. npc.carFixed = true
  35. hero.playSmokeAnimation
  36. dialogue104
  37. when "I can't"
  38. dialogue105
  39. when "Fix it yourself"
  40. npc.likesHero -= 1
  41. end
  42. end
  43. end
  44.  
  45. <category>
  46. <pattern>WHAT ARE YOU</pattern>
  47. <template>
  48. <think><set name="topic">Me</set></think>
  49. I am the latest result in artificial intelligence,
  50. which can reproduce the capabilities of the human brain
  51. with greater speed and accuracy.
  52. </template>
Add Comment
Please, Sign In to add comment