Jump to content
  • 0

Coin Bag item script


cmsm94

Question


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

In rms it is not showed about the coding about coins bag. http://ratemyserver.net/index.php?iname=grade+coin&page=re_item_db&quick=1&isearch=Search

Look at this My server dont drop the 

 

B Grade Coin Bag - E Grade Coin Bag

 

Can anyone help me with this script in item_db?

 

My guide is B Grade coin bag drop 1-10(random) coins of B grade.

 

I just need the script for it thank you.



pretty please help me XD



If you look closely at

Item DB

 

12617,Agrade_Pocket,A Grade Coin Bag,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_A_Grade_Coin_Bag),1; getrandgroupitem(IG_A_Grade_Coin_Bag),1; getrandgroupitem(IG_A_Grade_Coin_Bag),1; },{},{}

 

This Grade B coin Bag have to have a script in it, unfortunately my rathena dont have and the official server have it. Can someone make a script like this:

12618,Bgrade_Pocket,B Grade Coin Bag,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{HERE IS EMPTY!!!!!},{},{}
 
Here:
{ if(rand(100)<10) { setarray .@RainbowArray[1],18113,2016,1586,1395,1832,21001,18114,13072,16021,1492,1587,1396,1293,21002,1294,1436,16020; set RainbowItem,.@RainbowArray[rand(1,17)]; announce ""+strcharinfo(0)+" has won "+getitemname(RainbowItem)+" from a SpecialBox.",bc_all; } else { setarray .@RainbowArray[1],18113,2016,1586,1395,1832,21001,18114,13072,16021,1492,1587,1396,1293,21002,1294,1436,16020; set RainbowItem,.@RainbowArray[rand(1,17)]; } getitem RainbowItem,1; },{},{}
 
 
I want my coins to give 1-10 coins . It will random give
 


BUMP!!!!

Edited by cmsm94
Link to comment
Share on other sites

13 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

bump

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

Jingle bell rocks

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

bump....

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

bump

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Do not bump too often on your topic. This may considered as a spam. Thank you

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  94
  • Reputation:   4
  • Joined:  01/29/13
  • Last Seen:  

Do you want all the coin bags to behave as the Grade A Coin Bag? Or do you want to have another script on the coin bags? (so with the announce stuff?)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

Do not bump too often on your topic. This may considered as a spam. Thank you

 

I understand but did you look on those dates? Really need this script. What do you suggest me to do? remake a post identical like this?

Do you want all the coin bags to behave as the Grade A Coin Bag? Or do you want to have another script on the coin bags? (so with the announce stuff?)

I would like for example Grade B coin bag only gives B Grade coin thats it. It will random choose the number of coin a player will get when he/she clicks it/open it.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  94
  • Reputation:   4
  • Joined:  01/29/13
  • Last Seen:  

okay, if you want to copy the exact behavior of the script, you have to

  1. add the coin bag here: http://svn.code.sf.net/p/rathena/svn/trunk/db/const.txt (after "IG_CardAlbum_Garment")
  2. increase the maximum MAX_ITEMGROUP here: http://svn.code.sf.net/p/rathena/svn/trunk/src/map/itemdb.h (set it 1 higher then the last id in 1.)
  3. add the items which are in the bag here: http://svn.code.sf.net/p/rathena/svn/trunk/db/re/item_misc.txt (format is described at the top, the groupid equals what you have set in const.txt, e.g IG_B_Grade_Coin_Bag 70, then your groupid is 70 and so on...)
  4. in the itemscript: getrandgroupitem(IG_B_Grade_Coin_Bag),1, so exactly what is in the script of the A Grade Bag.

If you dont care about the exact implementation:

function	script	coinbag {
	swtich(getarg(0,0)) //default to 0 to prevent errors
	{
		case 0:
			//For B Grade e.g.
			setarray .@coins[0],<id>,<amt>,<id>,<amt>,...;
			break;
		case 1: //C Grade
			...
			break;
		//etc...
	}
	.@rnd = rand(getarraysize(.@coins)) / 2;
	getitem .@coins[(.@rnd*2)],.@coins[((.@rnd*2)+1)]
}

then just call the function coinbag in the script (btw: not tested)

{ callfunc "coinbag",<id>; }
Edited by chriser
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

okay, if you want to copy the exact behavior of the script, you have to

  1. add the coin bag here: http://svn.code.sf.net/p/rathena/svn/trunk/db/const.txt (after "IG_CardAlbum_Garment")
  2. increase the maximum MAX_ITEMGROUP here: http://svn.code.sf.net/p/rathena/svn/trunk/src/map/itemdb.h (set it 1 higher then the last id in 1.)
  3. add the items which are in the bag here: http://svn.code.sf.net/p/rathena/svn/trunk/db/re/item_misc.txt (format is described at the top, the groupid equals what you have set in const.txt, e.g IG_B_Grade_Coin_Bag 70, then your groupid is 70 and so on...)
  4. in the itemscript: getrandgroupitem(IG_B_Grade_Coin_Bag),1, so exactly what is in the script of the A Grade Bag.

If you dont care about the exact implementation:

function	script	coinbag {
	swtich(getarg(0,0)) //default to 0 to prevent errors
	{
		case 0:
			//For B Grade e.g.
			setarray .@coins[0],<id>,<amt>,<id>,<amt>,...;
			break;
		case 1: //C Grade
			...
			break;
		//etc...
	}
	.@rnd = rand(getarraysize(.@coins)) / 2;
	getitem .@coins[(.@rnd*2)],.@coins[((.@rnd*2)+1)]
}

then just call the function coinbag in the script (btw: not tested)

{ callfunc "coinbag",<id>; }

 

 

I think I really dont understand what you are trying to tell O.o. From my point of view you said there is 2 choice A is those 1-4 steps, while Choice B is just a script command.

 

If it is a script command i suggest to do that 1 but from what I understand you script only works for 1 bag.

 

 

 

function    script    coinbag {

    swtich(getarg(0,0)) //default to 0 to prevent errors

    {

        case 0:

            //For B Grade e.g.

            setarray .@coins[0],<id>,<amt>,<id>,<amt>,...;

            break;

        case 1: //C Grade

            ...

            break;

        //etc...

    }

    .@rnd = rand(getarraysize(.@coins)) / 2;

    getitem .@coins[(.@rnd*2)],.@coins[((.@rnd*2)+1)]

}

 

 

This how do you work with this I dont get it sir.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  94
  • Reputation:   4
  • Joined:  01/29/13
  • Last Seen:  

you have to continue the cases for each bag

function    script    coinbag {
    swtich(getarg(0,0)) //default to 0 to prevent errors
    {
        case 0:
            //For B Grade e.g.
            setarray .@coins[0],<id>,<amt>,<id>,<amt>,...;
            break;
        case 1: //C Grade
            setarray .@coins[0],<id>,<amt>,<id>,<amt>,...;
            break;
        //etc...
        case 2: //D Grade
            setarray .@coins[0],<id>,<amt>,<id>,<amt>,...;
            break;
        //etc...
    }
    .@rnd = rand(getarraysize(.@coins)) / 2;
    getitem .@coins[(.@rnd*2)],.@coins[((.@rnd*2)+1)]
}

what i am doing here:

depending with which parameter you call the function, the array is filled with other values, e.g. callfunc "coinbag",1 calls the case for the C Grade Bag, callfunc "coinbag",2 the case for the D Grade Bag. you just have to fill the array with the right ids and values.

after filling the array, all coin bags do the same: getting your item.

What i am then doing is a bit tricky. I am dividing the random number I got by 2, then multiplied it by 2 again so that i have the even number, e.g: rand(getarraysize)) returns 3, divided by 2 equals 1 (because of rounding), then mult by 2 again is 2, which would be .@coins[2] which is the ID. the next element is .@coins[3], which is the amount of the item. then you just get the item with getitem.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

you have to continue the cases for each bag

function    script    coinbag {
    swtich(getarg(0,0)) //default to 0 to prevent errors
    {
        case 0:
            //For B Grade e.g.
            setarray .@coins[0],<id>,<amt>,<id>,<amt>,...;
            break;
        case 1: //C Grade
            setarray .@coins[0],<id>,<amt>,<id>,<amt>,...;
            break;
        //etc...
        case 2: //D Grade
            setarray .@coins[0],<id>,<amt>,<id>,<amt>,...;
            break;
        //etc...
    }
    .@rnd = rand(getarraysize(.@coins)) / 2;
    getitem .@coins[(.@rnd*2)],.@coins[((.@rnd*2)+1)]
}

what i am doing here:

depending with which parameter you call the function, the array is filled with other values, e.g. callfunc "coinbag",1 calls the case for the C Grade Bag, callfunc "coinbag",2 the case for the D Grade Bag. you just have to fill the array with the right ids and values.

after filling the array, all coin bags do the same: getting your item.

What i am then doing is a bit tricky. I am dividing the random number I got by 2, then multiplied it by 2 again so that i have the even number, e.g: rand(getarraysize)) returns 3, divided by 2 equals 1 (because of rounding), then mult by 2 again is 2, which would be .@coins[2] which is the ID. the next element is .@coins[3], which is the amount of the item. then you just get the item with getitem.

so { callfunc "coinbag",<id>; } the id should be like

 

{ callfunc "coinbag",case 0:; }?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  94
  • Reputation:   4
  • Joined:  01/29/13
  • Last Seen:  

without case, just 

 

{ callfunc "coinbag",0; }

 

and for any other

{ callfunc "coinbag",1; }
{ callfunc "coinbag",2; }

and so on...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   5
  • Joined:  08/11/13
  • Last Seen:  

without case, just 

 

{ callfunc "coinbag",0; }

 

and for any other

{ callfunc "coinbag",1; }
{ callfunc "coinbag",2; }

and so on...

 

 

 

 

Then for your this part~~

 

 

function    script    coinbag {

    swtich(getarg(0,0)) //default to 0 to prevent errors

    {

        case 0:

            //For B Grade e.g.

            setarray .@coins[0],<id>,<amt>,<id>,<amt>,...;

            break;

            case 1: //C Grade

            setarray .@coins[1],<id>,<amt>,<id>,<amt>,...;  ---------------------------------------------------- @coins[1] <<<????? should i put it like this?

            break;

            //etc...

            break;

        //etc...

    }

    .@rnd = rand(getarraysize(.@coins)) / 2;

    getitem .@coins[(.@rnd*2)],.@coins[((.@rnd*2)+1)]

}

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