Aller au contenu

Photo

Drop Rates?/Item Drop Chances?


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
TheUntoldLyric

TheUntoldLyric
  • Members
  • 2 messages
I'm not sure where to ask this, and a search didn't seem to have any results.

How would I go about making a item that drops from a NPC have a Drop Rate?
As in, make it so the NPC has a 75% chance to drop a specfic item?

I would like it if I have some NPCs drop quest items, but have it only drop it now and then.
How would I go about doing this?

Modifié par TheUntoldLyric, 23 novembre 2010 - 09:28 .


#2
c i p h e r

c i p h e r
  • Members
  • 261 messages
Use the Random() function (be mindful that this is pseudo-random) and put your item drop code inside that. So:

if (Random(100) > 75) { //item drop code goes here }

This code will obviously have to run in a script attached to an NPC event, like on death.

#3
Artevere

Artevere
  • Members
  • 36 messages
What Cipher said. If you are planning on making multiple NPC variations that drop multiple quest items, you'll want to create a single script and include it on the OnDeath or OnSpawn script for NPC's. The script should match the tag of the NPC to a list of NPC's that give the quest item:



#include "common_QI_script"

if((Random(100) > 75)
{
sMonsterTag = gettag(OBJECT_SELF);
oQuestItem = getQuestItem(sMonsterTag);
createitemonobject(oQuestItem);
}


//common_QI_script

getQuestItem(string sMonster)

switch(sMonster)
{
case Burly_Monster : sQITag = "Burly_Knuckles"; break;
case Weeny_Monster : sQITag = "Weeny_Knuckles"; break;
case Dumb_Monster : sQITag = "Dumb_Monster_Tongue"; break;
default : "ERROR!"
}
return sQITag;