Aller au contenu

Photo

Anyone want to help with something a bit complicated?


  • Veuillez vous connecter pour répondre
39 réponses à ce sujet

#26
Nic Mercy

Nic Mercy
  • Members
  • 181 messages

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.



#27
Kato -

Kato -
  • Members
  • 392 messages

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



#28
Nic Mercy

Nic Mercy
  • Members
  • 181 messages

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



#29
Kato -

Kato -
  • Members
  • 392 messages
#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



#30
Nic Mercy

Nic Mercy
  • Members
  • 181 messages
#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!



#31
Nic Mercy

Nic Mercy
  • Members
  • 181 messages

Sadly it doesn't seem to be working. I tried to add it to mod on exit too. I'm guessing the skin is removed before the process can give the feats but I may have an idea on how to make it work.

 

Just for my information... this nwnx function that allows the granting of feats... this doesnt require the player to log out right? If that's the case couldnt I modify the feat granting part of the epic spellcasting system's scripts so it uses nwnx's function to grant the feat directly rather than apply it via a skin?



#32
Kato -

Kato -
  • Members
  • 392 messages

No need to log out with nwnx_funcs. Yes, you could replace the code to use nwnx_funcs to give feats, you'll most likely need to inspect several checks etc... but it's indeed feasible.

 

 

Kato



#33
Nic Mercy

Nic Mercy
  • Members
  • 181 messages

No need to log out with nwnx_funcs. Yes, you could replace the code to use nwnx_funcs to give feats, you'll most likely need to inspect several checks etc... but it's indeed feasible.

 

 

Kato

I'm going to give it the once over to see if I can do it myself. Would it be too much to ask if you could show me what a script would look like giving a single specific feat without referring to a pc skin? Then I'll have an idea of what it should look like when i am tweaking the existing system code.



#34
Kato -

Kato -
  • Members
  • 392 messages

You simply add the feat to PC, instead of adding a feat item property to the hide. Thus, you call the function NWNXFuncs_AddFeat(), passing the correct parameters. You can see some examples in my previous posts. As an additional advice, If you wish to learn coding/scripting, you'll find the lexicon 1.69 incredibly useful :)

 

 

Kato



#35
Nic Mercy

Nic Mercy
  • Members
  • 181 messages

You simply add the feat to PC, instead of adding a feat item property to the hide. Thus, you call the function NWNXFuncs_AddFeat(), passing the correct parameters. You can see some examples in my previous posts. As an additional advice, If you wish to learn coding/scripting, you'll find the lexicon 1.69 incredibly useful :)

 

 

Kato

 

I think ive got the idea :D thank you so much for being so patient with me and giving me examples :D



#36
Kato -

Kato -
  • Members
  • 392 messages

I'm glad I could help!

 

 

Kato



#37
Nic Mercy

Nic Mercy
  • Members
  • 181 messages

I'm glad I could help!

 

 

Kato

 

 

Huzzah it works!!! You're a prince! Thanks again!



#38
Nic Mercy

Nic Mercy
  • Members
  • 181 messages

So new question...

 

I am trying to make a conversation conditional. It compiles but it's not working for some reason and I'm at a loss as to why. My test character is a level 21 wizard with the Epic Spellcasting feat. So she should meet the conditions.

 

Here's the code

#include "inc_epicspells"

int StartingConditional()
{
object oPC = GetPCSpeaker();

if (!GetIsEpicCleric(oPC) || !GetIsEpicDruid(oPC) || !GetIsEpicSorcerer(oPC) || !GetIsEpicWizard(oPC)) return FALSE;

return TRUE;
}

Basically its supposed to check if the player is an epic caster of some sort (basically lvl 21 or higher in wizard, sorcerer, cleric or druid AND has my custom Epic Spellcasting feat)

 

For reference here's the definitions from the include

int GetIsEpicCleric(object oPC)
{
    if (GetLevelByClass(CLASS_TYPE_CLERIC, oPC) >= 21)
    if (GetHasFeat(FEAT_EPIC_SPELLCASTING, oPC))
        return TRUE;
    return FALSE;
}

int GetIsEpicDruid(object oPC)
{
    if (GetLevelByClass(CLASS_TYPE_DRUID, oPC) >= 21)
    if (GetHasFeat(FEAT_EPIC_SPELLCASTING, oPC))
        return TRUE;
    return FALSE;
}

int GetIsEpicSorcerer(object oPC)
{
    if (GetLevelByClass(CLASS_TYPE_SORCERER, oPC) >= 21)
    if (GetHasFeat(FEAT_EPIC_SPELLCASTING, oPC))
        return TRUE;
    return FALSE;
}

int GetIsEpicWizard(object oPC)
{
    if (GetLevelByClass(CLASS_TYPE_WIZARD, oPC) >= 21)
    if (GetHasFeat(FEAT_EPIC_SPELLCASTING, oPC))
        return TRUE;
    return FALSE;
}

I'm sure I just did it wrong in some small simple way :P



#39
Kato -

Kato -
  • Members
  • 392 messages

This is a somewhat different subject deserving a new thread, but no problemo, let's have a look. In the first code block you posted, replace || by &&, and it should do it.

 

 

Kato



#40
Nic Mercy

Nic Mercy
  • Members
  • 181 messages

This is a somewhat different subject deserving a new thread, but no problemo, let's have a look. In the first code block you posted, replace || by &&, and it should do it.

 

 

Kato

 

See its little stuff like this that trips me up! Thanks again Kato! It works now!