Page 1 of 1

EffectPolymorph and merging items

Posted: Sun Feb 21, 2016 11:58 pm
by RCon
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?

Re: EffectPolymorph and merging items

Posted: Mon Feb 22, 2016 2:54 am
by Gorgon
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.

Re: EffectPolymorph and merging items

Posted: Mon Feb 22, 2016 3:25 am
by RCon
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?

Re: EffectPolymorph and merging items

Posted: Mon Feb 22, 2016 3:45 am
by Sarmanos
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.

Re: EffectPolymorph and merging items

Posted: Mon Feb 22, 2016 5:07 am
by RCon
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?

Re: EffectPolymorph and merging items

Posted: Mon Feb 22, 2016 5:34 am
by Gorgon
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.

Re: EffectPolymorph and merging items

Posted: Mon Feb 22, 2016 5:52 am
by Gorgon
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).

Re: EffectPolymorph and merging items

Posted: Mon Feb 22, 2016 8:06 am
by tindertwiggy
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.

Re: EffectPolymorph and merging items

Posted: Mon Feb 22, 2016 8:31 am
by Seka
tindertwiggy wrote:One current wrinkle is that the svn hosting service is going down. We have not organized a replacement host yet.
It was just recently migrated to a new host. PM avliswebadmin for access, and cc: Hamlet & Micah. Also, request to be added to CCC.

Re: EffectPolymorph and merging items

Posted: Mon Feb 22, 2016 10:14 am
by Plethora
we HAVE organized a replacement!!

pm krackq for svn access

Re: EffectPolymorph and merging items

Posted: Mon Feb 22, 2016 2:22 pm
by RCon
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.

Re: EffectPolymorph and merging items

Posted: Mon Feb 22, 2016 4:48 pm
by Gorgon
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. :P