EffectPolymorph and merging items
Moderator: Event DM
EffectPolymorph and merging items
I'm extremely new to NWN coding (but reasonably good at other coding like VBS, Powershell, etc.), but I wanted to give something a shot. I managed to create an item that executes a script when used. Specifically, the script does the following:
- Check if character has remaining uses of the feat Elemental Shape, and quit if not
- Apply the polymorph visual effect
- Apply a polymorph effect, using a row from polymorph.2da
- Decrement the remaining uses of the Elemental Shape
Basically, the idea is to use an item to add more options for Elemental Shape. The above all works, except that the item merging normally present with druid/shifter shape changing doesn't happen. Here's a shortened version of the code I'm using for this:
int POLYMORPH_TYPE_WISP = 84;
object oDruid = GetItemActivator();
if (!GetHasFeat(FEAT_ELEMENTAL_SHAPE, oDruid))
{
FloatingTextStringOnCreature("This form requires available Elemental Shape.", oDruid, FALSE);
return;
}
// Create Polymorph effect
effect ePoly = EffectPolymorph(POLYMORPH_TYPE_WISP);
// Create visual effect
effect eVis = EffectVisualEffect(VFX_IMP_POLYMORPH);
// Apply visual effect to target
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oDruid);
// Apply effect to object
ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePoly, oDruid);
// Take away one elemental shape
DecrementRemainingFeatUses(oDruid, FEAT_ELEMENTAL_SHAPE);
From what I can tell, the problem here is that EffectPolymorph is just a polymorph, but doesn't include druid/shifter item merging. Is there a different function I can call that will do the polymorphing with item merging? Obviously, such code exists, but is there a way to call it and pass it a polymorph.2da row number?
- Check if character has remaining uses of the feat Elemental Shape, and quit if not
- Apply the polymorph visual effect
- Apply a polymorph effect, using a row from polymorph.2da
- Decrement the remaining uses of the Elemental Shape
Basically, the idea is to use an item to add more options for Elemental Shape. The above all works, except that the item merging normally present with druid/shifter shape changing doesn't happen. Here's a shortened version of the code I'm using for this:
int POLYMORPH_TYPE_WISP = 84;
object oDruid = GetItemActivator();
if (!GetHasFeat(FEAT_ELEMENTAL_SHAPE, oDruid))
{
FloatingTextStringOnCreature("This form requires available Elemental Shape.", oDruid, FALSE);
return;
}
// Create Polymorph effect
effect ePoly = EffectPolymorph(POLYMORPH_TYPE_WISP);
// Create visual effect
effect eVis = EffectVisualEffect(VFX_IMP_POLYMORPH);
// Apply visual effect to target
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oDruid);
// Apply effect to object
ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePoly, oDruid);
// Take away one elemental shape
DecrementRemainingFeatUses(oDruid, FEAT_ELEMENTAL_SHAPE);
From what I can tell, the problem here is that EffectPolymorph is just a polymorph, but doesn't include druid/shifter item merging. Is there a different function I can call that will do the polymorphing with item merging? Obviously, such code exists, but is there a way to call it and pass it a polymorph.2da row number?
- Gorgon
- Father of Avlis EE
- Posts: 6637
- Joined: Fri Oct 17, 2003 10:14 pm
- Timezone: PST -8
- Location: Vancouver, BC, Canada
Re: EffectPolymorph and merging items
Avlis' nw_s2_elemshape.nss is probably what you want to look at, since it includes all the ws_inc_shifter.nss functions for merging items. I would have to spend a lot more time digging into it to be helpful (and my stuff is way out of date), but that should get you pointed in the right direction.
"God not only plays dice, he throws them in the corner where you can't see them."
-- Stephen William Hawking (1942-2018) --
Sprucing up ye olde NWN | NWN:EE Wiki | ~Avlis Theme Song~
-- Stephen William Hawking (1942-2018) --
Sprucing up ye olde NWN | NWN:EE Wiki | ~Avlis Theme Song~
Re: EffectPolymorph and merging items
Yup, looks like all the merging and other code surrounding druid/shifter shapechanging is in nw_s2_elemshape, nw_s2_wildshape, and x2_s2_gwildshp. Anyone know how/where I would find those nss files from Avlis's code?
- Sarmanos
- Major Event DM
- Posts: 4003
- Joined: Mon Aug 04, 2003 7:04 am
- Timezone: GMT -5
- DM Avatar: Chareth
- Location: Massillon, OH
Re: EffectPolymorph and merging items
I don't know the code for this stuff, but keep in mind that whatever you do may interact with mage transmutant shapeshifts since they seem to pull from the same tables.
Vetinari: I have noted before that you have a definite anti-authoritarian streak, Commander.
Vimes: Sir?
Vetinari: You seem to have retained this even though you are Authority.
Vimes: Sir?
Vetinari: That's practically Zen.
Vimes: Sir?
Vetinari: You seem to have retained this even though you are Authority.
Vimes: Sir?
Vetinari: That's practically Zen.
Re: EffectPolymorph and merging items
I think Avlis is using shifter code from Iznoghoud; possibly this one: http://neverwintervault.net/project/nwn ... ape-script
Anyway, I got my script working using the ws_inc_shifter.nss and x2_s2_gwildshp.nss from that mod (although obviously I'd want to copy Avlis's version, not the one I found on the vault). Created a plot item that, when used, shapeshifts the druid into Wisp form, with merging, and removes one use of Elemental Shape. Also created a plot item that shapeshifts the PC into Treant form, with merging, and removes one use of Construct Shape. In theory, could create unlimited forms for each shape via the use of such plot items. Vegepygmy Chieftain? Thorny? Gelatinous Cube? Hawk Beastman? Myconid?
Big thanks to Seka for giving me the idea (from the Bardic Music module).
As Sarmanos notes, I would need a copy of the Avlis polymorph.2da (and preferably other 2da files as well) in order to add new lines. Apparently, I need access to the SVN repository to find the Avlis code. Anyone know how I get access to that?
Anyway, I got my script working using the ws_inc_shifter.nss and x2_s2_gwildshp.nss from that mod (although obviously I'd want to copy Avlis's version, not the one I found on the vault). Created a plot item that, when used, shapeshifts the druid into Wisp form, with merging, and removes one use of Elemental Shape. Also created a plot item that shapeshifts the PC into Treant form, with merging, and removes one use of Construct Shape. In theory, could create unlimited forms for each shape via the use of such plot items. Vegepygmy Chieftain? Thorny? Gelatinous Cube? Hawk Beastman? Myconid?
Big thanks to Seka for giving me the idea (from the Bardic Music module).
As Sarmanos notes, I would need a copy of the Avlis polymorph.2da (and preferably other 2da files as well) in order to add new lines. Apparently, I need access to the SVN repository to find the Avlis code. Anyone know how I get access to that?
- Gorgon
- Father of Avlis EE
- Posts: 6637
- Joined: Fri Oct 17, 2003 10:14 pm
- Timezone: PST -8
- Location: Vancouver, BC, Canada
Re: EffectPolymorph and merging items
If you don't have CCC access, you'll want to ask for it. Gets you the latest everything, and it is where you'd be submitting the proposal and work, before it goes to QA. I kinda thought you were already part of it for some reason, but I think Micah is still the one to poke about that, or maybe Pleth.
Good luck.
Good luck.
"God not only plays dice, he throws them in the corner where you can't see them."
-- Stephen William Hawking (1942-2018) --
Sprucing up ye olde NWN | NWN:EE Wiki | ~Avlis Theme Song~
-- Stephen William Hawking (1942-2018) --
Sprucing up ye olde NWN | NWN:EE Wiki | ~Avlis Theme Song~
- Gorgon
- Father of Avlis EE
- Posts: 6637
- Joined: Fri Oct 17, 2003 10:14 pm
- Timezone: PST -8
- Location: Vancouver, BC, Canada
Re: EffectPolymorph and merging items
I'm curious why you want to use an item to add each new shape, instead of just adding it to the regular ability. Maybe as new dialog menu choices, or better yet, something like an ACP command. Is it some sort of reward or quest item?
I'm just not a big fan of even more crystals and plot (or worse, undroppable) items filling up more inventory space, if they really aren't needed. If you have your heart set on items for each shape, you could avoid more palette bloat with them by scripting their creation like augment crystals and the reprocessed junk (all renamed/retagged/altered generic misc items).
I'm just not a big fan of even more crystals and plot (or worse, undroppable) items filling up more inventory space, if they really aren't needed. If you have your heart set on items for each shape, you could avoid more palette bloat with them by scripting their creation like augment crystals and the reprocessed junk (all renamed/retagged/altered generic misc items).
"God not only plays dice, he throws them in the corner where you can't see them."
-- Stephen William Hawking (1942-2018) --
Sprucing up ye olde NWN | NWN:EE Wiki | ~Avlis Theme Song~
-- Stephen William Hawking (1942-2018) --
Sprucing up ye olde NWN | NWN:EE Wiki | ~Avlis Theme Song~
- tindertwiggy
- Legacy DM
- Posts: 6905
- Joined: Tue Jul 16, 2002 12:20 am
- Location: Newish England
- Contact:
Re: EffectPolymorph and merging items
Looking great so far.
New shapes would need corresponding entries in Polymorph.2da?
I personally am fine with an item, but as Gorgon said widgets are seen as sub-optimal. Perhaps integration into the crafting menu (like current selection of summons), or slash+text entries in the chat box ala Nob's "/spellbook load/save/list ClassName UserString"?
You will need ccc access and svn access. One current wrinkle is that the svn hosting service is going down. We have not organized a replacement host yet.
New shapes would need corresponding entries in Polymorph.2da?
I personally am fine with an item, but as Gorgon said widgets are seen as sub-optimal. Perhaps integration into the crafting menu (like current selection of summons), or slash+text entries in the chat box ala Nob's "/spellbook load/save/list ClassName UserString"?
You will need ccc access and svn access. One current wrinkle is that the svn hosting service is going down. We have not organized a replacement host yet.
Happiness is baked with one part bat guano, one part sulfur.
Re: EffectPolymorph and merging items
It was just recently migrated to a new host. PM avliswebadmin for access, and cc: Hamlet & Micah. Also, request to be added to CCC.tindertwiggy wrote:One current wrinkle is that the svn hosting service is going down. We have not organized a replacement host yet.
Player of Seka Ravenswylde, Kingsley Relish III, Anara Csorba Nazár, Grannika Grundlestern, and Maeve Konigin.
- Plethora
- Elder Event DM
- Posts: 31360
- Joined: Tue Jan 25, 2005 11:46 pm
- Timezone: +10
- DM Avatar: Verossa
- Location: GMT +10
- Contact:
Re: EffectPolymorph and merging items
we HAVE organized a replacement!!
pm krackq for svn access
pm krackq for svn access
You are the manifest of your own Destiny
Re: EffectPolymorph and merging items
If I get some time tonight, I'll clean up my test mod a bit and post it somewhere for suggestions. I'll pm krackq for SVN access as well. Thanks all.
- Gorgon
- Father of Avlis EE
- Posts: 6637
- Joined: Fri Oct 17, 2003 10:14 pm
- Timezone: PST -8
- Location: Vancouver, BC, Canada
Re: EffectPolymorph and merging items
You should probably see how CCC works before posting up plans for changes in Avlis to the public.
As far as DM rewards of new forms, persistent variables on the PC hide would do the same as handing out a bunch of items they have to carry (same idea as AMS/Trust unlocks, PrC stuff, quest settings etc). You could add new DM ACP commands for them to hand out the rewards (new DM wand/widget works too, but same problem with making more crap for them to carry).
Up to you how you do it, but less is more when it comes to valuable inventory space.
As far as DM rewards of new forms, persistent variables on the PC hide would do the same as handing out a bunch of items they have to carry (same idea as AMS/Trust unlocks, PrC stuff, quest settings etc). You could add new DM ACP commands for them to hand out the rewards (new DM wand/widget works too, but same problem with making more crap for them to carry).
Up to you how you do it, but less is more when it comes to valuable inventory space.

"God not only plays dice, he throws them in the corner where you can't see them."
-- Stephen William Hawking (1942-2018) --
Sprucing up ye olde NWN | NWN:EE Wiki | ~Avlis Theme Song~
-- Stephen William Hawking (1942-2018) --
Sprucing up ye olde NWN | NWN:EE Wiki | ~Avlis Theme Song~