Jump to content
  • 0
celeron0134

npc that checks cells if there's already a player on that cell

Question

Hii good day.. is there a way for example the NPC is located at quiz_02 238 379.. and this NPC will only work if you are only on this cell - quiz_02 237 378 .. if you are outside of the cell you can still click the NPC but it will just say that you need to be in front of me,,  and count players on the cell.. only 1 player at a time can be on the cell with a time limit of 10mins after 10 mins warp to quiz_02 246 376

 

NPClocation - quiz_02 238 379

CellworkAllow - quiz_02 237 378

Checkcellusers - 1 per cell.. if 2 warp player on quiz_02 246 376

if not on CellworkAllow - mes"you need to be in front of me";

if you are on CellworkAllow && if checkcellusers = 1 mes"i am talking to someone right now try again later";

Celltimelimit - 10minutes - On10mins

On10mins - mes"ok enough talk i will be warping you now" - warp quiz_02 246 376

end; =D

 

 

Share this post


Link to post
Share on other sites

13 answers to this question

Recommended Posts

  • 0

If getmapxy("quiz_02",237,378){

warp ......

}

Share this post


Link to post
Share on other sites
  • 0

Use areawarp to create a specific cell 

Guide

*areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};

This command is similar to 'warp', however, it will not refer to the invoking
character, but instead, all characters within a specified area, defined by the
x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
including the activating character, if they are outside the area.

	areawarp "place",10,10,120,120,"place2",150,150;

Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
shape, on the map called "place", will be affected, and warped to "place2" X 150
Y 150

	areawarp "place",10,10,120,120,"place2",0,0;

By using ,0,0; as the destination coordinates it will take all the characters in
the affected area to a random set of co-ordinates on "place2".

	areawarp "place",10,10,120,120,"place2",150,150,200,200;

By using the optional x4 and y4 parameters, the destination coordinates will be a
random place within the defined x3/y3-x4/y4 square.

Like 'warp', areawarp will also explicitly warp characters randomly into the
current map if you give the 'to map name' as "Random".


 

Share this post


Link to post
Share on other sites
  • 0
On 1/28/2021 at 12:36 PM, Poring King said:

Use areawarp to create a specific cell 

Guide

*areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};

This command is similar to 'warp', however, it will not refer to the invoking
character, but instead, all characters within a specified area, defined by the
x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
including the activating character, if they are outside the area.

	areawarp "place",10,10,120,120,"place2",150,150;

Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
shape, on the map called "place", will be affected, and warped to "place2" X 150
Y 150

	areawarp "place",10,10,120,120,"place2",0,0;

By using ,0,0; as the destination coordinates it will take all the characters in
the affected area to a random set of co-ordinates on "place2".

	areawarp "place",10,10,120,120,"place2",150,150,200,200;

By using the optional x4 and y4 parameters, the destination coordinates will be a
random place within the defined x3/y3-x4/y4 square.

Like 'warp', areawarp will also explicitly warp characters randomly into the
current map if you give the 'to map name' as "Random".


 

Areawarp will warp all players .. what i need is for example.. Healer NPC --- to be able to use heal you need to be in front of the Healer NPC which is "that" specified Cell so when you go to that Specified Cell you can use the Healer NPC.. another thing is when another player is already on the Specified cell and you want to use the Healer NPC.. you have to wait X minutes "OR" wait for the Specified Cell to be empty

 

this is the example code i tried to explain

quiz_02,238,379,5	script	Healer NPC	811{

if(checkcelluser(.cell) = 1 ) {
	mes "Wait for 1 min , i am healing someone";
	close;

if(checkcelluser(.cell) = 2) {
	mes "wait a second, there's two of you standing on front of me";
	warp the last player who tries to enter the specified cell ( quiz_02 246,376 )
	
if(checkcelluser(.cell) = 0 ) {
	mes "Hello there i will be able to heal you";
	mes "but please do come in front of me";
	close;

if(checkcelluser(.cell) = 1 & it is strcharinfo(0) or the invoking character
		specialeffect2 EF_HEAL2;
		percentheal 100,100;

OnTimer60000: (Anti AFK)
	if checkcelluser(.cell) = the character who is currently using the cell
	mes " alright you have used your time";
	mes " i will be warping you "; 
	warp quiz_02 246,376;

OnTimer2500: (updates the cell every 2.5 secs for cellcount)
	update checkcelluser(.cell)
	if cellcount(.cell) == 1 {end}
	if cellcount(.cell) == 2 {goto the 2nd if(<condition>)
        

Oninit:
	set .cell,quiz_02,238,379;
	
end;
}

 

Share this post


Link to post
Share on other sites
  • 0

My bad . If im gonna do this i will use ontouch not tested but i hope you will get the idea if its not working if im gonna test this i can fix this on a decent code 

 

prontera,x,y,3	script	Healer	99,1,1{

OnTouch:
	if (.Talk == 1 ){
		mes "Sorry someone already using my service";
		end;
	}
	set .Talk,(.Talk +1);
	set #started, 1;
	initnpctimer;
	end;


OnTimer60000:// Add points Every Minute	
				if (checkvending() >= 1 ) {
					dispbottom "Healing Time stopped because you were vending. Talk to me if you wish to start again.";
					set #started, 0;
					stopnpctimer;
					end;
				}
				if (checkchatting() == 1 ){
					dispbottom "Healing Time stopped because you were not talking. Talk to me if you wish to start again.";
					set #started, 0;
					stopnpctimer;
					end;
				}
				if (checkidle()>=.idlelimit){
					dispbottom "Healing Time stopped because you were idle. Talk to me if you wish to start again.";
					set #started, 0;
					stopnpctimer;
					end;
				}
                dispbottom "Your healing time has been started!";
                specialeffect2 EF_HEAL2;
                percentheal 100,100;
				end;

OnInit:
	stopnpctimer;
	set .Talk,1;
	end;
}

 

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, Poring King said:

My bad . If im gonna do this i will use ontouch not tested but i hope you will get the idea if its not working if im gonna test this i can fix this on a decent code 

 

prontera,x,y,3	script	Healer	99,1,1{

OnTouch:
	if (.Talk == 1 ){
		mes "Sorry someone already using my service";
		end;
	}
	set .Talk,(.Talk +1);
	set #started, 1;
	initnpctimer;
	end;


OnTimer60000:// Add points Every Minute	
				if (checkvending() >= 1 ) {
					dispbottom "Healing Time stopped because you were vending. Talk to me if you wish to start again.";
					set #started, 0;
					stopnpctimer;
					end;
				}
				if (checkchatting() == 1 ){
					dispbottom "Healing Time stopped because you were not talking. Talk to me if you wish to start again.";
					set #started, 0;
					stopnpctimer;
					end;
				}
				if (checkidle()>=.idlelimit){
					dispbottom "Healing Time stopped because you were idle. Talk to me if you wish to start again.";
					set #started, 0;
					stopnpctimer;
					end;
				}
                dispbottom "Your healing time has been started!";
                specialeffect2 EF_HEAL2;
                percentheal 100,100;
				end;

OnInit:
	stopnpctimer;
	set .Talk,1;
	end;
}

 

the Ontouch: function still lets you use the NPC even you are far away from the NPC..  also on Ontouch you can be any 1 cell around the NPC.. it should be on a specific cell ... is there a script command for check cell? check cell users? and function for a specific cell? 

Share this post


Link to post
Share on other sites
  • 0

 

38 minutes ago, celeron0134 said:

the Ontouch: function still lets you use the NPC even you are far away from the NPC..  also on Ontouch you can be any 1 cell around the NPC.. it should be on a specific cell ... is there a script command for check cell? check cell users? and function for a specific cell?

.....

13 hours ago, botka4aet said:

IF getmapxy (" quiz_02 ", 237,378) {

 ......

}

Edited by botka4aet

Share this post


Link to post
Share on other sites
  • 0
29 minutes ago, botka4aet said:

 

.....

thank you.. but can you make the script? ill try too

Share this post


Link to post
Share on other sites
  • 0
quiz_02,238,379,5	script	Healer NPC	811{

IF (getmapxy (" quiz_02 ", 237,378) != 0) {

mes "-You too far from NPC and can't talk-"; close;

}

.cell = getareausers(" quiz_02 ", 237,378, 237,378);

if(.cell > 1) {
	mes "wait a second, there's two of you standing on front of me";
close2;
	warp ( "quiz_02", 246,376 )
	}
else{
	specialeffect2 EF_HEAL2;
	percentheal 100,100;
close2;
sleep2 60000;
 IF (getmapxy (" quiz_02 ", 237,378) = 0) {
warp quiz_02 246,376;
}

}
end;

}
  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0
On 1/28/2021 at 8:40 PM, botka4aet said:
quiz_02,238,379,5	script	Healer NPC	811{

IF (getmapxy (" quiz_02 ", 237,378) != 0) {

mes "-You too far from NPC and can't talk-"; close;

}

.cell = getareausers(" quiz_02 ", 237,378, 237,378);

if(.cell > 1) {
	mes "wait a second, there's two of you standing on front of me";
close2;
	warp ( "quiz_02", 246,376 )
	}
else{
	specialeffect2 EF_HEAL2;
	percentheal 100,100;
close2;
sleep2 60000;
 IF (getmapxy (" quiz_02 ", 237,378) = 0) {
warp quiz_02 246,376;
}

}
end;

}

thanks ill try this.. but suddenly my map server crashes idk what happened.. i tried to disable all the NPCs on the custom.conf and still map server crashes

@botka4aet im getting errors..  simple errors at first like unmatched ")" , needs ; or ,   but at the end  

[warning] script: buildin_getmapxy mapname is not a variable .. unexpected type of argument.. kindly fix the script thanks

@botka4aet any update to this?? script not working

Share this post


Link to post
Share on other sites
  • 0

here there is 3 version for the script

1st is npc automatic timer since script loaded.

quiz_02,238,379,0	script	Auto Warper	112,{
	mes "["+ strnpcinfo(0) +"]";
	mes "Please stand in front of me to be warped";
	close;

OnTimer600000:
	[email protected] = getareausers("quiz_02", 237, 378, 237, 378);
	if ([email protected] < 1)
		end;
	if ([email protected] == 1)
		warp "quiz_02", 246, 376;
	else
		npctalk "Too many people in front of me, only one person will be teleported in next 10 minute.";
	initnpctimer;
	end;

OnInit:
	initnpctimer;
	end;
}

2nd is timer started by player when used.

quiz_02,238,379,0	script	Auto Warper	112,{
	mes "["+ strnpcinfo(0) +"]";
	if (.user)
	{
		[email protected]$ = strcharinfo(0, .user);
		if ([email protected]$ != "")
		{
			mes "Someone is using my service right now, please come again later.";
			close;
		}
		stopnpctimer;
		.user = 0;
	}
	getmapxy([email protected]$, [email protected], [email protected], BL_PC);
	if ([email protected] != 237 && [email protected] != 378)
	{
		mes "Please stand in front of me to be warped.";
		close;
	}
	[email protected] = getareausers("quiz_02", 237, 378, 237, 378);
	if ([email protected] > 1)
	{
		mes "Too many people in front of me, only one person will be teleported in next 10 minute.";
		close;
	}
	.user = getcharid(0);
	initnpctimer;
	mes "Please wait for 10 minute to be warped.";
	close;

OnTimer600000:
	stopnpctimer;
	[email protected] = getmapxy([email protected]$, [email protected], [email protected], BL_PC, strcharinfo(0, .user));
	.user = 0;
	if ([email protected] != -1 && [email protected]$ = strnpcinfo(4) && [email protected] == 237 && [email protected] == 378)
		warp "quiz_02", 246, 376, .user;
	end;
}

3rd is using sleep,

quiz_02,238,379,0	script	Auto Warper	112,{
	mes "["+ strnpcinfo(0) +"]";
	if (.user)
	{
		[email protected]$ = strcharinfo(0, .user);
		if ([email protected]$ != "")
		{
			mes "Someone is using my service right now, please come again later.";
			close;
		}
		.user = 0;
	}
	getmapxy([email protected]$, [email protected], [email protected], BL_PC);
	if ([email protected] != 237 && [email protected] != 378)
	{
		mes "Please stand in front of me to be warped.";
		close;
	}
	[email protected] = getareausers("quiz_02", 237, 378, 237, 378);
	if ([email protected] > 1)
	{
		mes "Too many people in front of me, only one person will be teleported in next 10 minute.";
		close;
	}
	.user = getcharid(0);
	[email protected] = 10 * 60000;
	mes "Please wait for 10 minute to be warped.";
	sleep2 [email protected];
	close2;
	.user = 0;
	warp "quiz_02", 246, 376, .user;
	end;
}

 

Share this post


Link to post
Share on other sites
  • 0

@Litro Endemic tried the 3rd script.. the problem is you can still talk to the NPC when you are not in the cell.. but it shows a pattern on which you can talk to the NPC.. a Plus (symbol) Cells from the allowable Cell.. meaning if you are on the left, right, up and down from the point where the Allowable Cell is located.. 

 

capture(4).png

 

@Litro Endemic

quiz_02,246,374,4	script	Auto Warper	112,{

	[email protected] = getareausers("quiz_02", 246, 372, 246, 372);

	if ([email protected] < 1) {
	mes "["+ strnpcinfo(0) +"]";
	mes "Please stand in front of me to be warped";
	close;
}

	if ([email protected] == 1)
	mes "["+ strnpcinfo(0) +"]";
	mes "Congrats you are now in front of me";
	close;
	}else{
		npctalk "Too many people in front of me, only one person will be teleported in next 10 minute.";
	end;

}

 

Now the 1st script works - the only problem if im on the specified cell .. other players outside the cell can now talk to the NPC

Share this post


Link to post
Share on other sites
  • 0
13 hours ago, celeron0134 said:

@Litro Endemic

quiz_02,246,374,4	script	Auto Warper	112,{

	[email protected] = getareausers("quiz_02", 246, 372, 246, 372);

	if ([email protected] < 1) {
	mes "["+ strnpcinfo(0) +"]";
	mes "Please stand in front of me to be warped";
	close;
}

	if ([email protected] == 1)
	mes "["+ strnpcinfo(0) +"]";
	mes "Congrats you are now in front of me";
	close;
	}else{
		npctalk "Too many people in front of me, only one person will be teleported in next 10 minute.";
	end;

}

 

Now the 1st script works - the only problem if im on the specified cell .. other players outside the cell can now talk to the NPC

Then just simple add some 

 

    // Check if there is someone talking to NPC
	if (.Talk >1){
        end;// End if you don't want to show dialog just disable player to talk
    }
	if ([email protected] == 1)
	mes "["+ strnpcinfo(0) +"]";
	set .Talk,(.Talk+1);
	mes "Congrats you are now in front of me";
	close;
	}else{
		npctalk "Too many people in front of me, only one person will be teleported in next 10 minute.";
	end;

OnInit:
		set .Talk,0;
		end;

 

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
On 1/31/2021 at 9:50 AM, Poring King said:

Then just simple add some 

 

    // Check if there is someone talking to NPC
	if (.Talk >1){
        end;// End if you don't want to show dialog just disable player to talk
    }
	if ([email protected] == 1)
	mes "["+ strnpcinfo(0) +"]";
	set .Talk,(.Talk+1);
	mes "Congrats you are now in front of me";
	close;
	}else{
		npctalk "Too many people in front of me, only one person will be teleported in next 10 minute.";
	end;

OnInit:
		set .Talk,0;
		end;

 

the problem here is when you're on the Specified Cell,, and not talking on the NPC .. other players can still talk to the NPC

 

  something like this .. 
	if (([email protected] == 1) && (strcharinfo(0) != [email protected]))
	mes "someone is on front of me";
	mes "and i am waiting for him/her to talk to me";
	mes "wait till the player leave the cell";
	end;

 

also.. if i use



switch(select("Let's Talk:Leave")) {
	case 1:
		mes"congrats we talked";
		end;
}
	close;
}

and clicked the cancel button on the window.. instead of the switch(Leave)

.talk will always be 1 .. meaning it will always be .talk >1

	if (.Talk >1){
        end;// End if you don't want to show dialog just disable player to talk
    }

 

is this impossible?? hmm.. i tried

 

if (([email protected] == strcharinfo(o)) 
if (([email protected] == BL_PC) 
if (([email protected] == getcharid(0)) 

still failed

Share this post


Link to post
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...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.