Jump to content
  • 0

Allow use of specific atcommand when talking to NPC


Question

Posted (edited)

I'm currently having issue with character being stucked while talking to a NPC and suddenly clicking ESC key.

IDK if it's because of client problem(2013-12-23), because I tested it on 2015-11-04 client and when pressing ESC key the NPC dialogue doesn't disappear.

I'm currently facing the issue with the default warper(npc/custom/warper.txt) and default stylist(npc/custom/stylist.txt) without them being modifed.

ANYWAYS since I have googled several issues about this and found nothing that help me. I decided to just create a new command(using bindatcmd) that will make stucked characters get 'unstucked'. It's like @refresh but using warp command on the same coordinates and has cooldown. BUT since at my server, normal accounts(group id 0) cannot use atcommand while talking to a npc, I wanted to add something like allowing just a specific command(@refresh2 command to be specific) to be used while interacting at a npc but I can't do it on SRC.

 

I looked at atcommand.c and found this line under bool is_atcommand

//If cannot use atcomamnd while talking with NPC [Kichi]
	if (type == 1 && sd->npc_id && sd->state.disable_atcommand_on_npc)
		return false;

Question:

1) How can I make a specific command to be allowed while talking to a NPC?

2) What part of bool is_atcommand is the variable for the command used?

I tried it like this way but it's not working and it's showing compilation warnings

//If cannot use atcomamnd while talking with NPC [Kichi]
	if (type == 1 && sd->npc_id && sd->state.disable_atcommand_on_npc && command != "refresh2")
		return false;

 

Maybe someone here can help me please. Thank you!

Edited by Technoken

4 answers to this question

Recommended Posts

  • 0
Posted

If u use message u will need to add the prefix. (@ or #) at the begin. Message also contains command args.

	//If cannot use atcomamnd while talking with NPC [Kichi]
	if (type == 1 && sd->npc_id && sd->state.disable_atcommand_on_npc && !strcmp(message,"@refresh2"))
		return false;

And move it under:

	// skip 10/11-langtype's codepage indicator, if detected
	if ( message[0] == '|' && strlen(message) >= 4 && (message[3] == atcommand_symbol || message[3] == charcommand_symbol) )
		message += 3;

To skip |00 at the begin of the message.

 

Rynbef~

  • Upvote 1
  • 0
Posted

I dont know but u can try this one:

Quote

if (type == 1 && sd->npc_id && sd->state.disable_atcommand_on_npc && !strcmp(command,"refresh2"))

Rynbef~

  • 0
Posted
13 hours ago, Rynbef said:

I dont know but u can try this one:

Rynbef~

Thanks for the info! I didn't know I could use strcmp. lol anyway I still couldn't figure out how to make it work. It seems like the 'command' variable doesn't hold the command used. I've also tried 'message' and 'atcmd_msg' but still not working.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...