Looking for help; Teleport Script

I’m trying to create a teleport to party leader script but I am having trouble comparing the item activators level to getfactionleaders level. I know to use GetHitDice, but how exactly do I code this so the item activator only teleports to party leader if within 6 levels difference?

Ugh I know it’s simple, but I cannot figure this out. Any help would be great thank ya.

void main()
    object oPC = GetItemActivator();
    object oLEAD = GetFactionLeader(oPC);
    int nPC = GetHitDice(oPC);
    int nLEAD = GetHitDice(oLEAD);
    if (nPC > nLEAD + 6) return;
    if (nPC < nLEAD - 6) return;
    AssignCommand(oPC, JumpToObject(oLEAD));

Welcome to the Neverwinter Vault.


Going to go test this out. Thank ya for the quick reply!