Jump to content
  • 0

help NPC that reads a skull?


laklaker

Question


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  109
  • Reputation:   0
  • Joined:  12/27/11
  • Last Seen:  

Hello! I would like just to request something? I wanted to create a npc that trades a card for specific players like for example: Anonymous (This is a real IGN) Skull can be tradable into a card. Would you think it would work? Thanks!

Link to comment
Share on other sites

13 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

My fault:

delitem2 7420, 1, 1, 0, 0, 254, 0, .cible_cid & 0x00FFFF, .cible_cid >> 16;

About the name, you have to reloadscript.

Here a fix :

   	 // Damn !? No reloadscript ?!
       if ( .char_name$ == "" ) {
           donpcevent strnpcinfo(3) + "::OnInit";
           sleep2 1; // Execute OnInit before continue.
       }

       mes "I give you an apple if you give me " + .char_name$ . "'s skull !";
       next;

       if ( countitem2( 7420, 1, 0, 0, 254, 0, .cible_cid & 0x00FFFF, .cible_cid >> 16 ) ) {
               mes "Yeah you have the skull ! I give you an apple";
               delitem2 7420, 1, 1, 0, 0, 254, 0, .cible_cid & 0x00FFFF, .cible_cid >> 16;
               getitem 512, 1;
       }
       else {
               mes "Damn, you don't have it...";
       }
       close;

OnInit:
       set .char_name$, "Anonymous";
       query_sql("SELECT `char_id` FROM `char` WHERE `name`='" + escape_sql(.char_name$) + "' LIMIT 1", .cible_cid );
       if ( !.cible_cid )
           debugmes "[skull Trader] Invalid name specify ?";
       end;

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

Skull ID - 7420

and yes you can trade it into another Card if your NPC does so.

just check for item 7420 and trade to the Card you want.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  109
  • Reputation:   0
  • Joined:  12/27/11
  • Last Seen:  

Skull ID - 7420

and yes you can trade it into another Card if your NPC does so.

just check for item 7420 and trade to the Card you want.

I mean just to specific skulls? Like My skull only? Thanks! And could you please put some examples of the codes? Thanks

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  351
  • Reputation:   52
  • Joined:  11/15/11
  • Last Seen:  

Skulls, like yours that are dropped in pvp are just normal skulls, id 7420, nothing special about them, they're just signed with your name, no different worth or any other id.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  118
  • Reputation:   6
  • Joined:  01/25/12
  • Last Seen:  

if(countitem(7420)) { //do something }

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  7
  • Reputation:   0
  • Joined:  02/08/12
  • Last Seen:  

Im pretty sure (s)he's wanting it to read the name off of the skull, perhaps for something like a mercenary script (kill a certain person and bring in their skull).

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

Just an example:

	mes "I give you an apple if you give me " + .char_name$ . "'s skull !";
next;

if ( countitem2( 7420, 1, 0, 0, 254, 0, .cible_cid & 0x00FFFF, .cible_cid >> 16 ) ) {
	mes "Yeah you have the skull ! I give you an apple";
	delitem2 7420, 1, 0, 0, 254, 0, .cible_cid & 0x00FFFF, .cible_cid >> 16;
	getitem 512, 1;
}
else {
	mes "Damn, you don't have it...";
}
close;

OnInit:
set .char_name$, "Anonymous";
query_sql("SELECT `char_id` FROM `char` WHERE `name`='" + escape_sql(.char_name$) + "' LIMIT 1", .cible_cid );
end;

Good luck.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  109
  • Reputation:   0
  • Joined:  12/27/11
  • Last Seen:  

Just an example:

	mes "I give you an apple if you give me " + .char_name$ . "'s skull !";
next;

if ( countitem2( 7420, 1, 0, 0, 254, 0, .cible_cid & 0x00FFFF, .cible_cid >> 16 ) ) {
	mes "Yeah you have the skull ! I give you an apple";
	delitem2 7420, 1, 0, 0, 254, 0, .cible_cid & 0x00FFFF, .cible_cid >> 16;
	getitem 512, 1;
}
else {
	mes "Damn, you don't have it...";
}
close;

OnInit:
set .char_name$, "Anonymous";
query_sql("SELECT `char_id` FROM `char` WHERE `name`='" + escape_sql(.char_name$) + "' LIMIT 1", .cible_cid );
end;

Good luck.

Hello there! I tried your script how ever it doesn't recognized a name.

giEY2.jpg

+ An error in this line

delitem2 7420, 1, 0, 0, 254, 0, .cible_cid & 0x00FFFF, .cible_cid >> 16;

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  109
  • Reputation:   0
  • Joined:  12/27/11
  • Last Seen:  

Ok thanks! I'll try it when I get back in home.

Same as the one as I said. :|

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  109
  • Reputation:   0
  • Joined:  12/27/11
  • Last Seen:  

My fault:

delitem2 7420, 1, 1, 0, 0, 254, 0, .cible_cid & 0x00FFFF, .cible_cid >> 16;

About the name, you have to reloadscript.

Here a fix :

   	 // Damn !? No reloadscript ?!
	if ( .char_name$ == "" ) {
		donpcevent strnpcinfo(3) + "::OnInit";
		sleep2 1; // Execute OnInit before continue.
	}

	mes "I give you an apple if you give me " + .char_name$ . "'s skull !";
	next;

	if ( countitem2( 7420, 1, 0, 0, 254, 0, .cible_cid & 0x00FFFF, .cible_cid >> 16 ) ) {
			mes "Yeah you have the skull ! I give you an apple";
			delitem2 7420, 1, 1, 0, 0, 254, 0, .cible_cid & 0x00FFFF, .cible_cid >> 16;
			getitem 512, 1;
	}
	else {
			mes "Damn, you don't have it...";
	}
	close;

OnInit:
	set .char_name$, "Anonymous";
	query_sql("SELECT `char_id` FROM `char` WHERE `name`='" + escape_sql(.char_name$) + "' LIMIT 1", .cible_cid );
	if ( !.cible_cid )
		debugmes "[skull Trader] Invalid name specify ?";
	end;

I'll try this when I get back home. Thanks!

It works now however the delitem wont work :|.

Edited by laklaker
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   0
  • Joined:  05/18/12
  • Last Seen:  

i also need something like this.

however it wont work on me also.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  109
  • Reputation:   0
  • Joined:  12/27/11
  • Last Seen:  

I still need help :\ .

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...