Is there a way to make an NPC use an item's special property? (Like cast a spell)
#1
Posté 16 mars 2013 - 04:12
#2
Posté 16 mars 2013 - 04:40
( Do i remember seeing a 'Use Equippable items' flag ...? )
#3
Posté 16 mars 2013 - 06:16
#4
Posté 16 mars 2013 - 06:22
I'll probably just fake it then. I can't get the character to cast the spell either, even using bCheat=TRUE. I'll just spawn it in myself.
#5
Posté 17 mars 2013 - 06:05
#6
Posté 17 mars 2013 - 09:48
#7
Posté 18 mars 2013 - 04:57
Modifié par rjshae, 18 mars 2013 - 04:59 .
#8
Posté 18 mars 2013 - 03:03
rjshae wrote...
Yes, placing an item in the character's inventory will work because that will cause GetFirstItemInInventory() to return that item. But inserting the HasAnItem() function call (listed out in the other post) will fix the problem for all creatures because it always searches through every equipment slot until it finds something. The drawback is that you need to use a local copy of the "hench_i0_ai" script in your module/campaign to make that modification.
A local copy probably wouldn't kill me.
Another question however: How do you explicitely tell the NPC to use the item? Is there a way to do that? Because I haven't seen it yet. What causes an NPC to decided to use a charge on an item instead of performing some other attack action or casting another spell?
I'm thinking if I want fine-grained control over such a tactic, I just need to script it into the event.
#9
Posté 18 mars 2013 - 07:26
#10
Posté 18 mars 2013 - 11:26
the #include is really 'hench_i0_itemsp', function InitializeItemSpells()
and it's been compiled into 'hench_o0_ai', 'hench_o0_heal',
imo, it's player-side responsibility to correct those. (But if you want to go ahead, natch). Builder-side, just throw a broken item in inventory ...
Making an NPC use an item seems to involve "talents" and relies on the deep, dark bowels of the AI. eg, Forcing an NPC to swig a potion isn't possible, per se.
- at least, the furthest I've got is just give 'em the potion and let the
Modifié par kevL, 18 mars 2013 - 11:43 .
#11
Posté 19 mars 2013 - 12:02
kevL wrote...
Making an NPC use an item seems to involve "talents" and relies on the deep, dark bowels of the AI. eg, Forcing an NPC to swig a potion isn't possible, per se.
- at least, the furthest I've got is just give 'em the potion and let theRNGAI do what it does, regarding item use. haven't played w/ ItemProp Activation tho.
I started looking at talents/skills and was wondering if a skill check like Use Magic Item would cause an NPC to be able to cast a spell from a dagger. It looks like it's possible - the native function calls look like they could get the job done, But I decided it was way easier to "fake" it.
Right now, what I do is have the NPC (in conversation) do the CastFakeSpellAtLocation, and then I delay a call to a custom function to CreateObject (because CreateObject returns the object, so it won't work with Delay). And that's okay, because my custom wrapper method needed to set faction, etc, anyway.
Timed just right, it looks like the NPC casts the spell... which is awesome. And the item to do it sits in their hand/inventory, so the player is none the wiser.
#12
Posté 31 mars 2013 - 02:13





Retour en haut






