Just messed around with this. It’s only a test thing really and I haven’t fully gone through it so it probably has fuckups in it.
I seen some post about a rent system or something and beholder made one, but I decided I would make one and kind of made it work like a class.
As I said before it’s not finished.
The main room handler thing
// NPC made by Chicken_l33t
if (created || playerenters) {
setshape 1,32,32;
save[0] = 5;
setstring save[1],Chicken,test,lol;
setstring save[2],Chicken,zomg,roflcopters;
}
if (actiontest){
for (a = 0; a < sarraylen(save[1]); a++){
if (strequals(#p(1),#I(save[#p(2)],a))){
if (strequals(#p(3),add)){
addstring save[#p(2)],#p(4);
setplayerprop #c,#p(4) has been added to permitted list.;
}
if (strequals(#p(3),remove)){
removestring save[#p(2)],#p(4);
setplayerprop #c,#p(4) has been removed to permitted list.;
}
if (strequals(#p(3),touch)){
setplayerprop #c,You may enter sir;
}
if (strequals(#p(3),check)){
setplayerprop #c,Current permitted: #s(save[#p(2)]);
}
return;
} else {
setplayerprop #c,Sorry you're not permitted to do this!;
}
}
}
// NPC made by Chicken_l33t
if (playerenters || created){
setshape 1,32,32;
this.room = 1;
save[1] = this.room;
}
if (playertouchsme) {
for (i = 0; i < npcscount; i++){
if (npcs[i].save[0] == 5){
triggeraction npcs[i].x,npcs[i].y,test,#v(npcs[0].id),#a,#v(this.room),touch;
}
}
}
if (playerchats){
if (strequals(#c,/room#v(this.room)check)){
for (i = 0; i < npcscount; i++){
if (npcs[i].save[0] == 5){
triggeraction npcs[i].x,npcs[i].y,test,#v(npcs[0].id),#a,#v(this.room),check;
}
}
}
if (startswith(/room#v(this.room)add,#c)){
for (i = 0; i < npcscount; i++){
if (npcs[i].save[0] == 5){
triggeraction npcs[i].x,npcs[i].y,test,#v(npcs[0].id),#a,#v(this.room),add,#e(10,35,#c);
}
}
}
if (startswith(/room#v(this.room)remove,#c)){
for (i = 0; i < npcscount; i++){
if (npcs[i].save[0] == 5){
triggeraction npcs[i].x,npcs[i].y,test,#v(npcs[0].id),#a,#v(this.room),remove,#e(12,35,#c);
}
}
}
}
if (actiontest2){
message Response from: #p(0);
}
To add new room/doors to rooms just change this.room = 1; to this.room = 2; to in a new NPC and if you go beyond that make sure to add a new string list in the main NPC.
and again it’s just a test NPC.
For the setting of a new level i’ll be using something like setlevel2 x,y,room#p(whateveritwasiforgot).nw