Aller au contenu

Photo

Can NPCs activate items?


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
LoA_Tristan

LoA_Tristan
  • Members
  • 40 messages
I've checked around but haven't really found a clear answer to this.

I note from experience in the OC that NPCs use potions as part of the AI scripted talent behavior; for instance
tUse = GetCreatureTalentRandom(TALENT_CATEGORY_BENEFICIAL_HEALING_POTION);
if(GetIsTalentValid(tUse))
{
    //MyPrintString("TalentHealingSelf Successful Exit");
    bkTalentFilter(tUse, OBJECT_SELF);
    return TRUE;
}
but this is about the only evidence I see that NPCs can activate any kind of item at all, and this bit of scripting is, eh... cryptic. Seems like something is hardcoded from here out, and the whole process of activating an item cannot be scripted.

#2
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages
That's correct, there is no action to activate a specific item.

Funky

#3
LoA_Tristan

LoA_Tristan
  • Members
  • 40 messages
Kind of sad, I think, that all those wizards you see consider their staves baseball bats :(

#4
Highv Priest

Highv Priest
  • Members
  • 93 messages
lol I just faked it. All the animations for activating an item are the same and using the bcheat/binstant for ActionCastSpell makes it LOOK like they just used a scroll/potion/etc. If you really want the code I'll be glad to give it to you. It's just apart of my "awesome_include" library(which is just things I created that fix MANY aspects of nwn) and it's called "ActionUseItem(string sName, int nItemType, object oUser=OBJECT_SELF)". The code checks if they have it, if they do it will decrease the amount of it, or decrease it's charges, or destroy it. It Sets them to be non-commandable for the duration of the animation and has them instant cast the spell on there target in the middle of the animation.

#5
acomputerdood

acomputerdood
  • Members
  • 219 messages
there's an nwnx plugin that allows you make creatures use items via scripting:

http://social.biowar...14258835-1.html

you could use this to force an NPC to use the staff. if you wanted him to "decide" when to use it on his own, i imagine it would take some mucking about with the AI scripts.

or you seem quite happy with your solution :)

#6
DM_Vecna

DM_Vecna
  • Members
  • 280 messages
Highv priest, I would love a copy of your awesome_include. I love home brew functions like this, they really get me thinking differently.

Vecna@nwnsmith.com