atleast a little edit might be required, just to get itemID into script from getrandgroupitem.
In that case:
Script.c:
/* getrandgroupitem <container_item_id>,<quantity> */
BUILDIN(getrandgroupitem)
{
struct item_data *data = NULL;
struct map_session_data *sd = NULL;
int nameid = script_getnum(st, 2);
int count = script_getnum(st, 3);
if( !(data = itemdb->exists(nameid)) ) {
ShowWarning("buildin_getrandgroupitem: unknown item id %d\n",nameid);
script_pushint(st, 1);
} else if ( count <= 0 ) {
ShowError("buildin_getrandgroupitem: qty is <= 0!\n");
script_pushint(st, 1);
} else if ( !data->group ) {
ShowWarning("buildin_getrandgroupitem: item '%s' (%d) isn't a group!\n",data->name,nameid);
script_pushint(st, 1);
} else if( !( sd = script->rid2sd(st) ) ) {
ShowWarning("buildin_getrandgroupitem: no player attached!! (item %s (%d))\n",data->name,nameid);
script_pushint(st, 1);
} else {
int i, get_count, flag;
struct item it;
memset(&it,0,sizeof(it));
nameid = itemdb->group_item(data->group);
it.nameid = nameid;
it.identify = itemdb->isidentified(nameid);
if (!itemdb->isstackable(nameid))
get_count = 1;
else
get_count = count;
for (i = 0; i < count; i += get_count) {
// if not pet egg
if (!pet->create_egg(sd, nameid)) {
if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) {
clif->additem(sd, 0, 0, flag);
if( pc->candrop(sd,&it) )
map->addflooritem(&sd->bl, &it, get_count, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0);
}
}
}
script_pushint(st, 0);
}
return true;
}
To
/* getrandgroupitem <container_item_id>,<quantity> */
BUILDIN(getrandgroupitem)
{
struct item_data *data = NULL;
struct map_session_data *sd = NULL;
int nameid = script_getnum(st, 2);
int count = script_getnum(st, 3);
if( !(data = itemdb->exists(nameid)) ) {
ShowWarning("buildin_getrandgroupitem: unknown item id %d\n",nameid);
script_pushint(st, 1);
} else if ( count <= 0 ) {
ShowError("buildin_getrandgroupitem: qty is <= 0!\n");
script_pushint(st, 1);
} else if ( !data->group ) {
ShowWarning("buildin_getrandgroupitem: item '%s' (%d) isn't a group!\n",data->name,nameid);
script_pushint(st, 1);
} else if( !( sd = script->rid2sd(st) ) ) {
ShowWarning("buildin_getrandgroupitem: no player attached!! (item %s (%d))\n",data->name,nameid);
script_pushint(st, 1);
} else {
int i, get_count, flag;
struct item it;
memset(&it,0,sizeof(it));
nameid = itemdb->group_item(data->group);
it.nameid = nameid;
it.identify = itemdb->isidentified(nameid);
if (!itemdb->isstackable(nameid))
get_count = 1;
else
get_count = count;
for (i = 0; i < count; i += get_count) {
// if not pet egg
if (!pet->create_egg(sd, nameid)) {
if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) {
clif->additem(sd, 0, 0, flag);
if( pc->candrop(sd,&it) )
map->addflooritem(&sd->bl, &it, get_count, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0);
}
}
}
script_pushint(st, nameid);
}
return true;
}
* just script_pushint(st, 0) is changed above *
Then you can do from script side as follows in item_db script section:
.@item = getrandgroupitem(12246, 1);
if (.@item > 1) {
announce strcharinfo(PC_NAME) +" Got "+ getitemname(.@item) +" From MVA", bc_all;
}