Jump to content
  • 0

Script for box to give random items


johnbond

Question


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

I would like to request an item script for a "box" that would give random items when opened. I shall provide which items it shall randomly give out from the list. Example of items are #2202, #2217, #2231 etc. It will be around 5-10 items.

 

Is this possible?
 

Thank you in advance guys! /thx

 

 

 

 

 

 

 

Link to comment
Share on other sites

19 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1658
  • Reputation:   262
  • Joined:  08/03/12
  • Last Seen:  

{getitem callfunc("F_Rand",2202,2217,2231),1; },{},{}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

{getitem callfunc("F_Rand",2202,2217,2231),1; },{},{}

 

I think its not working. I used:

 

{getitem callfunc("F_Rand",2202,2217,2231),1; },{},{}

 

exactly the same.

 

I get the errors everytime I click:

 

[03:19:20][Error]: script:callfunc: function not found! [F_Rand]
[03:19:20][Debug]: Source (NPC): FAKE_NPC (invisible/not on a map)
[03:19:33][Error]: script:callfunc: function not found! [F_Rand]
[03:19:33][Debug]: Source (NPC): FAKE_NPC (invisible/not on a map)

Btw, I still use 3ceam svn sorry for not making it clear.

 

Thank you again my friend. :)

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1658
  • Reputation:   262
  • Joined:  08/03/12
  • Last Seen:  

u are not using rathena ?

Edited by Chaos92
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

u are not using rathena ?

 

 

I am using 3ceam with some rathena modifications.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

F_Rand function is not available on 3ceam. 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1658
  • Reputation:   262
  • Joined:  08/03/12
  • Last Seen:  

yes its not available in 3ceam.

 

if you are using NPC to replace the item , its easy
 

setarray .@card,2202,2217,2231;
getitem .@card[ rand( getarraysize( .@card ) ) ],1;
delitem 501,1;
 
change 501 to any item that u want to let them change to that npc
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

 

yes its not available in 3ceam.

 

if you are using NPC to replace the item , its easy

 

setarray .@card,2202,2217,2231;
getitem .@card[ rand( getarraysize( .@card ) ) ],1;
delitem 501,1;
 
change 501 to any item that u want to let them change to that npc

 

 

 

I need it to be in my itemdb. It will be in a box of which the box will give random items from the list I will have.

 

Is there any other way around this?

 

Thank you my friend. :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

i think getitem,rand(501,502,503,504)1; will be okay?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

i think getitem,rand(501,502,503,504)1; will be okay?

I tried it but its not working. The "rand" part behaves differently.

 

According to doc.txt:

 

 

*rand(<number>{,<number>});

This function returns a number, randomly positioned between 0 and the number you

specify (if you only specify one) and the two numbers you specify if you give it

two.

rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9

rand(2,10) would result in 2,3,4,5,6,7,8,9 or 10

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1658
  • Reputation:   262
  • Joined:  08/03/12
  • Last Seen:  

 

 

yes its not available in 3ceam.

 

if you are using NPC to replace the item , its easy

 

setarray .@card,2202,2217,2231;
getitem .@card[ rand( getarraysize( .@card ) ) ],1;
delitem 501,1;
 
change 501 to any item that u want to let them change to that npc

 

 

 

I need it to be in my itemdb. It will be in a box of which the box will give random items from the list I will have.

 

Is there any other way around this?

 

Thank you my friend. :)

 

just give any etc items that u didnt use to them to exchange with those items. its simple and easy though

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

 

 

 

yes its not available in 3ceam.

 

if you are using NPC to replace the item , its easy

 

setarray .@card,2202,2217,2231;
getitem .@card[ rand( getarraysize( .@card ) ) ],1;
delitem 501,1;
 
change 501 to any item that u want to let them change to that npc

 

 

 

I need it to be in my itemdb. It will be in a box of which the box will give random items from the list I will have.

 

Is there any other way around this?

 

Thank you my friend. :)

 

just give any etc items that u didnt use to them to exchange with those items. its simple and easy though

 

 

 

I need that the box should give random prizes so it is not always what they expect to get. The box should give items randomly from my list.

Another idea is what if I manully put the callfunc("F_Rand"  codes in my SRC? Will this do the trick?

 

 

Thanks.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1658
  • Reputation:   262
  • Joined:  08/03/12
  • Last Seen:  

is this that u need ?

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

for itemdb

function	script	CustomBox	{
	setarray .BoxItems[0],501,502,503;
	
	set .Random, getarraysize( .BoxItems );
	getitem .BoxItems[ rand( .Random ) ], 1;
	announce "["+strcharinfo(0)+"] has just obtained a ["+getitemname(.BoxItems[ .Random ])+"] from a Custom Box.",0;
	end;
}

in script that u need to load

 

edit 

setarray .BoxItems[0],501,502,503;

for item list random

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

is this that u need ?

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

for itemdb

function	script	CustomBox	{
	setarray .BoxItems[0],501,502,503;
	
	set .Random, getarraysize( .BoxItems );
	getitem .BoxItems[ rand( .Random ) ], 1;
	announce "["+strcharinfo(0)+"] has just obtained a ["+getitemname(.BoxItems[ .Random ])+"] from a Custom Box.",0;
	end;
}

in script that u need to load

 

edit 

setarray .BoxItems[0],501,502,503;

for item list random

 

 

Wow you are awesome!

I will give this a try soon and let you know.

 

Thank you my friend! :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1658
  • Reputation:   262
  • Joined:  08/03/12
  • Last Seen:  

try and tell us here is it work or not

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

is this that u need ?

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

for itemdb

function	script	CustomBox	{
	setarray .BoxItems[0],501,502,503;
	
	set .Random, getarraysize( .BoxItems );
	getitem .BoxItems[ rand( .Random ) ], 1;
	announce "["+strcharinfo(0)+"] has just obtained a ["+getitemname(.BoxItems[ .Random ])+"] from a Custom Box.",0;
	end;
}

in script that u need to load

 

edit 

setarray .BoxItems[0],501,502,503;

for item list random

 

 

Working! Awesome!

 

Thank you my friend!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1658
  • Reputation:   262
  • Joined:  08/03/12
  • Last Seen:  

welcome :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

welcome :)

 

 

 

My friend the announcement feature you had put is great:

 

announce "["+strcharinfo(0)+"] has just obtained a ["+getitemname(.BoxItems[ .Random ])+"] from a Custom Box.",0;

But it does not announce properly. It gives "null" announcement of the item.

 

 

[Test123] has just obtained a [null] from a a Custom Box.

 

No error in map console. Can we fix? :)

 

I use 3Ceam.

 

Thank you!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

 

welcome :)

 

 

 

My friend the announcement feature you had put is great:

 

announce "["+strcharinfo(0)+"] has just obtained a ["+getitemname(.BoxItems[ .Random ])+"] from a Custom Box.",0;

But it does not announce properly. It gives "null" announcement of the item.

 

 

[Test123] has just obtained a [null] from a a Custom Box.

 

No error in map console. Can we fix? :)

 

I use 3Ceam.

 

Thank you!

 

 

 

Oh nevermind I already got it hehe.

 

Thank you Mr. Chaos92!

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2352
  • Joined:  10/28/11
  • Last Seen:  

 

{getitem callfunc("F_Rand",2202,2217,2231),1; },{},{}

 

I think its not working. I used:

 

{getitem callfunc("F_Rand",2202,2217,2231),1; },{},{}

 

exactly the same.

 

I get the errors everytime I click:

 

[03:19:20][Error]: script:callfunc: function not found! [F_Rand]
[03:19:20][Debug]: Source (NPC): FAKE_NPC (invisible/not on a map)
[03:19:33][Error]: script:callfunc: function not found! [F_Rand]
[03:19:33][Debug]: Source (NPC): FAKE_NPC (invisible/not on a map)

Btw, I still use 3ceam svn sorry for not making it clear.

 

Thank you again my friend. :)

 

 

 

 

the missing function....

function	script	F_Rand	{
	return getarg(rand(getargcount()));
}

but not compatible with 3ceam or older ea

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