theravenzone
Squire
Hi Community,
I am currently working on a softcoded questing system where quests can be changed, added and managed during server runtime. My current problem is the "collect quest items" goal. When a Mobile is killed (currently using the OnKilledBy(Mobile m) from BaseCreature but that can change) all goals of all quests the killer and his party has are checked and updated. In the case of the "collect quest items" goal, a dice is rolled and compared with the chance of the quest item dropping and then the quest item should be added to the loot.
I tried to realize that this way:
The Console.WriteLine is reached so I think there is something wrong in the way I tried to realize it. Either OnKilledBy(Mobile m) is the wrong point to insert items or PackItem is the wrong method to add to loot.
Any suggestions?
I am currently working on a softcoded questing system where quests can be changed, added and managed during server runtime. My current problem is the "collect quest items" goal. When a Mobile is killed (currently using the OnKilledBy(Mobile m) from BaseCreature but that can change) all goals of all quests the killer and his party has are checked and updated. In the case of the "collect quest items" goal, a dice is rolled and compared with the chance of the quest item dropping and then the quest item should be added to the loot.
I tried to realize that this way:
Code:
public override void checkMob(Mobile m)
{
checkItem(p,null);
if (complete == true) return;
Type t = (this.goal as CollectQuestItemGoal).mobtype;
if (t != m.GetType()) return;
if (Utility.Random(100) <= (this.goal as CollectQuestItemGoal).chance)
{
Console.WriteLine("It should be packed!");
QuestItem qI = new QuestItem(1, (this.goal as CollectQuestItemGoal).itemName, (this.goal as CollectQuestItemGoal).itemID);
if (m is Mobiles.BaseCreature) (m as Mobiles.BaseCreature).PackItem(qI);
else m.AddItem(qI);
}
}
The Console.WriteLine is reached so I think there is something wrong in the way I tried to realize it. Either OnKilledBy(Mobile m) is the wrong point to insert items or PackItem is the wrong method to add to loot.
Any suggestions?