Skip to content

Enemy Scaling on Percieve

Hello All
I am a long time player of NWN, but a dipping my toe into mod building community.

I am trying to create a game where the enemies scale to a predetermined level with the PC... but I'm having difficulty and wonder if you could help?

The action is called from the OnPerceive function and I think I want the NPC to get the PC's level and then add that plus X (let's say 5 for the sake of argument) to the NPC level.

I've tried using the latest iteration of Lilac Soul's script generator, but I can only give XP to the NPC, not levels.

Any ideas?

Thanks in advance
Skorum

Comments

  • ProlericProleric Member Posts: 1,316
    Use the LevelUpHenchman function (see Lexicon).
  • TarotRedhandTarotRedhand Member Posts: 1,481
    NwN Lexicon 1.69. Project page also has a link to the online version.

    TR
  • sunxresunxre Member Posts: 23
    Writing on android. So code will probably have auto correct madness, And inappropriate capitalisation. Also. There's like 3 different levelup scripts, and All are bugged/limited in 1 way or another. So I'm just going to assume it's limited.

    Keep in mind. Most of the level up scripts will only work if
    1. The creature has only been edited and leveled via the toolset level function using packages, and not manually.
    2. They are at level 1. You can freely edit them as much as you wish. And the function will still work.
    {
      Object self = OBJECT_SELF; 
      Switch(GetLocalInt(self, "hasleveled")(
      {
        case FALSE:
          object pc = GetLastPerceived();
          Int playerlevel;
          If(GetIsPlayer(pc)
          {
            Player level = GetHitDice(pc) - GetHitDice(self);
          }
          If(playerlevel)
          {
              while(playerlevel)
            {
              LevelUpHenchman(self/*, CLASS_TYPE_INVALID, TRUE, PACKAGE_INVALID //this parts optional */);
    //actual function LevelUpHenchman(object oCreature, int nClass = CLASS_TYPE_INVALID, int bReadyAllSpells = FALSE, int nPackage = PACKAGE_INVALID
              Playerlevel--;
            }
            SetLocalInt(self, "hasleveled", TRUE);
            DelayCommand(400.0, SetLocalInt(self, "hasleveled", FALSE)); //OPTIONAL. In case you want to re-level later.
          Break;
        }
      }
    }
    
Sign In or Register to comment.