Jump to content
  • 0

Quick help about this script.


Question

Posted (edited)

-%tab%script%tab%INSERTNPCNAMEHERE%tab%-1,{

end;

OnNPCKillEvent:

switch(rand(10)){

case 1:

getitem xx, amount;

end;

default:

end;

}

end;

}

how can make this script do 2 random chance?

like for the first few items chances are 10%

then the 2nd list items have 5% chance..?

Edited by critica

3 answers to this question

Recommended Posts

Posted (edited)

X = Item ID

Y = Item amount

- <TAB> script <TAB> <NPCNAME> <TAB> -1,{
end;

OnNPCKillEvent:
setarray .@a[1],rand(1,100),rand(1,100); // Add as many more randoms of 1 and 100 as you want.
if(.@a[1]<=10){ // Less than or equal to 10 would mean 10% chance
getitem X,Y;
end;}
if(.@a[2]<=5){ // Less than or equal to 5 would mean 5% chance
getitem X,Y;
end;}
}

Also, I used an array so that if the number is less than 5, it won't give both items.

Here's one in which you can get both items:

- <TAB> script <TAB> <NPCNAME> <TAB> -1,{
end;

OnNPCKillEvent:
setarray .@a,rand(1,100); // Add as many more randoms of 1 and 100 as you want.
if(.@a<=10){ // Less than or equal to 10 would mean 10% chance
getitem X,Y;
end;}
if(.@a<=5){ // Less than or equal to 5 would mean 5% chance
getitem X,Y;
end;}
}

Edited by Joey

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