puiwaihin
Game Owner
NWN: HotU NWN 2 NWN 2: MotB NWN 2: SoZ
Joined: 12 Nov 2001 |
Posted: Friday, 20 July 2007 07:13PM |
I've been trying to get this to work for a while on my own, so I'll ask for help.
I want an invisible character to cast a spell at the PC-- triggered from a conversation. I can make the PC cast the spell at him/herself, but I can't manage to get a nearby NPC to do it.
Here's what I've done:
(Note, the spell is actually a random spell. I put the constant there to make the code easier to read.)
I'm using a Mordenkainen's Sword that I've given wizard levels to, set to immobile, removed the sword from inventory, and placed near where the script fires. The creatures tag has been changed to "inv_caster".
When the script fires, nothing happens. If I change the script so that I assign the command to oPC instead of oCaster the player will cast the spell on him/herself. _________________ Been there, done that, still paying the bill. |
|
420
Game Owner
NWN NWN: SoU NWN: HotU NWN 2
Joined: 18 May 2002 |
Posted: Friday, 20 July 2007 07:43PM |
The way NWN2 handles factions is kind of screwed up. Try changing to standard faction hostile instead of assigning ActionTurnHostile to the creature.
-420 _________________ Channel: Social Server: ThrobbleServ Module: The Tavern of Doors PWC File: tinyurl.com/y8aex7 or NWVault
NWN2 Armor and Weapon Crafting Guide |
|
puiwaihin
Game Owner
NWN: HotU NWN 2 NWN 2: MotB NWN 2: SoZ
Joined: 12 Nov 2001 |
Posted: Saturday, 21 July 2007 10:22AM |
Thanks for the suggestion. I tried it and it didn't work, but it was a good idea.
I'm not sure the character actually has to be hostile. I added that part in after it didn't work originally thinking that may have been the problem. I'm using the "cheat" parameter, so that even if the character can't cast the spell, the CastSpellOnObject command still works.
My guess is that there's some setting on the NPC that is preventing the script from working. Again, the PC character has no problem casting the spell on himself-- but hostile spells don't seem to take effect. _________________ Been there, done that, still paying the bill. |
|
Olblach
Game Owner
NWN NWN: SoU NWN: HotU NWN 2 NWN 2: MotB NWN 2: SoZ
Joined: 19 May 2003 From: France |
Posted: Saturday, 21 July 2007 01:25PM |
Try ActionCastFakeSpellAtObject and see how it goes. I know I'm using it and there must be a reason but I wrote my code 3 years ago. _________________ CNR for NWN2 InCharacter Plugin |
|
puiwaihin
Game Owner
NWN: HotU NWN 2 NWN 2: MotB NWN 2: SoZ
Joined: 12 Nov 2001 |
Posted: Saturday, 21 July 2007 04:04PM |
That might be a good thing to try to test to see if it's a hostility issue or not, but I definitely want the spell to be cast, not just the animations done.
I'll try it, but I don't believe that is going to do what I want. _________________ Been there, done that, still paying the bill. |
|
robertthebard
Game Owner
NWN NWN: SoU NWN: HotU NWN 2
Joined: 19 Jun 2002 |
Posted: Saturday, 21 July 2007 04:26PM |
How about changing this:
to this:
_________________ ...and it harm none, do as thou wilt. My Music |
|
puiwaihin
Game Owner
NWN: HotU NWN 2 NWN 2: MotB NWN 2: SoZ
Joined: 12 Nov 2001 |
Posted: Sunday, 22 July 2007 08:48AM |
That was suggested earlier, but unfortunately that did not work. Something else must be at play here. _________________ Been there, done that, still paying the bill. |
|
robertthebard
Game Owner
NWN NWN: SoU NWN: HotU NWN 2
Joined: 19 Jun 2002 |
Posted: Sunday, 22 July 2007 12:12PM |
Doh. Totally missed it.
Edit:
Shouldn't that line really just be:
object oPC is defined on the line previous, and adding it here may compile, but just serves to confuse the script, as oPC is considered part of inv_caster too. _________________ ...and it harm none, do as thou wilt. My MusicEdited By robertthebard on 07/22/07 12:19 |
|
jackyo123
Game Owner
NWN 2 NWN 2: MotB
Joined: 13 Dec 2006 |
Posted: Sunday, 22 July 2007 07:48PM |
Quote: Posted 07/22/07 12:12 (GMT) by robertthebard Doh. Totally missed it. Edit: Shouldn't that line really just be: object oPC is defined on the line previous, and adding it here may compile, but just serves to confuse the script, as oPC is considered part of inv_caster too.
I think the problem might be in the title - i dont think an invisible NPC can cast a spell at the player.
You can make them PRACTICALLY invisible by making them SUPER small. Same effect, but it should work fine _________________ Night Howls in Nestlehaven - Click Here Cutscene Tutorial - Click Here NHIN team - Click Here |
|
puiwaihin
Game Owner
NWN: HotU NWN 2 NWN 2: MotB NWN 2: SoZ
Joined: 12 Nov 2001 |
Posted: Monday, 23 July 2007 05:33PM |
Quote: Posted 07/22/07 19:48 (GMT) by jackyo123 I think the problem might be in the title - i dont think an invisible NPC can cast a spell at the player.
You can make them PRACTICALLY invisible by making them SUPER small. Same effect, but it should work fine Confirmed. I put another creature with the same tag that didn't have an invisible appearance and the spell cast just fine. I wonder if you can have them partially invisible and it works. If you could just leave one thing visible that would be best.
I'll post the results after I try it in the toolset.
Thanks for your help! _________________ Been there, done that, still paying the bill.Edited By puiwaihin on 07/23/07 17:34 |
|
Olblach
Game Owner
NWN NWN: SoU NWN: HotU NWN 2 NWN 2: MotB NWN 2: SoZ
Joined: 19 May 2003 From: France |
Posted: Monday, 23 July 2007 05:40PM |
What about SetScriptHidden() ? Were you using it already? _________________ CNR for NWN2 InCharacter Plugin |
|
jackyo123
Game Owner
NWN 2 NWN 2: MotB
Joined: 13 Dec 2006 |
Posted: Tuesday, 24 July 2007 12:40AM |
Quote: Posted 07/23/07 17:33 (GMT) by puiwaihin Quote: Posted 07/22/07 19:48 (GMT) by jackyo123 I think the problem might be in the title - i dont think an invisible NPC can cast a spell at the player.
You can make them PRACTICALLY invisible by making them SUPER small. Same effect, but it should work fine
Confirmed. I put another creature with the same tag that didn't have an invisible appearance and the spell cast just fine. I wonder if you can have them partially invisible and it works. If you could just leave one thing visible that would be best. I'll post the results after I try it in the toolset. Thanks for your help! quite welcome.
I use the 'super small caster' trick all over the place in nestlehaven. it works fine, and the time investment to try and find an alternative that wasnt really any better wasnt worth it, IMHO. _________________ Night Howls in Nestlehaven - Click Here Cutscene Tutorial - Click Here NHIN team - Click Here |
|
puiwaihin
Game Owner
NWN: HotU NWN 2 NWN 2: MotB NWN 2: SoZ
Joined: 12 Nov 2001 |
Posted: Tuesday, 24 July 2007 01:06PM |
Quote: Posted 07/23/07 17:40 (GMT) by Olblach
What about SetScriptHidden() ? Were you using it already? Yes, I tried that. Didn't work. I guess any "hidden" creature cannot do anything to reveal themselves until they are no longer hidden.
And it seems that even partially invisible won't work. Has to be 100% visible. I tried making the head and body invisible but leaving the hands and it wouldn't work.
On a "I hate the toolset" note, my toolset just crashed while saving for the second time. Corrupted my module-- again. The bad thing is, it happens most often when I'm trying to make a backup. GRRR.
Luckily, I do have backups, but losing my "final solution" to the problem is really annoying. I think I'll take out my frustrations on the players.  _________________ Been there, done that, still paying the bill. |
|
jackyo123
Game Owner
NWN 2 NWN 2: MotB
Joined: 13 Dec 2006 |
Posted: Wednesday, 25 July 2007 03:44AM |
Quote: Posted 07/24/07 13:06 (GMT) by puiwaihin Quote: Posted 07/23/07 17:40 (GMT) by Olblach
What about SetScriptHidden() ? Were you using it already?
Yes, I tried that. Didn't work. I guess any "hidden" creature cannot do anything to reveal themselves until they are no longer hidden. And it seems that even partially invisible won't work. Has to be 100% visible. I tried making the head and body invisible but leaving the hands and it wouldn't work. On a "I hate the toolset" note, my toolset just crashed while saving for the second time. Corrupted my module-- again. The bad thing is, it happens most often when I'm trying to make a backup. GRRR. Luckily, I do have backups, but losing my "final solution" to the problem is really annoying. I think I'll take out my frustrations on the players. If its only a script change, then a save wont hurt you.
The directory in the modules directory that is named the same thing as your current 'save', will have copies of your scripts if you compiled them before saving. Just look for them, and save a copy to your desktop.
now when you reload your last saved mod, drag and drop the 'good' updated script into your directory that again is the same name as the version you just opened. Now, RESAVE and bingo! you've got your up-to-date scripts (i dont remember if you need to restart the toolset or not after that, but I have several crashes a night and this always saves my butt. works for uti's, dlg, and all script files. DOESNT work for areas and anything in areas, though the trn files will have any terrain adjustments you make) _________________ Night Howls in Nestlehaven - Click Here Cutscene Tutorial - Click Here NHIN team - Click Here |
|