Author Topic: Item Activated Unique power error  (Read 308 times)

Legacy_Nebril2

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
Item Activated Unique power error
« on: November 12, 2014, 03:07:14 pm »


               

Hi all!!


 


 


 


I just want to make a item that when activated gives gold to the activator... simple but im getting one error. 


 


The item not only activates when used, also when picked up, dropped etc... and of course i dont want that.


 


I use to have that problem before but i solved it with an #include, but now months later cant remember which include is! i tried with many but none worked. 


 


This is the current code, trying with 2 more includes there none working.


 


 



 


#include "nw_i0_spells"


#include "x0_i0_spells"

 

void main()

{

 

  object oPC = GetItemActivator();

 

  GiveGoldToCreature(oPC, d8(5));

 

 

 

 

}


 



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Item Activated Unique power error
« Reply #1 on: November 12, 2014, 03:32:47 pm »


               

Try here.  The include is x2_inc_switches which will give you the constants for the user defined events.



               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Item Activated Unique power error
« Reply #2 on: November 12, 2014, 03:50:27 pm »


               

Try this


 


#include "x2_inc_switches"
 
void main()
{
    int nEvent = GetUserDefinedItemEventNumber();    
    object oPC;     
 
    switch (nEvent)
    {
        case X2_ITEM_EVENT_ACTIVATE:
 
            oPC   = GetItemActivator();        
 
            GiveGoldToCreature(oPC, d8(5));
            break;
    }
}


               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Item Activated Unique power error
« Reply #3 on: November 12, 2014, 04:53:34 pm »


               

Good responses here.


 


Just want to suggest that rather than the old lexicon, Nebril be pointed to the wikified lexicon.


Here's the tutorial at the wiki.



               
               

               
            

Legacy_Nebril2

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
Item Activated Unique power error
« Reply #4 on: November 13, 2014, 01:51:01 am »


               Yes now I got it used the user defined events  worked,  you are so nice '<img'>


Thanks