Jump to content
  • 0

[SOLVED] [Debug]: Source (NPC): FAKE_NPC


GM Winter

Question


  • Group:  Members
  • Topic Count:  176
  • Topics Per Day:  0.14
  • Content Count:  666
  • Reputation:   9
  • Joined:  12/04/20
  • Last Seen:  

i always got the error in the picture when that says:


[Error]: buildin_getitem: Nonexistant item 0 requested.
[Debug]: Source (NPC): FAKE_NPC (invisible/not on a map)


heres my script can somebody tell me the error thanks in advance

function script specialbox {
    setarray .i[0],20727; // Itemlist in box
    set .chance, rand(100);

        // First item in list (20727) x 1 (1% Chance)
        if (.chance == 1){
        getitem .i[0],1;
        announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[0])+"] from the Special Box.",0;
        end;
        } 

        // First item in list (20727) x 100 (5~10% Chance)
        if (.chance <= 10 && .chance > 5){
        getitem .i[1],100;
        end;
    }
}

 

1.PNG

Edited by chadness
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  171
  • Reputation:   68
  • Joined:  10/25/20
  • Last Seen:  

Try this.

Script.

function	script	Boxes	{

	setarray @i1[0],501; // Common
	setarray @i2[0],502; // Rare
	setarray @i3[0],503; // Super Rare
	set @i1rand,rand( getarraysize(@i1) ); 
	set @i2rand,rand( getarraysize(@i2) ); 
	set @i3rand,rand( getarraysize(@i3) ); 
   .chance = rand(100);

		// Super Rare
		if (.chance == 1){
			getitem @i3[@i3rand],1;
			announce "["+strcharinfo(0)+"] got ["+getitemname(@i3[@i3rand])+"] 'Super Rare'.",0;

		} 
        // Rare
		else if (.chance <= 10 && .chance >= 5){
			getitem @i2[@i2rand],1;
			announce "["+strcharinfo(0)+"] obtained ["+getitemname(@i2[@i2rand])+"] 'Rare'.",0;

		} 

		// Common
		else {
			getitem @i1[@i1rand],1;
			announce "["+strcharinfo(0)+"] obtained ["+getitemname(@i2[@i2rand])+"] 'Common'.",0;
	end; }
}

 

item_db (example).

501,Red_Potion,Red Potion,0,50,,70,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "Boxes"; },{},{}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  176
  • Topics Per Day:  0.14
  • Content Count:  666
  • Reputation:   9
  • Joined:  12/04/20
  • Last Seen:  

4 hours ago, cook1e said:

Try this.

Script.


function	script	Boxes	{

	setarray @i1[0],501; // Common
	setarray @i2[0],502; // Rare
	setarray @i3[0],503; // Super Rare
	set @i1rand,rand( getarraysize(@i1) ); 
	set @i2rand,rand( getarraysize(@i2) ); 
	set @i3rand,rand( getarraysize(@i3) ); 
   .chance = rand(100);

		// Super Rare
		if (.chance == 1){
			getitem @i3[@i3rand],1;
			announce "["+strcharinfo(0)+"] got ["+getitemname(@i3[@i3rand])+"] 'Super Rare'.",0;

		} 
        // Rare
		else if (.chance <= 10 && .chance >= 5){
			getitem @i2[@i2rand],1;
			announce "["+strcharinfo(0)+"] obtained ["+getitemname(@i2[@i2rand])+"] 'Rare'.",0;

		} 

		// Common
		else {
			getitem @i1[@i1rand],1;
			announce "["+strcharinfo(0)+"] obtained ["+getitemname(@i2[@i2rand])+"] 'Common'.",0;
	end; }
}

 

item_db (example).


501,Red_Potion,Red Potion,0,50,,70,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "Boxes"; },{},{}

 

thanks men ❤️

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