Jump to content

Checking an actor if they have an item


scarycave

Recommended Posts

I'm trying to get an Ai package working where an actor gets a random item, then run a different package.

Npc picks up the nearest weapon (Does not equip), then walks off. Picture an angry mob going to a weapon rack and then storming off after mud-crabs or something.

Link to comment
Share on other sites

I m using

GetItemCount
to check if an npc carries and item.

Use it in a if statement.

 

Here is an example:

 

if NPC.GetItemCount NPCClassWarriorToken == 0     ; Checks If the npc doesnt have the token in his inventory
....                     
....
endif
if NPC.GetItemCount NPCClassWarriorToken == 1              ; Checks If the npc has the token in his inventory
....                     
....
endif

Link to comment
Share on other sites

If you mean any weapon at all, you could use "GetEquippedObject 16 != 0". This would check if they have a weapon actually equipped, but is not a surefire way of knowing if they are carrying an unequipped weapon.

 

The only 100% successful method I can think of is Inventory Ref-Walking. You will need to know how to use a ForEachstatement and study up on your inventory references ;)

Link to comment
Share on other sites

It worked like a charm. (:D)Thanks guys.

 

I just need to find a way to get the packages to work properly now.

 

I have it set up so

 

if GetFactionRank dummyfinditemfaction > 0 && GetFactionRank dummyfinditemfaction < 4

 

 

set pCont to Self

set invPos to 0

set invCount to pCont.GetNumItems

While invPos < invCount

set pInvObj to (pCont.GetInventoryObject invPos)

 

set invPos to invPos + 1

Loop

 

 

if (pInvObj.IsWeapon == 1 || pInvObj.IsArmor ==1 || pInvObj.IsAmmo == 1)

SetFactionRank dummyfinditemfaction 4

Evp

endif

 

Endif

 

The problem is keeps doing the same package over and over, the return package never runs.

Edited by scarycave
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...