Author Topic: Anyone want to help with something a bit complicated?  (Read 1230 times)

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #15 on: April 09, 2015, 04:19:02 pm »


               

I forgot something, since I use nwnx_tmi: It's possible that you receive a TMI error message. If it's the case we'll divide the operations on two function calls.


 


 


Kato



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #16 on: April 09, 2015, 04:24:43 pm »


               

I'll give it a go!



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #17 on: April 09, 2015, 04:38:49 pm »


               

So after replacing my mod_onenter with the above script... any character that logs in is getting all the feats added to them whether they should have them or not. Basically only characters who have actually learned the feats from the books should have them. And they should only have the specific feats they learned not every single one of them.


 


EDIT: I can say after reloading a backup of the mod before the change and logging in with the previous test character they DID retain that entire list of epic spell feats! So persistence is there! Progress! Now we just have to make it so the system isnt just giving the feats away to everyone willy nilly and only applies the specific feats learned by the character.


 


Although... now I have to wonder... how the heck did that work? cause the backup mod I loaded didnt have the changes to the on enter script...



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #18 on: April 09, 2015, 05:22:15 pm »


               

I think I found another issue as well. This system allows the dynamic assigning of epic spells to the radial menu. When more than 7 epic spells are added to the menu it causes nwn to crash. The system is designed to avoid that by letting the player assign which epic spells they want to the radial and change them out when necessary, based on which spells they've successfully researched. Currently the test character that was granted all the feats is unable to change out her spells and ALL of the spells are on the radial (and thus cause a crash).


 


I believe this may be because the feats now seem permanently attached to the character. I think the way to address that issue is for only the "seed" feats and the "research" feats to be permanent. The system dynamically adds and removes the actual spell feats. I'm guessing this would result in a player having to reassign their epic spells each time they log in but that's a small inconvenience I can live with!


 


Here's the system for reference if you want to see how it all works in the demo:


 


(http://neverwinterva...lcasting-system)



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #19 on: April 09, 2015, 05:49:36 pm »


               

Hey Nic, unfortunately I don't have enough time to dissect both Boneshank's and Shayan's systems, but I hope I could nonetheless give you some insight on how to add/remove feats with nwnx_funcs.


 


 


Kato



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #20 on: April 09, 2015, 05:57:28 pm »


               

Well I've certainly made more progress with your help that's for certain. I appreciate you taking the time to give it a shot '<img'>



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #21 on: April 09, 2015, 06:06:22 pm »


               


Hey Nic, unfortunately I don't have enough time to dissect both Boneshank's and Shayan's systems, but I hope I could nonetheless give you some insight on how to add/remove feats with nwnx_funcs.


 


 


Kato




 


On last question if you don't mind? Is it possible to give the feats permanently using the client on_exit script rather than on_enter? Basically I was wondering if its possible for the client on exit script to see if the player has specific feats from the epic spell system on their pc skin and write those feats to the character permanently on log out. Maybe what I am saying doesnt make sense. I am asking because it seems that the feats were permanently granted via the on_enter script you gave me since the feats were present for the character when they loaded into a mod not using your on_enter. I just figured since the epic spell system naturally applies these feats to the pc skin, if there might be some way for the on_exit script to see those feats on the pc skin and apply them permanently to the pc on log out using your function. Maybe I am totally misunderstanding how what you did works. I figured it couldnt hurt to ask though.



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #22 on: April 09, 2015, 06:44:05 pm »


               

I think it's feasible indeed, we'll use the onplayerleaving script which you already integrated with nwnx_funcs. I'll conduct a few experiments and I'll get back ASAP with the code.


 


 


Kato



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #23 on: April 09, 2015, 06:57:28 pm »


               


I think it's feasible indeed, we'll use the onplayerleaving script which you already integrated with nwnx_funcs. I'll conduct a few experiments and I'll get back ASAP with the code.


 


 


Kato




 


Much obliged sir!


 


Even if the example is just checking for one specific feat on the pc skin and applying that feat on log out I can do the leg work to repeat it for each of the proper feats!


               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #24 on: April 09, 2015, 07:11:30 pm »


               

Here, that should do it for all feats applied as item properties on the PC hide.



#include "nwnx_funcs"

void main()
{
   object oPC = OBJECT_SELF;
   object oHide = GetItemInSlot(INVENTORY_SLOT_CARMOUR, oPC);
   itemproperty ip = GetFirstItemProperty(oHide);
   int nFeat;

   while(GetIsItemPropertyValid(ip))
   {
      if(GetItemPropertyType(ip) == ITEM_PROPERTY_BONUS_FEAT)
      {
         nFeat = StringToInt(Get2DAString("IPRP_FEATS", "FeatIndex", GetItemPropertySubType(ip)));
         if(!NWNXFuncs_GetFeatKnown(oPC, nFeat)) NWNXFuncs_AddFeat(oPC, nFeat);
      }
      ip = GetNextItemProperty(oHide);
   }
}

Kato



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #25 on: April 09, 2015, 07:20:09 pm »


               


Here, that should do it for all feats applied as item properties on the PC hide.



#include "nwnx_funcs"

void main()
{
   object oPC = OBJECT_SELF;
   object oHide = GetItemInSlot(INVENTORY_SLOT_CARMOUR, oPC);
   itemproperty ip = GetFirstItemProperty(oHide);
   int nFeat;

   while(GetIsItemPropertyValid(ip))
   {
      if(GetItemPropertyType(ip) == ITEM_PROPERTY_BONUS_FEAT)
      {
         nFeat = StringToInt(Get2DAString("IPRP_FEATS", "FeatIndex", GetItemPropertySubType(ip)));
         if(!NWNXFuncs_GetFeatKnown(oPC, nFeat)) NWNXFuncs_AddFeat(oPC, nFeat);
      }
      ip = GetNextItemProperty(oHide);
   }
}

Kato




 


So this goes into that onplayerleaving script or is it for the mod_onexit script?


 


I'm also a little fuzzy on the nFeat = StringToInt(Get2DAString("IPRP_FEATS", "FeatIndex", GetItemPropertySubType(ip))); part. How do I tell it which feats are ok to give and which to skip? Cause I dont want the actual spell feats being given to the pc permanently only the seeds and the research feats.



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #26 on: April 09, 2015, 07:38:20 pm »


               

Yes, the code goes in the onplayerleaving script.


 


The code line you mention retrieves the feat index from each feat item property applied on the hide. I don't know what are seeds and research feats and how to identify them, sorry.


 


 


Kato



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #27 on: April 09, 2015, 07:44:14 pm »


               


Yes, the code goes in the onplayerleaving script.


 


The code line you mention retrieves the feat index from each feat item property applied on the hide. I don't know what are seeds and research feats and how to identify them, sorry.


 


 


Kato




 


 


Ah here's what I mean:


 


These lines are from IPRP_FEATS.2da


 


This is one of the seed feats (which I DO want permanently given):


 


240    16833217 Epic_Seed_Afflict          1    4000


 


This is one of the spell feats (which I dont want permanently given):


 


269    16833317 ES_AchillesHeel            11   4030


 


This is one of the research feats (which I DO want permanently given):


 


340    16833318 ES_AchillesHeelR           11   4031


 


The reason I don't want the spell feats permanently given is because they must be able to be given and removed dynamically by the system. If given permanently, the system can't make the necessary adjustments. The system allows the dynamic giving and removing of the epic spell feats based on which research feats the player possesses.


 


basically only the feats from 240 to 268 AND 340 to 410 would be made permanent



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #28 on: April 09, 2015, 08:14:59 pm »


               

#include "nwnx_funcs"

void main()
{
   object oPC = OBJECT_SELF;
   object oHide = GetItemInSlot(INVENTORY_SLOT_CARMOUR, oPC);
   itemproperty ip = GetFirstItemProperty(oHide);
   int nFeat;

   while(GetIsItemPropertyValid(ip))
   {
      if(GetItemPropertyType(ip) == ITEM_PROPERTY_BONUS_FEAT)
      {
         nFeat = StringToInt(Get2DAString("IPRP_FEATS", "FeatIndex", GetItemPropertySubType(ip)));
         if(nFeat >= 240 && nFeat <= 268 || nFeat >= 340 && nFeat <= 410)
         {
            if(!NWNXFuncs_GetFeatKnown(oPC, nFeat)) NWNXFuncs_AddFeat(oPC, nFeat);
         }        
      }
      ip = GetNextItemProperty(oHide);
   }
}

That would translate to this.


 


 


Kato



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Anyone want to help with something a bit complicated?
« Reply #29 on: April 09, 2015, 08:19:01 pm »


               



#include "nwnx_funcs"

void main()
{
   object oPC = OBJECT_SELF;
   object oHide = GetItemInSlot(INVENTORY_SLOT_CARMOUR, oPC);
   itemproperty ip = GetFirstItemProperty(oHide);
   int nFeat;

   while(GetIsItemPropertyValid(ip))
   {
      if(GetItemPropertyType(ip) == ITEM_PROPERTY_BONUS_FEAT)
      {
         nFeat = StringToInt(Get2DAString("IPRP_FEATS", "FeatIndex", GetItemPropertySubType(ip)));
         if(nFeat >= 240 && nFeat <= 268 || nFeat >= 340 && nFeat <= 410)
         {
            if(!NWNXFuncs_GetFeatKnown(oPC, nFeat)) NWNXFuncs_AddFeat(oPC, nFeat);
         }        
      }
      ip = GetNextItemProperty(oHide);
   }
}

That would translate to this.


 


 


Kato


 




 


 


thanks! time to test!