Jump to content
  • 0

Allow use of specific atcommand when talking to NPC


Technoken

Question


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

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
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  898
  • Reputation:   120
  • Joined:  05/23/12
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  898
  • Reputation:   120
  • Joined:  05/23/12
  • Last Seen:  

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~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

Thanks @Rynbef! I got it working now. But it doesn't work when using bindatcommand. Guess i'll just figure that out.

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