1. #include "log_h"
  2. #include "utility_h"
  3. #include "wrappers_h"
  4. #include "plot_h"
  5.  
  6. #include "plt_rtb_plot1"
  7. #include "rtb_script_constants"
  8.  
  9.  
  10. int StartingConditional()
  11. {
  12. event eParms = GetCurrentEvent(); // Contains all input parameters
  13. int nType = GetEventType(eParms); // GET or SET call
  14. string strPlot = GetEventString(eParms, 0); // Plot GUID
  15. int nFlag = GetEventInteger(eParms, 1); // The bit flag # being affected
  16. object oParty = GetEventCreator(eParms); // The owner of the plot table for this script
  17. object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any
  18. int nResult = FALSE; // used to return value for DEFINED GET events
  19. object oPC = GetHero();
  20.  
  21. plot_GlobalPlotHandler(eParms); // any global plot operations, including debug info
  22.  
  23. if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only
  24. {
  25. int nValue = GetEventInteger(eParms, 2); // On SET call, the value about to be written (on a normal SET that should be '1', and on a 'clear' it should be '0')
  26. int nOldValue = GetEventInteger(eParms, 3); // On SET call, the current flag value (can be either 1 or 0 regardless if it's a set or clear event)
  27. // IMPORTANT: The flag value on a SET event is set only AFTER this script finishes running!
  28.  
  29. switch(nFlag)
  30. {
  31.  
  32. case KEY_INPOSSESSION:
  33. {
  34. UT_AddItemToInventory(THE_KEY);
  35. CS_LoadCutscene(R"name_of_your_cutscene.cut");
  36. break;
  37. }
  38.  
  39. case KEY_RETURNED:
  40. {
  41. UT_RemoveItemFromInventory(THE_KEY);
  42.  
  43. /* Once the sword quest is done we want to open up a new area on the map for the player.
  44.   object oMapPinRoad = GetObjectByTag(DEMO_ROAD_MAP_PIN);
  45.   WR_SetWorldMapLocationStatus(oMapPinRoad, WM_LOCATION_ACTIVE); */
  46.  
  47. break;
  48. }
  49.  
  50. }
  51. }
  52. else // EVENT_TYPE_GET_PLOT -> defined conditions only
  53. {
  54.  
  55. switch(nFlag)
  56. {
  57. case DECLINED_QUEST:
  58. {
  59. //This is a "defined" plot flag. When the plot is checked
  60. //to see whether the flag is true or false, its status is
  61. //determined using the following code.
  62. if (
  63. WR_GetPlotFlag(PLT_RTB_PLOT1, SPOKEN_FATHER) &&
  64. !WR_GetPlotFlag(PLT_RTB_PLOT1, QUEST_ACCEPTED)
  65. )
  66. {
  67. return TRUE;
  68. } else
  69. {
  70. return FALSE;
  71. }
  72. }
  73. }
  74.  
  75. }
  76.  
  77. plot_OutputDefinedFlag(eParms, nResult);
  78.  
  79. return nResult;
  80.  
  81. }