Author Topic: Creating a New Feat with a Submenu  (Read 727 times)

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
Creating a New Feat with a Submenu
« on: April 09, 2015, 02:54:09 pm »


               

So I'm trying to create a new feat that will give a Blackguard access to cast from one of four different spells 1/times per day. Basically, I want a feat like the spell Shadow Conjuration - where someone can quickslot the spell(s) they want to cast, if they like.


 


I ended up using the Player Tool 10 feat, setup four lines below it the feats.2da for each of the spells, and then setup 5 new lines in the spells.2da for the feat itself and each of the 4 new spells (not sure if the spell for the feat is really needed...but that is how the horse menu is setup so I just followed suit).


 


Then I used Leto to give the Player 10 feat to the test PC.


 


The feat does show up in the PC's radial menu, and when I click on it, the submenu of 4 spells/feats appears as well.


 


BUT, no matter what spell I then click on in the submenu to either cast or quickslot, it always takes the spell feat in the feats.2da directly below the Player Tool 10 line.


 


I've fought with this for several hours of testing, revision, and more testing. But no luck. I guess my questions are -


1. Is it even possible to create a new radial menu feat in NWN?


2. How much of the radial menu is hardcorded, and how much can I/we control via haks? I ask because I couldn't even get this far without using one of the pre-created Player Tools feats. A custom feat wouldn't show up at all in the radial menu even when assigned with nwnx_funcs or Leto. Is this intended, or am I missing some radialmenufeat.2da or some other file that controls what appears in the radial menu?


 


If anyone who's willing to help wants to have the small test hak (it only has my modified feats and spells.2das in it), module, and character I've been testing with I'm more than happy to package it all up and make it available.



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Creating a New Feat with a Submenu
« Reply #1 on: April 09, 2015, 08:22:49 pm »


               

Yes. It's possible.  I believe it only requires spells.2da and feat.2da (and probably tlk lines for completeness).


 


The feat.2da part is pretty straight forward and sounds like you have that.


 


I assume you put the spell IDs of the sub radial spells in the for the base spell in the various sub radial columns?


And set the master column of the sub spells to the line of the base spell?


 


The tricky bit is the featID you use for the spell lines of the sub spells. What did you put there?


If I recall some of the documentation about that I found when searching was completely bogus.


               
               

               
            

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
Creating a New Feat with a Submenu
« Reply #2 on: April 10, 2015, 12:25:23 am »


               

thanks for the response. It's good to know that I am (hopefully) not wasting all this effort on a lost cause. The 'Master' column of the spells.2da for each of the individual sub-radial spells does have the number of the 'master' spell (840 for Player Tool 10, in this case) spell IDs. In the feats.2da I have the SPELLID for each of the spells pointing back to their corresponding number in the spells.2da as well.


 


One thing I noticed is that in the spells.2da, there is a FeatID column which I have pointing to the ID for each of these new spell feats in the feats.2da. HOWEVER, when I look up at the 'spells' in the spells.2da for other radial menu spells, like the horse menu 'spells', they contain numbers that are obviously not referencing anything in the feats.2da. For example, the Horse_Dismount spell has a FeatID of 71435052...but my feats.2da only goes up to line 1119 (and that's including the new lines I added). I'm also noticing a pattern here too because other spells like the wildshape feat spells -which are also sub-radial menus- all have these huge number!


 


So I'm wondering if the huge numbers in that FeatID field of the spells.2da might be the key and, if so, what in the heck are those huge numbers...?



               
               

               
            

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
Creating a New Feat with a Submenu
« Reply #3 on: April 10, 2015, 01:07:06 am »


               

Yup, the FeatID was it. I dunno who figured this out, or if some Bioware insider showed the community a bit of love and let the formula out, but the post from Kaedrin reposted by MasterChanger explained what that FeatID number is and how to generate it:   65536 * Subradial_Number + FeatId


 


http://forum.bioware.../#entry14911664


 


 


Complicated to say the very least, but it works.



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Creating a New Feat with a Submenu
« Reply #4 on: April 10, 2015, 01:08:48 am »


               

That's the part I was talking about...   Those are special.


 


The high order 16 bits need to be a unique number within that subradial for each.  The low order 16 bits are the feat id (row number) of the master feat.


 


I find it easiest to use a programming calculator and translate them to hex to see what it really looks like. In my system I have several new radials. One is turn undead which has three types of turn. Here is what that looks like:


 


1200  dispel_turning     ....  524288294


 


I plug that into a calculator and convert to hex  0x1f400126 which can be split up  into 1f40    0126. If we take each half and convert back to decimal we get  8000 and 0294. Note that 294 is the master feat for turn undead.  8000 is my choice. All three of them look like this :


                                              FeatID           in hex             split in decimal.

        dispel turning            524288294    1f40 0126      8000 0294

        bolster/weaken          524353830    1f41 0126      8001 0294

        turn/rebuke undead  524419366    1f42 0126     8002 0294

 


I use 8000, 8001 etc for all of mine. It seems not to matter as long as they are different within the radial menu. The documentation actually says those should be unique as well but they are there to make sure the actual FeatID value is different for the different subradial items.  Don't go by the horse menu ones because they are not right. I'm not actually sure how those are working.


 


They look like this - the first part is the preceeding feat row and the 812 is the main horse spell:


mount      71369516        0441  032c   1089  812   

dismount   71435052        0442  032c   1090  812


 



Georg Zoeller     How to create sub radials like wildshape

With HotU, we move the handling of subradial feats from hardcoded to 2da.

This is a short tutorial on how to do a subradial feat, as it is not as

trivial as adding just a normal feat [/icon_wink.gif]

Steps

1) Enter the feat in the class feat 2DA as normal.

2) Create the master feat in Feats.2da. Set the SPELLID to be the spell

number of the master spell.

3) Create the master spell in Spells.2da. Set the SubRadSpell1-5 numbers to

point to the sub spells for the feat.

4) Set the FEATID on each of the subspells as follows: (65536 * subfeat) +

feat ID. The top 16 bits is used for subfeat, the bottom for feat.

Basically any feat that uses a spell that has subspells listed will be

turned into a radial menu.

Subfeat number selection is up to you, I would suggest starting around 5000

or so and going up from there. Current internal subfeat numbers go from

1000 to about 1012, avoid those.

Bioware used subfeat numbers so far

Spell Label FeatID Used SubfeatID

658 Wild_Shape_Wyrmling_Red 327746434 5001 * 65536 + 898

659 Wild_Shape_Wyrmling_Blue 327811970 5002 * 65536 + 898

660 Wild_Shape_Wyrmling_Black 327877506 5003 * 65536 + 898

661 Wild_Shape_Wyrmling_White 327943042 5004 * 65536 + 898

662 Wild_Shape_Wyrmling_Green 328008578 5005 * 65536 + 898



You can find the whole post in the Omnibus by searching for FeatID.


 


This is a bit redundant now as you've already found it '<img'>



               
               

               
            

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
Creating a New Feat with a Submenu
« Reply #5 on: May 10, 2015, 10:44:43 pm »


               

So as a follow-up to this, I've now been playing around with my subradial feats a bit but have run into another snag. It appears the TARGETSELF column in the feats.2da will only work for the Master feat, and it applies that to the subradial options underneath it. This causes a problem because some of the spells I want to give in the radial menu are meant to be either cast against an opponent *or* on the caster himself.


 


Is there some way that I'm missing so that I can get the spells on this subradial menu to assume their default targeting behavior as they are setup the spells.2da?


 


 


Edit: OK, I may have made some headway on this. It appears I can get the TargetType value in the spells.2da to affect what this is targeted on. I still cannot get personal spell sto instantly cast themselves though. However, if I can figure out the TargetType for self only, I guess that will be good enough. But my new problem is though that the TargetType seems to be different for these spells than the other. For example, a TargetType of 0x01, which should be for self only, still allows a person to cast what should be personal-only spells on another creature (no other objects can be targeted however). So is there anyone who knows or has another suggestion for the TargetType of Self *only* in the spells.2da?



               
               

               
            

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
Creating a New Feat with a Submenu
« Reply #6 on: May 11, 2015, 09:31:35 pm »


               

Yesterday I ended up trying all the different TargetType hex values in the spells.2da for these spells which are cast via feat. While I could limit what they could be cast on there is definitely something else in play here because these spells all require a creature target. Even if the cursor shows up as though you are OK to cast it in an open space, when you click to cast it does nothing - no animation and especially no spell script gets fired. But if you target the PC or another creature, they do cast. I have been unable to find the right TargetType vale to turn off creature targeting, but leave PC targeting.


 


Is there anyone out there who has created a spellcasting radial menu feat before, or anyone who might know what the problem(s) is here?



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Creating a New Feat with a Submenu
« Reply #7 on: May 11, 2015, 09:36:59 pm »


               

I don't believe you can have two types of targets in the same radial menu. You'll have to design it so that all of the target types for feats in one subradial have the same target type as the master.



               
               

               
            

Legacy_ShadowM

  • Hero Member
  • *****
  • Posts: 1373
  • Karma: +0/-0
Creating a New Feat with a Submenu
« Reply #8 on: May 11, 2015, 11:26:20 pm »


               

There is no specific pc only target type, only creatures ( pc included) you have to run the check through the spell script/function. You need to look at target range for personal and target type set as self. For the instant if it a sub radial the feat has to be instant if run the spell through the feat. You have to break your feats into target self and target. This save on confusion. Look at my HR BASE for some good examples. I in the process of updating my spell.2da target type for my sub-radial feats. Tlkedit is a good editor to see target and range type in a drop down menu. Hope this helps get you on the right track.


Target types:


Self


Creature


Area / ground


Items


Doors


Placables


Trap / triggers



               
               

               
            

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
Creating a New Feat with a Submenu
« Reply #9 on: May 12, 2015, 12:19:16 am »


               

Ok. Thanks for the replies. For these spells that I'm concerned with I do have target Range field set to Personal and TargetType field set to Self in the spells.2da. But unless the TARGETSELF field in the feats.2da is set to 1 for the master feat, they will not cast automatically when clicked - they still require the PC to click on him or herself to cast it. While I could live with that, what really bugs me is even though the TargetType is set to Self for those spells, apparently something with how feats (this feat or all feats) is setup still allows the PC to target another creature with it.


 


But I guess I will admit defeat and change the radial so that the spells are all personal self-only, or else all targetable. Kinda disappointing, but I'll get over it.


 


Thanks again.



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Creating a New Feat with a Submenu
« Reply #10 on: May 12, 2015, 02:48:09 am »


               


O But unless the TARGETSELF field in the feats.2da is set to 1 for the master feat, they will not cast automatically when clicked - they still require the PC to click on him or herself to cast it.




 


This is kinda my point. Basically you have to treat all feats the same as far as targeting goes. I do not believe there is a way around that.