Games Support Forums BioWare Info My Account Login Community Sign Up Store
Neverwinter Nights 2 Forums

NWN2: Builders - NWN2 Scripting

New Topic    Post Reply

Go to Page ( 1 , 2 Next )

    Add this To My Topics

   Go To Bottom

Author charm spells for PRR
Vendalus
Game Owner
Profile: VendalusNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB


Joined: 30 Jun 2002
Posted: Sunday, 06 January 2008 08:49PM
I've been considering how to implement charm spells for PRR for a while now, and I wanted to run my current thoughts by everyone to see what you all think.

In the NWN1 scripts, I had simple modified the charm spell code to add a PRR reaction adjustment. The big issue in NWN2 is that you can't target neutral NPCs with spells, meaning you can't actually cast the spell. My current thought is to create a conversation option with scripts that would check to see if you can cast the spell and then handle it through dialog.

Checking to see if the PC has a charm spell ready should be easy. When I get to items and scrolls however, that seems to require a bit more. As I understand it, I'd have to go through every item equipped and in the inventory of the PC speaker and check to see if it has a cast charm spell property.

My question is:

Is there anything I'm missing that would make this a lot easier? Is there a better way to do this? Thanks in advance.

Here is the link to PRR:
Click Here
_________________
Vendalus' Corner
Wendersnaven.com
Vault Submissions
  Profile: Vendalus   Send Message To: Vendalus
dirtywick
Game Owner
Profile: dirtywickNWN 2
NWN 2: MotB
Mass Effect


Joined: 03 Oct 2006
Posted: Sunday, 06 January 2008 11:26PM
You could create a loop to check all of the items in the inventory and every item slot for the item property for the various charm spells. That's about as easy as it'll get, I think.
_________________
BouncyRock Entertainment
Subtlety of Thay Campaign
SoT Blog
  Profile: dirtywick   Send Message To: dirtywick
Vendalus
Game Owner
Profile: VendalusNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB


Joined: 30 Jun 2002
Posted: Monday, 07 January 2008 01:11AM
Yeah, I think you're right. I've got the basic charm person spell working. You get a "Cast a charm spell..." option in the dialog that then lets you choose the method you want. Then you could use a spell or a scroll or an item, etc. Just need duplicate the code for all the variations.

Then I'll start on items. I'll let you know how it goes.
  Profile: Vendalus   Send Message To: Vendalus
Vendalus
Game Owner
Profile: VendalusNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB


Joined: 30 Jun 2002
Posted: Sunday, 13 January 2008 12:19AM
Well, here is the guts of my item check so far:

Code:

View Post/Code in separate window



You'll need to define oPC and also have ginc_debug included for it to compile.

It's not working though, because I think that trying to directly compare the two property objects doesn't fly. I can check GetItemHasItemProperty to see if the item can cast a spell, but I can't seem to determine what spell it can cast.

Any help would be much appreciated.

Edited By Vendalus on 01/13/08 00:20

  Profile: Vendalus   Send Message To: Vendalus
dirtywick
Game Owner
Profile: dirtywickNWN 2
NWN 2: MotB
Mass Effect


Joined: 03 Oct 2006
Posted: Sunday, 13 January 2008 01:01AM
Only thing I can think of is changing the constants to the actual 2DA line number. I had a similar problem with a spell script where it wouldn't recognize constants but it would the 2DA line number references.
_________________
BouncyRock Entertainment
Subtlety of Thay Campaign
SoT Blog
  Profile: dirtywick   Send Message To: dirtywick
Vendalus
Game Owner
Profile: VendalusNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB


Joined: 30 Jun 2002
Posted: Monday, 14 January 2008 01:27AM
Changing to the int value didn't seem to help. I'm digging into x2_inc_itemprop now to see if I can leverage those scripts. Mainly, IPGetItemHasProperty takes a property as a param, so that looks hopeful. Need to run for now, though.
  Profile: Vendalus   Send Message To: Vendalus
DedoITA
Game Owner
Profile: DedoITANWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB
NWN 2: SoZ


Joined: 05 Sep 2004
Posted: Tuesday, 15 January 2008 11:19AM
you can modify charm spells to be casted to everyone,not only to enemy
  Profile: DedoITA   Send Message To: DedoITA
Baragg
Game Owner
Profile: BaraggNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB


Joined: 03 Jun 2005
From: Vidor, Texas
Posted: Tuesday, 15 January 2008 02:24PM
In the on_load of the moduel there is this.


#include "x2_inc_switches"
#include "x2_inc_restsys"
void main()
{
if (GetGameDifficulty() == GAME_DIFFICULTY_CORE_RULES || GetGameDifficulty() == GAME_DIFFICULTY_DIFFICULT)
{
// * Setting the switch below will enable a seperate Use Magic Device Skillcheck for
// * rogues when playing on Hardcore+ difficulty. This only applies to scrolls
SetModuleSwitch (MODULE_SWITCH_ ENABLE_UMD_SCROLLS, TRUE);

// ChazM: this doesn't appear to be used anywhere...
// * Activating the switch below will make AOE spells hurt neutral NPCS by default
// SetModuleSwitch (MODULE_SWITCH_AOE_HURT _NEUTRAL_NPCS, TRUE);

// ChazM: controls whether NPC can hurt each other with AOE's.
//SetModuleSwitch (MODULE_SWITCH_ENABLE _NPC_AOE_HURT_ALLIES, TRUE);

// ChazM: controls whether a PC party can hurt each other with AOE's.
SetModuleSwitch (MODULE_SWITCH_ENABLE _MULTI_HENCH_AOE_DAMAGE, TRUE);
}

If you can comment out the if(gamedifficulty) and the blocks it has, you could comment in the AOE_HURT_NPC and the allies also. I wish they would let me do this on SM. Hehe, but most players wouldn't like that.
  Profile: Baragg   Send Message To: Baragg
Vendalus
Game Owner
Profile: VendalusNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB


Joined: 30 Jun 2002
Posted: Wednesday, 16 January 2008 02:57AM
Baragg, will that setting allow you to just hurt NPCs with aoe effects, as opposed to targeting them? The issue is actually that you can't target them.

I've tried changing the HostileSetting in the spells.2da to 0, which will allow you to target a neutral NPC, but this means you can't target hostile creatures.

DedoITA, can you speak a bit more on how you can allow the spell to be cast on both hostile and neutrals?
  Profile: Vendalus   Send Message To: Vendalus
Vendalus
Game Owner
Profile: VendalusNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB


Joined: 30 Jun 2002
Posted: Wednesday, 16 January 2008 04:34AM
Well, as a quick update, I spent some more time playing with the spells.2da, but I still could not get a solution where you can target both hostiles and neutrals.

I did dig into x2_inc_itemprop, and I was able to catch the charm spell property on an item with IPGetItemHasProperty().

So later in the week, I might try to finish building out the conversation to cycle through the PC inventory and allow for up to 10 items as options for casting the spell. I have a plan where you will cycle through the inventory once when you say you want to cast the spell, and save all items with the property as objects on the player. Then presenting those options should be pretty easy.

I'd still like to side-step this whole issue by just allowing players to target both hostiles and neutrals, though. Any advice someone can give me on this would be greatly appreciated.
  Profile: Vendalus   Send Message To: Vendalus
Baragg
Game Owner
Profile: BaraggNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB


Joined: 03 Jun 2005
From: Vidor, Texas
Posted: Wednesday, 16 January 2008 03:27PM
From the lexicon:


Code:

View Post/Code in separate window



Had to add some spaces to get it to go, that is why it looks funny.
  Profile: Baragg   Send Message To: Baragg
Baragg
Game Owner
Profile: BaraggNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB


Joined: 03 Jun 2005
From: Vidor, Texas
Posted: Wednesday, 16 January 2008 03:30PM
If you want a pc to be able to target an npc, you could set your npc to hostile. Just for a short period.

This is for a charmspell right?
  Profile: Baragg   Send Message To: Baragg
Baragg
Game Owner
Profile: BaraggNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB


Joined: 03 Jun 2005
From: Vidor, Texas
Posted: Wednesday, 16 January 2008 03:32PM
Quote: Posted 01/15/08 11:19 (GMT) by DedoITA

you can modify charm spells to be casted to everyone,not only to enemy

In the 2da? How so, sorry I dont 2da much.
  Profile: Baragg   Send Message To: Baragg
DedoITA
Game Owner
Profile: DedoITANWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB
NWN 2: SoZ


Joined: 05 Sep 2004
Posted: Wednesday, 16 January 2008 04:18PM
Ok, probably my answer was a little bit criptyc

My solution is to make charm actually "2" spells, selectable on the fly as the Protection from evil/good spells.

It's quite easy making it in spells.2da, one for using it against enemy, one for using it with neutral/friendly.

In this way you can charm neutral npc, and in conversation just check if they are charmed and make appear special conversation nodes.

Pretty elegant, i'd say
  Profile: DedoITA   Send Message To: DedoITA
Vendalus
Game Owner
Profile: VendalusNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB


Joined: 30 Jun 2002
Posted: Friday, 18 January 2008 04:10AM
Thanks! That's what I was looking for, actually. So from what I can tell:

1. Make two dupes for the spell down in the padding area.

2. Edit the initial version to have the 2da values of each dupe in the SubRadSpell1 and SubRadSpell2 columns.

3. Edit the initial version to have **** in the ImpactScript column so that nothing actually fires.

4. Replace all caster level values with **** on each of the new dupes of the spell.

5. Edit the name columns to be the initial name of the spell, plus "hostile" and "friendly" (respectively).

6. Change the second entry (friendly) so that the Hostile flag is 0.

Repeat for each variant.

Sounds right?

ps- Baragg, if you go into the data folder in your install directory, you'll see 2da.zip and/or 2da_x1.zip. Export it somewhere else on your machine and you'll see all the 2da files. You can edit them with xls.
  Profile: Vendalus   Send Message To: Vendalus

Go to Page ( 1 , 2 Next )

New Topic    Post Reply

What do these icons mean?
Where can I learn how to use the forums?

Jump To:

Search Forums | Forums FAQ | Forum Archives

 

 

  Visit the Official Site | Technical Support
Neverwinter Nights 2 Official Support
Hide/Show

English
Deutsch
Français
Español
Italiano

Hide/Show

6,251,297 Users
170 Online
11 Logged In

9,046,484 posts in forums

Newest Forum Topics:
1. These forums are now closed (NWN 1: Scripting)

2. These forums are now closed (NWN2: Guilds and Registry)

3. These forums are now closed (BioWare News Discussion)

4. Can you level items? (NWN 1: Scripting)

5. Thank you! (NWN 1: Scripting)


Current time is: (set time)
Fri, 03 September 2010 12:57AM