Jump to content

Recommended Posts

Posted

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.

Posted

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

Posted
Is the token something that has to be added manually? I'm trying to get it for a package to work. If the actor doesn't have a weapon I have him run a find any weapon package. I want the Npc to run a new package once he has the weapon.
Posted

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 ;)

Posted (edited)

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
  • Recently Browsing   0 members

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