Jump to content
  • 0

Interlude Ai.obj Function - Ownitemcount (Id>= Xxxx)


Question

Posted (edited)

Hello all,

 

I wonder if there is a way for an npc to check if a character has an item with ID is between XXX and ZZZ, save such item ID on  variable and then delete such item. Im new to AI and this is the main idea im trying to achieve.... please pardon how crude this looks...i will use @nobless_tiara just for example
 

Example: 

EventHandler TALKED( talker, i0 )
{
  If  (Talker.(OwnitemCount (ID>= XXX && ID <=ZZZ) >=1) >=1) 
  {
    i0 = Talker.(OwnitemCount (ID>= XXX && ID <=ZZZ) >=1)
    myself::DeleteItem1( talker, i0, 1 );
    myself::GiveItem1( talker, @nobless_tiara, 1 );
  }
}

I'd also take on alternative ideas :)

Edited by khul

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

AFAICT you have to specify all the ids and check them separately, something like this:

 

In CREATED handler of the NPC:

myself.int_list.Add( ID1 );
myself.int_list.Add( ID2 );
myself.int_list.Add( ID3 );
myself.int_list.Add( ID3 );
... 

And then in TALKED handler loop trough the int_list and remove all the items:

for( i0 = 0; i0 <= myself.int_list.GetSize(); ++i0 ) {
  i1 = myself.int_list.Get( i0 );
  if( OwnItemCount( talker, i1 ) > 0 ) {
    DeleteItem1( talker, i1 );
    ... // do other stuff
  }
} 

Hope this helps.

Edited by jornik
Guest
This topic is now closed to further replies.


×
×
  • Create New...