Author Topic: Polymorph Shapechange Alteration  (Read 725 times)

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
Polymorph Shapechange Alteration
« on: March 09, 2016, 11:04:56 pm »


               

So I made an item that changes your appearance to a skeleton when you equip it, and now I'm trying to alter some shape change forms like green, red, blue dragon etc... though I don't have much of a clue on how to do this.


 


I'll have the player activate a misc item, and then if they end up shape changing it'll turn them into something else.


 


so this is what I have so far...


 


{

string sTag = GetTag(oItem);

if(sTag == "FiendishShapechange")


{

if(GetHasFeatEffect(FEAT_EPIC_WILD_SHAPE_DRAGON, oPC))

{

SetCreatureAppearanceType(oPC, APPEARANCE_TYPE_DEVIL);

}


}

}


 


I'm not sure how to discern between the different shapes, and I also don't know how to make it so when the player unshifts they just go back to their normal appearance. Can anyone help me?



               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Polymorph Shapechange Alteration
« Reply #1 on: March 10, 2016, 02:21:49 am »


               

Grab a copy of the lexicon, all the various constants are covered in there. Also there is a link to the constantly updated on-line version of the lexicon on the page I just linked to.


 


TR



               
               

               
            

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
Polymorph Shapechange Alteration
« Reply #2 on: March 10, 2016, 12:33:32 pm »


               

I know about the lexicon, I just don't know how to code it. ._.



               
               

               
            

Legacy_Asymmetric

  • Sr. Member
  • ****
  • Posts: 289
  • Karma: +0/-0
Polymorph Shapechange Alteration
« Reply #3 on: March 10, 2016, 05:52:02 pm »


               

So if I understand correctly you want to change the appearance of the default polymorphs, after a character activates an item in its inventory.


 


The main problem will be finding out when the polymorph effect ends. Remember the players can end them at will and you have no way of detecting that, unless you use a heartbeat. Plus there are other, more severe issues. Say you change the appearance from a dynamic (e.g. human) to a non-dynamic type (say a dragon) with SetAppearanceType. The problem arises when you change it back to human: The character will have lost all customizations like head model, hair color, etc. So you would need to save all those values prior to changing the appearance and restore them when ending the polymorph and again it's kinda hard to detect when that happens.


 


It's possible to do it, but it will get very very messy. Maybe with a heartbeat script.


 


I recommend doing one the following instead:


 


1. Using the item directly


Using the item directly to apply a polymorph. You can then set the polymorph effect to locked and give it an infinite duration, which means the players can't end it themselves.


Upon activation you can save the head model and colors, then you polymorph and then you change the appearance. They could only end the polymorph effect by activating the item again, which solves the problem of not being able to detect when the effect ends. Then you can restore the appearance to the default polymorph one, then remove the polymorph effect and then restore the appearance (head model, hairs colors, etc) from the saved values.


Advantage: No 2da editing needed.


Disadvantage: A lot of scripting. Can be unsafe if not done properly = players can loose the appearance and colours, i.e. back to head #1, blonde hair and pale skin.


 


2 Custom hak with a modified polymorph.2da


Using a custom hak with a modified polymorph.2da. Add new polymorphs to it and then edit the spell scripts for wild shape and the polymorph spell (NW_S2_WildShape, NW_S2_ElemShape, X2_S2_GWildShp and NW_S0_ShapeChg).


Activating the item could set a variable on the character with a new polymorph ID from the modified 2da. When he uses one of the feats/spells you check for the variable and change the polymorph ID to the new one. Activating the item again deletes or overwrites the variable.


Advantage: Much safer. Players can end the polymorph at will from the menu. No need to save appearances and colours.


Disadvantage: You need to start using haks (if you're not already using them)


 


If haks are an option I would suggest using option 2. It's easier, safer and more comfortable for the players.



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Polymorph Shapechange Alteration
« Reply #4 on: March 10, 2016, 07:12:17 pm »


               

option 2 is better. yes!



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Polymorph Shapechange Alteration
« Reply #5 on: March 10, 2016, 09:25:45 pm »


               

Wait you can't even activate an item unless its potion in polymorph. At least without nwnx plugins like nwnx_patch. So activating after polymorph is out of the question.


 


Option 2 is definitely better if possible.


 


There is also third option and thats a nwnx plugin that offers to specifiy polymorph appearance and stats in an effect. I dont remember which plugin is it but I think its only available for linux anyway.


 



 


The main problem will be finding out when the polymorph effect ends. Remember the players can end them at will and you have no way of detecting that,



There is a way. Community Patch 1.72 offers scripted solution that implements a OnPrePolymorph/OnPolymorph/OnUnPolymorph and OnRePolymorph events, all without heartbeat and without NWNX. A psedo heartbeat is used only as a safety mechanism for a modules where the OnEquip and OnUnEquip events aren't set properly and this pseudo hb can be disabled.


 


Except this it fixes all the problems with polymorphs such as:


- temp hp replenish when repolymorph happen


- polymorph effect duration restart when repolymorph happen


- losing merged properties when repolymorph happen


- server crash when dying polymorphed with constitution bonus merged


- losing spellslots from ability score (and with nwnx also from bonus itemproperties)



               
               

               
            

Legacy_Asymmetric

  • Sr. Member
  • ****
  • Posts: 289
  • Karma: +0/-0
Polymorph Shapechange Alteration
« Reply #6 on: March 10, 2016, 10:10:05 pm »


               


Wait you can't even activate an item unless its potion in polymorph. At least without nwnx plugins like nwnx_patch. So activating after polymorph is out of the question.




 


Hmm you're right I forgot about that. I suppose for option 1 he'll have to skip on the polymorph effect and only use appearance change, maybe with a custom creature skin. That defeats the purpose though, so scrap option 1 basically .. or use a potion ? I don't know, not an easy task with a stock 1.69 NWN.


 


 


NWNX or Community Patch are the only other options then.

 


               
               

               
            

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
Polymorph Shapechange Alteration
« Reply #7 on: March 10, 2016, 10:11:40 pm »


               

Mmm.. all I really want to do is change the appearance of dragon shape to fiendish appearances. I don't want to mess around with the actual polymorph or the the stats at all. The dragon shape change will be reserved, just not the appearance.


 


So I have the player activate the item in their inventory to start it, I mean I could just have it be based on a chat command but I like the item idea better for the server I'm making this for. Once the item is activated; and if they -do- shape change into whatever(green, red, blue) dragon, it'll have it be something different. Like a pit fiend/balor/etc.


 


I'm stealing the idea from Sinfar because they do, "Wild shape" changes for players based on special request from trophies.


 


I'll have to use a heartbeat event to see when they unshift I guess. The community patch 1.72 you're talking about is CEP basically?


 


If you polymorph yourself, do you have to check if you're polymorphed in order to get an appearance or can you just do GetAppearanceType and have it send back what you're polymorphed into? Or will it send back your default player appearance is since being polymorphed technically isn't the same thing as "Appearance changed.." I'm confused >.>



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Polymorph Shapechange Alteration
« Reply #8 on: March 11, 2016, 12:20:08 am »


               

The appearance of the polymorph is set in polymorph.2da



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Polymorph Shapechange Alteration
« Reply #9 on: March 11, 2016, 12:15:48 pm »


               


Mmm.. all I really want to do is change the appearance of dragon shape to fiendish appearances. I don't want to mess around with the actual polymorph or the the stats at all. The dragon shape change will be reserved, just not the appearance.


 


So I have the player activate the item in their inventory to start it, I mean I could just have it be based on a chat command but I like the item idea better for the server I'm making this for. Once the item is activated; and if they -do- shape change into whatever(green, red, blue) dragon, it'll have it be something different. Like a pit fiend/balor/etc.


 


I'm stealing the idea from Sinfar because they do, "Wild shape" changes for players based on special request from trophies.


 


I'll have to use a heartbeat event to see when they unshift I guess. The community patch 1.72 you're talking about is CEP basically?


 


If you polymorph yourself, do you have to check if you're polymorphed in order to get an appearance or can you just do GetAppearanceType and have it send back what you're polymorphed into? Or will it send back your default player appearance is since being polymorphed technically isn't the same thing as "Appearance changed.." I'm confused >.>




Actually I don't know if its possible to use SetAppearance while polymorphed. Since others in this thread didn't mentioned it, I supposed it isn't. But give it a try. If it would have worked, probably all you need is to modify shapechange spellscripts and add this line with some small delay after applying the polymorph effect.


 


I expect that even if this would worked, repolymorph will restore old appearance but its a start.


 


To make this smoothless as possible you need to create a new polymorphs in polymorph.2da and just substitute polymorph ID when item was used prior to polymorph, or use nwnx/community patch to get OnPolymorph events where you can use SetAppearance.


               
               

               
            

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
Polymorph Shapechange Alteration
« Reply #10 on: March 11, 2016, 03:55:34 pm »


               

Thanks all, I think I got it to work with a pretty simple heartbeat script. It's clunky.. but at least it works, and when the player deshifts or dies they go back to their original form just fine. I'll have to refine it with the polymorph events if I can get those to work at some point in the future.



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Polymorph Shapechange Alteration
« Reply #11 on: March 13, 2016, 12:07:14 am »


               


Actually I don't know if its possible to use SetAppearance while polymorphed.




 


It is possible, but it is often best avoided to combine SetAppearance with EffectPolymorph due to data confusion.  The creature's base speed, creature size, and possibly a few other things can become mismatched when trying to use both at the same time.