Aller au contenu

Photo

Level-up script


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

#1
Laugh out loud

Laugh out loud
  • Members
  • 115 messages

I have a level-up script associated with a feat that is supposed to fire once when leveling-up.  However this one is firing when leveling-up, resting, entering another area, etc.  How would i adjust the on-level up script to make it so it fires only when leveling-up and no other time?



#2
Morbane

Morbane
  • Members
  • 1 883 messages

you will have to do a multitude of if statements that check for current exp for every evolution of class and race combinations - dont fret too much there are only like 60 of them

 

may be a simpler way but that jumped out at me first. 



#3
Morbane

Morbane
  • Members
  • 1 883 messages

yqlbgzsf.png



#4
Loki_999

Loki_999
  • Members
  • 430 messages

You mean after level up or before?

 

To make it happen before you would have to edit the XML to trap the level up button.

 

To make it fire after you just attach the script to the module's On Level Up event in the module properties. It shouldn't fire under other circumstances unless you attach the same script to multiple events.

 

How have you made the script trigger?



#5
Loki_999

Loki_999
  • Members
  • 430 messages

If you want to make the script only fire if they have the feat you mention, then do it in the on-level up script and use if (GetHasFeat(x)) 



#6
Laugh out loud

Laugh out loud
  • Members
  • 115 messages

I have it only in the OnLevelUp script and it has the if (GetHasFeat(x)) condition but, it seems once anyone in the party has the feat it fired when leveling up, when resting, when entering another area, etc.  I simply cannot explain why it is firing at all of these times when there is no reason for it to fire at these times.  I was wondering it there is a way to set a detectable interger that will control it so it will only fire when leveling up as I cannot see why it is firing these other times.

 

Here is a copy of the level-up script:

#include "x0_i0_henchman"
const int FEAT_X = 2847;
 
void main()
{
    object oPC =  GetPCLevellingUp();
    if(GetHasFeat(FEAT_X, oPC)>0)
 {
      ExecuteScript("feat_x", oPC);
 }
        LevelUpXP1Henchman(oPC);
      {
 }

}  



#7
Loki_999

Loki_999
  • Members
  • 430 messages

That is just completely bizarre then. We have an on level up script on our PW and it only fires when someone levels up.

 

Its really like you have the script firing due to something else causing it.... you didn't make the feat persistent and active did you? Then attach the level up script to that feat?



#8
Laugh out loud

Laugh out loud
  • Members
  • 115 messages

I made it persistant but not active.  I attached the script to a corresponding spell.



#9
Loki_999

Loki_999
  • Members
  • 430 messages

Hmm.. cound be the persistent flag triggering it then.

 

And from what i see, you don't need to attach the the feat to a spell to trigger the script.

 

The level up event will trigger the script anyway. The feat then is just a placeholder, something to check for that determines what should be done in the level up script.

 

So, if i understand things correctly, remove the spell reference from the feat and turn off persistent.

 

Do everything you need to do in the on level up script.