Sanctuary

Make new spell for NPC to use. Have it change the Sanctuary flag. Use Sanctuary Calculator to figure out the numerical value.
 
Ok. what i did, made a spell the changed flag 20020 (death pos recall) to the value. but the spell couldnt be given in game to test it, so i made the NPC set the flag himself whille using an effect blueqipe spell on the player.

no what i would like to know, is how do i make the npc say variable stuf in its text.

like when players ask for healing. my formula is 123*target.level. how can i get him to say.
"I will need XXX gold peices for my services" ?
 
It's pretty hard to have a NPC saying un variable num value in his text. But not impossible using this method.
Hang on to your helmet:

You want your NPC to display the value of : 123*target.level
1) I store taht value in a temp Data named Lvl ( = Assign)
2) I Begin a loop from N=0 up to N=2 So It will show exactly 3 digits
3) Exp is my 10 pow data. I use it to decompose the value one digit after the other from left to right.
It's the opposite of N, if Nmax=5 then, Exp=5-N So, we have in my exemple Exp=2-N
4)The IF check if the first number on left is a 9, a_, a7 .... or a 0.
4-1) When it match a Saytext show that digit
4-2)Then we remove the left digit from the Lvl Data
5) Loop back to 2

Finaly if the value to display was 37 it will show 037 because it show exactly 3 digits.

Code:
Saytext( You may pay  )
    Lvl = 123*target.level
    FOR( N = 0 TO 2 )
        Exp = 2-var(N)
        IF( var(Lvl)>=9*(10^var(Exp)) )
            SayText( 9 )
            Lvl = var(Lvl)-9*(10^var(Exp))
        ELSE IF( var(Lvl)>=8*(10^var(Exp)) )
            SayText( 8 )
            Lvl = var(Lvl)-8*(10^var(Exp))
        ELSE IF( var(Lvl)>=7*(10^var(Exp)) )
            SayText( 7 )
            Lvl = var(Lvl)-7*(10^var(Exp))
        ELSE IF( var(Lvl)>=6*(10^var(Exp)) )
            SayText( 6 )
            Lvl = var(Lvl)-6*(10^var(Exp))
        ELSE IF( var(Lvl)>=5*(10^var(Exp)) )
            SayText( 5 )
            Lvl = var(Lvl)-5*(10^var(Exp))
        ELSE IF( var(Lvl)>=4*(10^var(Exp)) )
            SayText( 4 )
            Lvl = var(Lvl)-4*(10^var(Exp))
        ELSE IF( var(Lvl)>=3*(10^var(Exp)) )
            SayText( 3 )
            Lvl = var(Lvl)-3*(10^var(Exp))
        ELSE IF( var(Lvl)>=2*(10^var(Exp)) )
            SayText( 2 )
            Lvl = var(Lvl)-2*(10^var(Exp))
        ELSE IF( var(Lvl)>=1*(10^var(Exp)) )
            SayText( 1 )
            Lvl = var(Lvl)-1*(10^var(Exp))
        ELSE
            SayText( 0 )
        END IF
    END FOR
Saytext( Gold for this...)
 
Back