Jump to content
  • 0

Need help on this Announcement Box script.


NoWayHome

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  19
  • Reputation:   0
  • Joined:  02/23/22
  • Last Seen:  

Hi Guys,

This Script was found on the rathena.

I'm facing a problem on this script below:

function	script	specialbox	{
	setarray .i1[0],909,910; // Common Items
	set .i1rand,rand(0,1); // Randomize Common Items; just change max amount if you add items
	setarray .i2[0],911,912; // Rare Items
	set .i2rand,rand(0,1); // Randomize Rare Items; just change max amount if you add items
	setarray .i3[0],2199,1599; // Super Rare Items
	set .i3rand,rand(0,1); //Randomize Super Rare Items; just change max amount if you add items
	set .chance, rand(100);

		// Super Rare Item 1%
		if (.chance == 50){
		getitem .i[.i3rand],1;
		announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[.i3rand])+"] from the Special Box.",0;
		end;
		} 

		// Rare Item 10%
		else if (.chance <= 2 && .chance >= 11){
		getitem .i[.i2rand],1;
		announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[.i2rand])+"] from the Special Box.",0;
		end;
		} 

		// Common Items
		else {
		getitem .i1[.i1rand],1;
		end; }
}
50013,Special_Box,Special Present,2,10000,,100,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "specialbox",1; },{},{}

 

When I was get the Super Rare items prize my name come out on the announcement in server BUT it shown like this :
" [GameMaster] won a [null] from the Special Box. "

And I don't even receive the prize after I opened the box with the announcement.
May I know whats the problem?

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

This error found at the same time.


Please guide me what to do. Thanks!

 

P/S: If I post on the wrong section please move me to the correct one. Thank you!
 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   10
  • Joined:  08/02/18
  • Last Seen:  

there are four variables that have not been set

Spoiler

function    script    specialbox    {
    setarray .i1[0],909,910; // Common Items
    set .i1rand,rand(0,1); // Randomize Common Items; just change max amount if you add items
    setarray .i2[0],911,912; // Rare Items
    set .i2rand,rand(0,1); // Randomize Rare Items; just change max amount if you add items
    setarray .i3[0],2199,1599; // Super Rare Items
    set .i3rand,rand(0,1); //Randomize Super Rare Items; just change max amount if you add items
    set .chance, rand(100);

        // Super Rare Item 1%
        if (.chance == 50){
        getitem .i3[.i3rand],1;
        announce "["+strcharinfo(0)+"] won a ["+getitemname(.i3[.i3rand])+"] from the Special Box.",0;
        end;
        } 

        // Rare Item 10%
        else if (.chance <= 2 && .chance >= 11){
        getitem .i2[.i2rand],1;
        announce "["+strcharinfo(0)+"] won a ["+getitemname(.i2[.i2rand])+"] from the Special Box.",0;
        end;
        } 

        // Common Items
        else {
        getitem .i1[.i1rand],1;
        end; }
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  19
  • Reputation:   0
  • Joined:  02/23/22
  • Last Seen:  

On 4/6/2022 at 9:48 AM, Mahiro said:

there are four variables that have not been set

  Reveal hidden contents

function    script    specialbox    {
    setarray .i1[0],909,910; // Common Items
    set .i1rand,rand(0,1); // Randomize Common Items; just change max amount if you add items
    setarray .i2[0],911,912; // Rare Items
    set .i2rand,rand(0,1); // Randomize Rare Items; just change max amount if you add items
    setarray .i3[0],2199,1599; // Super Rare Items
    set .i3rand,rand(0,1); //Randomize Super Rare Items; just change max amount if you add items
    set .chance, rand(100);

        // Super Rare Item 1%
        if (.chance == 50){
        getitem .i3[.i3rand],1;
        announce "["+strcharinfo(0)+"] won a ["+getitemname(.i3[.i3rand])+"] from the Special Box.",0;
        end;
        } 

        // Rare Item 10%
        else if (.chance <= 2 && .chance >= 11){
        getitem .i2[.i2rand],1;
        announce "["+strcharinfo(0)+"] won a ["+getitemname(.i2[.i2rand])+"] from the Special Box.",0;
        end;
        } 

        // Common Items
        else {
        getitem .i1[.i1rand],1;
        end; }
}

 

Bro thanks for your reply! 
It works fine!! very appreciate!

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