Jump to content
  • 0

npc does not give the items


Question

Posted

guys I have a doubt I open the box not the iens

23107,Bau_Raro,Baú Raro,2,0,0,20,,,,,0xFFFFFFFF,15,2,,,,,,{ callfunc "Chest_Raro"; },{},{}

 

script

function    script    Fragment_Key    {
    if (countitem(23111) < 5) {
        dispbottom "[Baú Comum]: ATENÇÃO!";
        dispbottom "[Baú Comum]: Para criar uma "+getitemname(23110)+" você precisa de 6 "+getitemname(23111)+".";
        getitem 23111,1;
}     else{
    dispbottom "[Fragmento de Chave]: Parabéns! Você recebeu [1] "+getitemname(23110)+".";
    getitem 23110,1;
    delitem 23111,5;
}
    end;
}


function    script    Chest_Comum    {
//Configuração
    .qnt = rand(1,10);
    .item = 23111;
    .qnt2 = 1;
    
    dispbottom "[Baú Comum]: Parabéns! Você recebeu ["+(.qnt)+"] Rop's e ["+(.qnt2)+"] "+getitemname(.item)+".";
    set #CASHPOINTS,#CASHPOINTS+.@qnt;
    getitem .item,.qnt2;
    end;
}


function    script    Chest_Raro    {
//Configuração
    callfunc "F_Rand",1,603,5,617,5;
    callfunc "F_Rand",1,23111,2,23111,2;
    end;
}


function    script    Chest_Epico    {
//Configurações
    .key = 23110;
    .chest = 23108;
    .qnt = 1;

    //Verifica se o Player possui a chave    
    if (countitem(.key) < 1) {
        dispbottom "[Baú Comum]: ATENÇÃO!";
        dispbottom "[Baú Comum]: Para abrir esse baú você precisa de uma ["+getitemname(.key)+"].";
        getitem .chest,.qnt;
}     else{
    //Faz a entrega da premiação
    callfunc "F_Rand",1,23025,1,616,1,12103,1,23019,1,23026,1;
    delitem .key,.qnt;
}
    end;
}

3 answers to this question

Recommended Posts

  • 0
Posted

Hi! Look at your function Chest_Raro, F_Rand just returns a random number from the options. You still need to use getitem to give the item. Example:

.@item_id = callfunc("F_Rand",1,603,5,617,5);	//sets the variable to one of the five options.
getitem .@item_id, .@qnt;

 

  • 0
Posted
5 hours ago, Racaae said:

Oi! Veja a sua função  Chest_Raro,  F_Rand apenas retorna um número aleatório das opções. Você ainda precisa usar o getitem para fornecer o item. Exemplo:


 

*   49 :        '.' @ item _id = callfunc ("F_Rand", 1.603,5.617,5); // define a variavel para uma das cinco opções.

  • 0
Posted

F_Rand returns a random number

not a random item nor a random count

and float is not valid for rathena script language

so ifyou want to use the function , it's like this

.@id = callfunc ("F_Rand", 603,617,503,502); 

getitem .@id,1;

so it would be random from these set of numbers

//////////////////////////////////////////////////////////////////////////////////
// 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()));
}

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...