Jump to content
  • 0

Quick help about this script.


Critica

Question


  • Group:  Members
  • Topic Count:  82
  • Topics Per Day:  0.02
  • Content Count:  223
  • Reputation:   4
  • Joined:  02/23/12
  • Last Seen:  

-%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
Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  142
  • Topics Per Day:  0.03
  • Content Count:  511
  • Reputation:   7
  • Joined:  02/15/12
  • Last Seen:  

post in a code box

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  69
  • Reputation:   10
  • Joined:  05/14/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  82
  • Topics Per Day:  0.02
  • Content Count:  223
  • Reputation:   4
  • Joined:  02/23/12
  • Last Seen:  

thankS for the help! /no1

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