Jump to content
  • 0

callfunc "F_Rand",


lphz

Question


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   6
  • Joined:  10/15/15
  • Last Seen:  

// Returns a random argument.
// -- callfunc "F_Rand",arg0,arg1,...
// Example:
//    // You can use it to pick a random number from a list:
//    set @itemIDfromList, callfunc("F_Rand",1129,1222,1163,1357,1360,1522,1811,1410);
//////////////////////////////////////////////////////////////////////////////////
function    script    F_Rand    {
    return getarg(rand(getargcount()));
}

Please help to customize this function.
I want to be able to set the amount and percent of each piece,
Example :-
ItemID , Percent , Amount
callfunc("F_Rand",1129,100,10,1222,90,5,1163,80,20,1357,70,8);

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

//callfunc("RENAME_ME",501,50,30,502,5,20,503,10,30);
//ITEM ID, AMOUNT, WEIGHT
function	script	RENAME_ME	{
	for(.@i = 0; .@i < getargcount(); .@i += 3){
		.@id[.@i/3] = getarg(.@i);
		.@amount[.@i/3] = getarg(.@i+1);
		.@size += getarg(.@i+2);
		for(.@j = 0; .@j < getarg(.@i+2); .@j++)
			.@list[getarraysize(.@list)] = getarg(.@i);
	}
	.@item = .@list[rand(.@size)];
	getitem .@item,.@amount[inarray(.@id,.@item)];
	return;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   6
  • Joined:  10/15/15
  • Last Seen:  

Thank you bro,

But there are times when the item is not received.

Out of 50 open tests, 36 items were obtained, 14 were missing.

 

Video 2022-04-07 11-06-56.mkv

 

317115784_2.png.8cefc6326b268695d280c5089ed6035c.png

  - Id: 1110000
    AegisName: Char_Zeros_Bag_1
    Name: Char Zeros Bag 1
    Type: Usable
    Buy: 1
    Weight: 10
    NoUse:
      Sitting: true
    Trade:
      NoDrop: true
      NoTrade: true
      NoSell: true
      NoCart: true
      NoStorage: true
      NoGuildStorage: true
      NoMail: true
      NoAuction: true
    Script: |
      callfunc("RENAME_ME",1110100,1,100,1110101,1,100,1110102,1,80,1110103,1,80,1110104,1,60);

 

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