Jump to content
  • 0

Disabling & Enabling NPC


ToiletMaster

Question


  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  276
  • Reputation:   7
  • Joined:  08/11/12
  • Last Seen:  

Hi there,

Currently what i'm trying to do is enable a npc once the map users is 0.

i've set to the last sentence of my npc to be

disablenpc strnpcinfo(0);
close;

And on the top i'm placing this

sm_pri,11,10,4	script	Grandma	2339,{		

	if (getmapusers("sm_pri") == 0) {
	enablenpc strnpcinfo(0);
	}

However once the map doesn't have any users left. it still remains disabled. i'm trying to make it once the map becomes 0 people it'll automatically enable the npc.

What am i doing wrong here?

(On a side note: Awesome map syouji ! thanks!)

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

if you can click that npc (''Grandma'') that's mean you're standing on sm_pri

so getmapusers("sm_pri") will not be 0.

or

if you disable npc, then you can't click that npc to make it enable.

or

if that npc disable by itself, then it can't enable itself cause its status is disable.

Edited by goddameit
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

-    script    sdflsdflksjdfldj    -1,{
OnInit:
   while (1) {
       if ( getmapusers("guild_vs2") )
           disablenpc "test_warp";
       else
           enablenpc "test_warp";
       sleep 5000;
   }
   end; // shouldn't reach
}
prontera,155,180,5    script    test_warp    45,1,1,{
   warp "guild_vs2", 0,0;
   disablenpc strnpcinfo(0);
   end;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  276
  • Reputation:   7
  • Joined:  08/11/12
  • Last Seen:  

if you can click that npc (''Grandma'') that's mean you're standing on sm_pri

so getmapusers("sm_pri") will not be 0.

or

if you disable npc, then you can't click that npc to make it enable.

or

if that npc disable by itself, then it can't enable itself cause its status is disable.

Thanks for the information. However what i was trying to do was once the npc is disabled, then once the player leaves the map for another person to enter, the npc enables back.

The player itself won't interact with that npc anymore once it's disabled.

Because in one part of my script someone actually dies, so i need to disable him and once he leaves, it'll enable back by itself. Once he finishes up in there (about another 2-3 minutes) he'll be warped out of the map. That map can only have 1 person so why i'm thinking this is possible

-	script	sdflsdflksjdfldj	-1,{
OnInit:
while (1) {
	if ( getmapusers("guild_vs2") )
		disablenpc "test_warp";
	else
		enablenpc "test_warp";
	sleep 5000;
}
end; // shouldn't reach
}
prontera,155,180,5	script	test_warp	45,1,1,{
warp "guild_vs2", 0,0;
disablenpc strnpcinfo(0);
end;
}

Thanks annie! This is one part of what i wanted it to be thanks! However i can't seem to get it to work on my end. Once my npc becomes disabled and i warp out of the map it doesn't enable itself.

I kinda edited to make it look like this

-	script	sdflsdflksjdfldj	-1,{
OnInit:
if ( getmapusers("sm_pri") )
enablenpc "Grandma";
}
end; // shouldn't reach

Since my 1st NPC is gonna disable itself, i just need it to enable itself once the map gets filled with 1 person. but it still doesn't work.

Appreciate the help thanks alot!

Edited by ToiletMaster
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...