its doing the message #v(this.test) before you even set the this.test variable
NPC Code:
putnpc2 x,y,{
if(done){
message #v(this.test);
join class;
}
}
with(npcs[npcscount-1]){
this.test = 3;
callnpc npcscount-1,done;
}
might work or just try setting this.test on the putnpc2 part?