Jump to content
  • 0

bind at command for town only


Santafe

Question


  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   34
  • Joined:  06/01/13
  • Last Seen:  

Hello everyone,

I would like to request a bind at command to warp into a specific place like a mall using @mall, It warps to quiz_02 but it can only be used in towns, If used anywhere else it asks the player to be in a town.

Thanks and regards,

Santafe 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1678
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

-	script	mall_command	-1,{
OnMall:
	if(getmapflag(strcharinfo(3),mf_town)){
		warp "quiz_02",0,0;
	}else{
		message strcharinfo(0),"you have to be in town to use this command";
	}
end;
OnInit:
	bindatcmd("mall",strnpcinfo(3)+"::OnMall",0,99);
}

 

Edited by sader1992
mail to mall
  • Upvote 1
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Can't test it but this should do the job

 



prontera,119,42,0	script	AtCommand::alaatcom	HIDDEN_WARP_NPC,{
	end;
	
OnWarpAsked:

	freeloop 1;
	.@continue = 1;
	for( .@i = 0; .@i<getarraysize(.townMap$) && .@continue == 1; .@i++)
	{
		if(.townMap$[.@i] == strcharinfo(3))
		{
			.@continue = 0;
		}
	}
	freeloop 0;
	
	if(.@continue == 0)
	{
		warp .warpMap$, .warpX, .warpY;
	}
	else
	{
		dispbottom "[Warp System] You must be in town to use this command";
	}	
	return 1;

OnInit:
	bindatcmd "toquiz",strnpcinfo(3)+"::OnWarpAsked";
	.warpMap$ = "quiz_02";
	.warpX = 0;
	.warpY = 0;
	setarray .townMap$[0],"prontera","geffen","alberta"; //to fill
	end;
}

 

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   34
  • Joined:  06/01/13
  • Last Seen:  

6 hours ago, Alayne said:

Can't test it but this should do the job

 




prontera,119,42,0	script	AtCommand::alaatcom	HIDDEN_WARP_NPC,{
	end;
	
OnWarpAsked:

	freeloop 1;
	.@continue = 1;
	for( .@i = 0; .@i<getarraysize(.townMap$) && .@continue == 1; .@i++)
	{
		if(.townMap$[.@i] == strcharinfo(3))
		{
			.@continue = 0;
		}
	}
	freeloop 0;
	
	if(.@continue == 0)
	{
		warp .warpMap$, .warpX, .warpY;
	}
	else
	{
		dispbottom "[Warp System] You must be in town to use this command";
	}	
	return 1;

OnInit:
	bindatcmd "toquiz",strnpcinfo(3)+"::OnWarpAsked";
	.warpMap$ = "quiz_02";
	.warpX = 0;
	.warpY = 0;
	setarray .townMap$[0],"prontera","geffen","alberta"; //to fill
	end;
}

 

Hello, thanks for the scrip, the command works but i get this warning and debug everytime i use it :

[warning]: script:run_func:AtCommand at prontera (119,42)
[debug]: Source(NPC): AtCommand at prontera (119,42)

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

@sader1992 good point to you, didn't thought about using the mapflag ^^

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   34
  • Joined:  06/01/13
  • Last Seen:  

9 hours ago, sader1992 said:

-	script	mall_command	-1,{
OnMall:
	if(getmapflag(strcharinfo(3),mf_town)){
		warp "quiz_02",0,0;
	}else{
		message strcharinfo(0),"you have to be in town to use this command";
	}
end;
OnInit:
	bindatcmd("mall",strnpcinfo(3)+"::OnMall",0,99);
}

 

oh ma gerd works like a charm ty Sader <3 

@Alayne thanks for your help too <3

Edited by Santafe
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...