I need some spellhook code to work on an NPC. It currently works fine with the PC, but when the NPC tries it out, it does not work. The NPC is not in the party, but is in the Defender faction.
Can the spellhook script work for an NPC?
Débuté par
M. Rieder
, nov. 12 2011 12:58
#1
Posté 12 novembre 2011 - 12:58
#2
Posté 13 novembre 2011 - 09:57
Yes, it works, BUT the scripters in their wisdom didn't think people would want it to, by and large (because it was used originally for crafting). So, it will only worked in areas flagged as wild magic areas i.e. with the "X2_L_WILDMAGIC" flag (I think) set to TRUE. Luckily, you can just set this variable on all the areas - I was doing this by hand in my old NWN1 module but I'm pretty sure you can just loop through all areas OnModuleLoad, it's what I'm doing now.
#3
Posté 13 novembre 2011 - 11:39
Thanks for the response Fred. Unfortunately I already re-worked my entire script and AI for doing it under the assumption that spellhook doesn't work with NPCs. It would have saved me a lot of time, ah well. If my current system turns out to be unstable, now I know I have a fall back system.
Question:
If you give an NPC the command ActionCastSpellAtObject() and the NPC is too far away to target the creature, does the engine automatically move the NPC closer, or do you have to script this as well?
Question:
If you give an NPC the command ActionCastSpellAtObject() and the NPC is too far away to target the creature, does the engine automatically move the NPC closer, or do you have to script this as well?
#4
Posté 18 novembre 2011 - 03:26
Yes, the action includes moving into the correct range for that action (this is I believe in general true for all actions).
#5
Posté 20 novembre 2011 - 01:57
Man! I could have saved *tons* of time that I used setting up a system to make the NPC move close enough before casting a spell. I still may switch over since I would only have to change a few lines of code.
#6
Posté 20 novembre 2011 - 04:03
if you already have that code, Matt, you might want to keep it; i've noticed a creature can get 'distracted' between moving and casting ...
#7
Posté 20 novembre 2011 - 05:38
Okay, I'll keep it. Right now things work fairly well.





Retour en haut






