Advertisement
Terrah

nwnx_effects

Sep 13th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.39 KB | None | 0 0
  1. //void main( ){}
  2.  
  3. //Set spell ID on eEffect and return new effect
  4. effect SetEffectSpellID( effect eEffect, int nSpellID );
  5.  
  6. //Set a script that is to be fired when eEffect expires
  7. //Use GetLastEffect( ) inside the effect script to get the effect
  8. //Object_self is the effect owner
  9. effect SetEffectScript( effect eEffect, string sEffectScript );
  10.  
  11. //Set the CL for eEffect
  12. effect SetEffectCasterLevel( effect eEffect, int nCL );
  13.  
  14. //Get the unique effect ID
  15. //this has two parts, index 0 and index 1 since its a 64bit unsigned intiger
  16. int GetEffectID( effect eEffect, int nIndex=0 );
  17.  
  18. //Set eEffect's creator to o Creator
  19. effect SetEffectCreator( effect eEffect, object oCreator );
  20.  
  21. //Get the casterlevel of the effect
  22. int GetEffectCasterLevel( effect eEffect );
  23.  
  24. //Get the last effect
  25. //Used in SetEffectScript scripts
  26. effect GetLastEffect( );
  27.  
  28. //Creates an AC modifying effect
  29. //nAC can be negative or positive
  30. //This doesnt count as any type of AC
  31. //it also stacks with itself and doesnt respect any caps
  32. effect EffectAC( int nAC );
  33.  
  34. //Creates an AB modifying effect
  35. //nAB can be negative or positive
  36. //it also stacks with itself and doesnt respect any caps
  37. effect EffectAB( int nAB );
  38.  
  39. //Return integer data from eEffect
  40. //returns -1 if not valid
  41. int GetEffectInteger( effect eEffect, int nIndex );
  42.  
  43. //Return the unconditional AC mod (as created by EffectAC)
  44. int GetUnconditionalAC( object oPC );
  45.  
  46. //Return the unconditional AB mod (as created by EffectAB)
  47. int GetUnconditionalAB( object oPC );
  48.  
  49. int GetUnconditionalAB( object oPC ){
  50.  
  51.     SetLocalString( oPC, "NWNX!EFFECTS!GetUAB", "000000000000" );
  52.     string sRet = GetLocalString( oPC, "NWNX!EFFECTS!GetUAB" );
  53.     DeleteLocalString( oPC, "NWNX!EFFECTS!GetUAB" );
  54.     return StringToInt( sRet );
  55. }
  56.  
  57. int GetUnconditionalAC( object oPC ){
  58.  
  59.     SetLocalString( oPC, "NWNX!EFFECTS!GetUAC", "000000000000" );
  60.     string sRet = GetLocalString( oPC, "NWNX!EFFECTS!GetUAC" );
  61.     DeleteLocalString( oPC, "NWNX!EFFECTS!GetUAC" );
  62.     return StringToInt( sRet );
  63. }
  64.  
  65. int GetEffectInteger( effect eEffect, int nIndex ){
  66.  
  67.     SetLocalString( OBJECT_SELF, "NWNX!EFFECTS!GetInt", IntToString( nIndex ) );
  68.     DeleteLocalString( OBJECT_SELF, "NWNX!EFFECTS!GetInt" );
  69.     return GetEffectDurationType( eEffect );
  70. }
  71.  
  72. effect EffectAB( int nAB ){
  73.  
  74.     if( nAB == 0 )
  75.         return EffectHeal(-1);
  76.  
  77.     effect eEffect;
  78.  
  79.     if( nAB < 0 ){
  80.  
  81.         SetLocalString( OBJECT_SELF, "NWNX!EFFECTS!UnconditionalAB", IntToString( nAB*-1 ) );
  82.         eEffect =  MagicalEffect( EffectAttackDecrease( 1 ) );
  83.     }
  84.     else{
  85.  
  86.         SetLocalString( OBJECT_SELF, "NWNX!EFFECTS!UnconditionalAB", IntToString( nAB ) );
  87.         eEffect =  MagicalEffect( EffectAttackIncrease( 1 ) );
  88.     }
  89.  
  90.     DeleteLocalString( OBJECT_SELF, "NWNX!EFFECTS!UnconditionalAB" );
  91.     return eEffect;
  92. }
  93.  
  94. effect EffectAC( int nAC ){
  95.  
  96.     if( nAC == 0 )
  97.         return EffectHeal(-1);
  98.  
  99.     effect eEffect;
  100.  
  101.     if( nAC < 0 ){
  102.  
  103.         SetLocalString( OBJECT_SELF, "NWNX!EFFECTS!UnconditionalAC", IntToString( nAC*-1 ) );
  104.         eEffect =  MagicalEffect( EffectACDecrease( 1 ) );
  105.     }
  106.     else{
  107.  
  108.         SetLocalString( OBJECT_SELF, "NWNX!EFFECTS!UnconditionalAC", IntToString( nAC ) );
  109.         eEffect =  MagicalEffect( EffectACIncrease( 1 ) );
  110.     }
  111.  
  112.     DeleteLocalString( OBJECT_SELF, "NWNX!EFFECTS!UnconditionalAC" );
  113.     return eEffect;
  114. }
  115.  
  116. effect GetLastEffect( ){
  117.  
  118.     SetLocalString( OBJECT_SELF, "NWNX!EFFECTS!GetLastEffect", "0" );
  119.     DeleteLocalString( OBJECT_SELF, "NWNX!EFFECTS!GetLastEffect" );
  120.     int nID = GetEffectDurationType( EffectSleep( ) );
  121.  
  122.     effect eEffect = GetFirstEffect( OBJECT_SELF );
  123.     while( GetIsEffectValid( eEffect ) ){
  124.  
  125.         if( nID = GetEffectID( eEffect ) )
  126.             break;
  127.  
  128.         eEffect = GetNextEffect( OBJECT_SELF );
  129.     }
  130.  
  131.     return eEffect;
  132. }
  133.  
  134. int GetEffectCasterLevel( effect eEffect ){
  135.  
  136.     SetLocalString( OBJECT_SELF, "NWNX!EFFECTS!GetEffectCasterLevel", "0" );
  137.     DeleteLocalString( OBJECT_SELF, "NWNX!EFFECTS!GetEffectCasterLevel" );
  138.     return GetEffectDurationType( eEffect );
  139. }
  140.  
  141. effect SetEffectCreator( effect eEffect, object oCreator ){
  142.  
  143.     SetLocalString( OBJECT_SELF, "NWNX!EFFECTS!SetEffectCreator", ObjectToString( oCreator ) );
  144.     DeleteLocalString( OBJECT_SELF, "NWNX!EFFECTS!SetEffectCreator" );
  145.     return MagicalEffect( eEffect );
  146. }
  147.  
  148. int GetEffectID( effect eEffect, int nIndex ){
  149.  
  150.     SetLocalString( OBJECT_SELF, "NWNX!EFFECTS!GetEffectID", IntToString( nIndex ) );
  151.     DeleteLocalString( OBJECT_SELF, "NWNX!EFFECTS!GetEffectID" );
  152.     return GetEffectDurationType( eEffect );
  153. }
  154.  
  155. effect SetEffectCasterLevel( effect eEffect, int nCL ){
  156.  
  157.     SetLocalString( OBJECT_SELF, "NWNX!EFFECTS!SetEffectCasterLevel", IntToString( nCL ) );
  158.     DeleteLocalString( OBJECT_SELF, "NWNX!EFFECTS!SetEffectCasterLevel" );
  159.     return MagicalEffect( eEffect );
  160. }
  161.  
  162. effect SetEffectScript( effect eEffect, string sEffectScript ){
  163.  
  164.     SetLocalString( OBJECT_SELF, "NWNX!EFFECTS!SetEffectScript", sEffectScript );
  165.     DeleteLocalString( OBJECT_SELF, "NWNX!EFFECTS!SetEffectScript" );
  166.     return MagicalEffect( eEffect );
  167. }
  168.  
  169. effect SetEffectSpellID( effect eEffect, int nSpellID ){
  170.  
  171.     SetLocalString( OBJECT_SELF, "NWNX!EFFECTS!SetEffectSpellID", IntToString( nSpellID ) );
  172.     DeleteLocalString( OBJECT_SELF, "NWNX!EFFECTS!SetEffectSpellID" );
  173.     return MagicalEffect( eEffect );
  174. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement