Okay, so I want to use a tool on a misc item. This will destroy the misc item and add a random item to the player's inventory. Right now I have the script on the target rather than the tool. The issue I can see is that right now the script just disables the target which I believe is frowned upon because it could clutter the world with disabled items. But IIRC, using a script to delete the object which holds the script will cause a CTD.
Anyway, here's the script. Any thoughts?
begin AZ_scr_clam_shuckingShort controlvarShort buttonShort ranif ( OnActivate == 1 ) if ( controlvar == 0 ) if ( Player->GetItemCount "md_misc_shucker" < 1 ) Activate else MessageBox "Kollop", "Pick up", "Pry open (shucker)" set controlvar to 1 endif endifendifif ( controlvar == 1 ) set button to GetButtonPressed if ( button == -1 ) return elseif ( button == 0 ) Activate set controlvar to 0 else PlaySound "bowPull" set ran to random 100 set controlvar to 2 if ( ran < 40 ) MessageBox "The kollop is empty" Disable elseif ( ran < 70 ) MessageBox "The kollop contained a pearl fragment" player->additem "md_misc_pearl_fragment" 1 Disable elseif ( ran < 85 ) MessageBox "The kollop contained a pearl" player->additem "ingred_pearl_01" 1 Disable elseif ( ran < 95 ) MessageBox "The kollop contained a flawless pearl!" player->additem "md_misc_pearl_flawless" 1 Disable else MessageBox "The kollop contained two flawless pearls!!" player->additem "md_misc_pearl_flawless" 2 Disable endif endifendifend
Thanks