Jump to content
  • 0
Myth

R>Runes Giver

Question

12 answers to this question

Recommended Posts

  • 0

 

 

OnPCDieEvent:if( Class == 4060 ){    if( countitem( xyz ) < 3 ) getitem xyz,( 3 - countitem( xyz ) );}

 

 

even he died if he still have 2 runes all of that the NPC will only gave him/her only 1 to make it 3 again.

 

3x of all that items huh

Share this post


Link to post
Share on other sites
  • 0

Emistry is right. Just change xyz to the item ID you want. You can copy this:

if( countitem( xyz ) < 3 ) getitem xyz,( 3 - countitem( xyz ) );

over and over inside the first if and changing the xyz for the different items you wanna give up to 3 so that you can accomplish what you want.

 

Remember that OnPCDieEvent label should be inisde an NPC.

Share this post


Link to post
Share on other sites
  • 0

example

 

 

if( countitem( 1357,14657,18647,46116 ) < 3 ) getitem xyz,( 3 - countitem( 1357,14657,18647,46116 ) ); 

Share this post


Link to post
Share on other sites
  • 0

countitem allows only 1 argument which is supposed to be an item ID. It should be like this, so that'll get you some nice errors when parsing the script.

 

Your script should look like this:

OnPCDieEvent:if( Class == 4060 ){    if(countitem(12725) < 3) getitem 12725, (3 - countitem(12725));	if(countitem(12726) < 3) getitem 12726, (3 - countitem(12726));	if(countitem(12727) < 3) getitem 12727, (3 - countitem(12727));	if(countitem(12728) < 3) getitem 12728, (3 - countitem(12728));	if(countitem(12729) < 3) getitem 12729, (3 - countitem(12729));	if(countitem(12730) < 3) getitem 12730, (3 - countitem(12730));	if(countitem(12731) < 3) getitem 12731, (3 - countitem(12731));	if(countitem(12732) < 3) getitem 12732, (3 - countitem(12732));	if(countitem(12733) < 3) getitem 12733, (3 - countitem(12733));}

 

 

Or, in a more compressed form (saves disk space but uses a bit more of process):

OnPCDieEvent:if( Class == 4060 ){    for (set .@i, 12725; .@i <= 12733; set .@i, .@i + 1) // We loop trhough the IDs for the runestones		if(countitem(.@i) < 3) getitem .@i, (3 - countitem(.@i));}

 

Hope this helps you.

Share this post


Link to post
Share on other sites
  • 0

countitem allows only 1 argument which is supposed to be an item ID. It should be like this, so that'll get you some nice errors when parsing the script.

 

Your script should look like this:

OnPCDieEvent:if( Class == 4060 ){    if(countitem(12725) < 3) getitem 12725, (3 - countitem(12725));	if(countitem(12726) < 3) getitem 12726, (3 - countitem(12726));	if(countitem(12727) < 3) getitem 12727, (3 - countitem(12727));	if(countitem(12728) < 3) getitem 12728, (3 - countitem(12728));	if(countitem(12729) < 3) getitem 12729, (3 - countitem(12729));	if(countitem(12730) < 3) getitem 12730, (3 - countitem(12730));	if(countitem(12731) < 3) getitem 12731, (3 - countitem(12731));	if(countitem(12732) < 3) getitem 12732, (3 - countitem(12732));	if(countitem(12733) < 3) getitem 12733, (3 - countitem(12733));}

 

 

Or, in a more compressed form (saves disk space but uses a bit more of process):

OnPCDieEvent:if( Class == 4060 ){    for (set .@i, 12725; .@i <= 12733; set .@i, .@i + 1) // We loop trhough the IDs for the runestones		if(countitem(.@i) < 3) getitem .@i, (3 - countitem(.@i));}

 

Hope this helps you.

 

Solved

Edited by Myth

Share this post


Link to post
Share on other sites
  • 0

like this?

 

 

prontera,111,111,5      script   39,{if( Class == 4060 ){for (set .@i, 12725; .@i <= 12733; set .@i, .@i + 1) // We loop trhough the IDs for the runestones		if(countitem(.@i) < 3) getitem .@i, (3 - countitem(.@i));} 

Share this post


Link to post
Share on other sites
  • 0

Much like that but:

 

  • The NPC declaration requires location (prontera,111,111,5), the type of NPC (script), the NPC name (which is missing) and the sprite ID and curly opening (39,{). As I've said the NPC name is missing.
  • You are also missing the closing curly of the NPC opening, the { and } must match.
  • Add an end; where the script is supposed to end, so that it actually can be ended and isn't kept on memory. We only provided you a snippet, and you try to make this a full NPC so it should be ended for your server resources sake. Sounds quite redundant, doesn't it?

A more correct version woud be like this:

prontera,111,111,5	script	NPCname	39,{	if( Class == 4060 ){		for (set .@i, 12725; .@i <= 12733; set .@i, .@i + 1) // We loop trhough the IDs for the runestones			if(countitem(.@i) < 3) getitem .@i, (3 - countitem(.@i));	}	end;}

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

  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.

Loading...

×
×
  • Create New...

Important Information

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