Whenever checking player's inventory, it is just a good habit to throw lines that prevent the rest of the script from running if a required object is not found. Inventories are such sensitive matters.
Both the OC and player-made modules are great showcases of the good old "drop your moneybags on the ground" trick to get out of actually paying fines, bribes, tips, etc.
Also has teh revision suggested by Li'l Rose
void main()
{
// Get the PC who is in this conversation.
object oPC = GetPCSpeaker();
// Let's declare the fishfood object outside of the switch
object oFishFood = GetItemPossessedBy(oPC, "b_feed_Fish");
// ...And only take action if the fishfood exists
if (oFishFood == OBJECT_INVALID) return;
DestroyObject(oFishFood);
// Decide what to do based on a die roll.
switch ( d20() )
{
case 1:
{
Print("Shark Attack!!!");
ApplyEffectToObject(0, EffectVisualEffect(VFX_FNF_UNDEAD_DRAGON), oPC);
}
break;
default:
{
Print("Fish Successfully Fed.");
}
break;
}
}