Advertisement
Terrah

nwnx_events

Sep 13th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.62 KB | None | 0 0
  1. //void main(){}
  2.  
  3. /*INI SNIPPET:
  4.  
  5. Corresponds to which event to fire for which event, if empty string they are disabled and never hooked
  6.  
  7. [EVENTS]
  8. log=1
  9. Spellcast="nwnx_ev_spell"
  10. Itemuse="nwnx_ev_item"
  11. Featuse="nwnx_ev_feat"
  12. Skilluse="nwnx_ev_skills"
  13. Polymorph="nwnx_ev_poly"
  14. Unpolymorph="nwnx_ev_poly"
  15. Attack="nwnx_ev_attack"
  16. Togglemode="nwnx_ev_toggle"
  17. Devcrit="nwnx_ev_dev"
  18. Downloadpc="nwnx_ev_dlpc"
  19. Examine="nwnx_ev_examine"
  20.  
  21. */
  22.  
  23. //Return data related to the events (type: index: data)
  24. //Spellcast: 0 spellID, 1 metamagic, 2, class index
  25. //Itemuse: 0 item spell index, rest unknown
  26. //Featuse: 0 feat used, rest unknown
  27. //Skilluse: 0 skill used, rest unknown
  28. //Polymorph: 0 polymorph type, 1 casterlevel, 2 duration type
  29. //Unpolymorph: 0 polymorph type, 1 casterlevel, 2 duration type
  30. //Attack: 0-2 unknown
  31. //Togglemode: 0 mode being toggled
  32. //Devcrit: 0 baseitem type (BASE_ITEM_INVALID if invalid)
  33. //Downloadpc: not used
  34. //Examine: 0 something about traps
  35. int EVENTS_GetData( int nIndex );
  36.  
  37. //Returns the event thats occuring
  38. //0: Spellcast
  39. //1: Item use
  40. //2: Feat use
  41. //3: Skill use
  42. //4: Polymorph
  43. //5: Unpolymorph
  44. //6: Attack
  45. //7: Togglemode
  46. //8: Devcrit
  47. //9: Downloadpc
  48. //10: Examine
  49. int EVENTS_GetEvent( );
  50.  
  51. //Get the target location (if any)(type: index: data)
  52. //Spellcast: 0 spell target location
  53. //Itemuse: 0 item target location
  54. //Featuse: 0 feat target location
  55. //Skilluse: 0 skill target location
  56. //Polymorph: not used
  57. //Unpolymorph: not used
  58. //Attack: not used
  59. //Togglemode: not used
  60. //Devcrit: not used
  61. //Downloadpc: not used
  62. //Examine: not used
  63. location EVENTS_GetTargetLocation( int nIndex );
  64.  
  65. //Get string from the event (if any)
  66. //Spellcast: not used
  67. //Itemuse: not used
  68. //Featuse: not used
  69. //Skilluse: not used
  70. //Polymorph: not used
  71. //Unpolymorph: not used
  72. //Attack: not used
  73. //Togglemode: not used
  74. //Devcrit: not used
  75. //Downloadpc: not used
  76. //Examine: not used
  77. string EVENTS_GetString( int nIndex );
  78.  
  79. //Get the target from the event (if any)(type: index: data)
  80. //Spellcast: 0 spell-target
  81. //Itemuse: 0 the item, 1 the item target
  82. //Featuse: 0 feat target, 1 area used in
  83. //Skilluse: 0 feat target, 1 area used in
  84. //Polymorph: 0 polymorph effect creator
  85. //Unpolymorph: 0 polymorph effect creator
  86. //Attack: 0 attack target
  87. //Togglemode: not used
  88. //Devcrit: 0 item used, 1 attack target
  89. //Downloadpc: not used
  90. //Examine: 0 object getting examined
  91. object EVENTS_GetTarget( int nIndex );
  92.  
  93. //Flags the game to bypass the event, returning nReturn to it
  94. //Devcrit should pass 1 if standard devcrit is desired, 0 otherwise
  95. //All others should be either 0 or 1
  96. void EVENTS_Bypass( int nReturn=1 );
  97.  
  98. void EVENTS_Bypass( int nReturn=1 ){
  99.  
  100.     SetLocalString( OBJECT_SELF, "NWNX!EVENTS!4", IntToString( nReturn ) );
  101.     DeleteLocalString( OBJECT_SELF, "NWNX!EVENTS!4" );
  102. }
  103.  
  104. object EVENTS_GetTarget( int nIndex ){
  105.  
  106.     return GetLocalObject( OBJECT_SELF, "NWNX!EVENTS!"+IntToString( nIndex ) );
  107. }
  108.  
  109. int EVENTS_GetEvent( ){
  110.  
  111.     SetLocalString( OBJECT_SELF, "NWNX!EVENTS!0", ".........." );
  112.     int nRet = StringToInt( GetLocalString( OBJECT_SELF, "NWNX!EVENTS!0" ) );
  113.     DeleteLocalString( OBJECT_SELF, "NWNX!EVENTS!0" );
  114.     return nRet;
  115. }
  116.  
  117. int EVENTS_GetData( int nIndex ){
  118.  
  119.     SetLocalString( OBJECT_SELF, "NWNX!EVENTS!1", IntToString( nIndex )+".........." );
  120.     int nRet = StringToInt( GetLocalString( OBJECT_SELF, "NWNX!EVENTS!1" ) );
  121.     DeleteLocalString( OBJECT_SELF, "NWNX!EVENTS!1" );
  122.     return nRet;
  123. }
  124.  
  125. location EVENTS_GetTargetLocation( int nIndex ){
  126.  
  127.     SetLocalString( OBJECT_SELF, "NWNX!EVENTS!2", IntToString( nIndex )+"                                                                                                          " );
  128.     string sRet = GetLocalString( OBJECT_SELF, "NWNX!EVENTS!2" );
  129.     DeleteLocalString( OBJECT_SELF, "NWNX!EVENTS!2" );
  130.  
  131.     vector V;
  132.     int nFirst  = FindSubString( sRet, "|" );
  133.     int nSecond = FindSubString( sRet, "|", nFirst+1 );
  134.     int nLen = GetStringLength( sRet );
  135.  
  136.     V.x = StringToFloat( GetStringLeft( sRet, nFirst ) );
  137.     V.y = StringToFloat( GetSubString( sRet, nFirst+1, nLen-nSecond ) );
  138.     V.z = StringToFloat( GetStringRight( sRet, nLen-nSecond-1 ) );
  139.  
  140.     return Location( GetArea( OBJECT_SELF ), V, GetFacing( OBJECT_SELF ) );
  141. }
  142.  
  143. string EVENTS_GetString( int nIndex ){
  144.  
  145.     SetLocalString( OBJECT_SELF, "NWNX!EVENTS!3", IntToString( nIndex )+"                                                                                                          " );
  146.     string sRet = GetLocalString( OBJECT_SELF, "NWNX!EVENTS!3" );
  147.     DeleteLocalString( OBJECT_SELF, "NWNX!EVENTS!3" );
  148.     return sRet;
  149. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement