EffectPolymorph and merging items

Moderator: Event DM

Post Reply
User avatar
RCon
CCC
CCC
Posts: 4824
Joined: Wed Sep 15, 2004 2:19 am
Location: New York, NY (GMT -5)

EffectPolymorph and merging items

Post by RCon » Sun Feb 21, 2016 11:58 pm

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?
User avatar
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

Post by Gorgon » Mon Feb 22, 2016 2:54 am

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~
User avatar
RCon
CCC
CCC
Posts: 4824
Joined: Wed Sep 15, 2004 2:19 am
Location: New York, NY (GMT -5)

Re: EffectPolymorph and merging items

Post by RCon » Mon Feb 22, 2016 3:25 am

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?
User avatar
Sarmanos
Major Event DM
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

Post by Sarmanos » Mon Feb 22, 2016 3:45 am

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.
User avatar
RCon
CCC
CCC
Posts: 4824
Joined: Wed Sep 15, 2004 2:19 am
Location: New York, NY (GMT -5)

Re: EffectPolymorph and merging items

Post by RCon » Mon Feb 22, 2016 5:07 am

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?
User avatar
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

Post by Gorgon » Mon Feb 22, 2016 5:34 am

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.
"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~
User avatar
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

Post by Gorgon » Mon Feb 22, 2016 5:52 am

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).
"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~
User avatar
tindertwiggy
Legacy DM
Legacy DM
Posts: 6905
Joined: Tue Jul 16, 2002 12:20 am
Location: Newish England
Contact:

Re: EffectPolymorph and merging items

Post by tindertwiggy » Mon Feb 22, 2016 8:06 am

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.
Happiness is baked with one part bat guano, one part sulfur.
User avatar
Seka
Scholar
Posts: 1415
Joined: Tue Jun 10, 2003 12:37 am
Timezone: CDT (GMT -5)
Location: Austin

Re: EffectPolymorph and merging items

Post by Seka » Mon Feb 22, 2016 8:31 am

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.
Player of Seka Ravenswylde, Kingsley Relish III, Anara Csorba Nazár, Grannika Grundlestern, and Maeve Konigin.
User avatar
Plethora
Elder Event DM
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

Post by Plethora » Mon Feb 22, 2016 10:14 am

we HAVE organized a replacement!!

pm krackq for svn access
You are the manifest of your own Destiny
User avatar
RCon
CCC
CCC
Posts: 4824
Joined: Wed Sep 15, 2004 2:19 am
Location: New York, NY (GMT -5)

Re: EffectPolymorph and merging items

Post by RCon » Mon Feb 22, 2016 2:22 pm

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.
User avatar
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

Post by Gorgon » Mon Feb 22, 2016 4:48 pm

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
"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~
Post Reply