Jump to content

Home

Remove Item script


moda

Recommended Posts

This should do the job:

 

void main() {

object oDestroy = GetFirstItemInInventory( GetFirstPC() );

while( GetIsObjectValid( oDestroy ) ) {

if( GetTag( oDestroy ) == "chem_00001" )

DestroyObject( oDestroy, 0.00, FALSE, 0.00 );

oDestroy = GetNextItemInInventory( GetFirstPC() );

}

}

Link to comment
Share on other sites

yes but that will destroy all chemicals in my inventory

 

edit heres my current code

 


void main()  
{

object oPC = GetSpellTargetObject();
  int nSubtract = 1; 
  int nRand = d3( 1 );
  int int3 = 1; 
  int inte = 1;
  int destroy = 500;
  object oDestroy = GetFirstItemInInventory( GetFirstPC() );

while( GetIsObjectValid( oDestroy ) ) {
if( GetTag( oDestroy ) == "chem_00001" )
if (GetItemStackSize(oDestroy) <= 500)
{

  switch( nRand ) { 
     case 1: 
        AdjustCreatureAttributes( oPC, ABILITY_STRENGTH, nSubtract ); 
        break; 
     case 2: 
        AdjustCreatureAttributes( oPC, ABILITY_DEXTERITY, nSubtract ); 
        break; 
     case 3: 
        AdjustCreatureAttributes( oPC, ABILITY_CONSTITUTION, nSubtract ); 
        break; 
   }
  switch( nRand ) { 
     case 1: 
        AdjustCreatureAttributes( oPC, ABILITY_STRENGTH, nSubtract ); 
        break; 
     case 2: 
        AdjustCreatureAttributes( oPC, ABILITY_DEXTERITY, nSubtract ); 
        break; 
     case 3: 
        AdjustCreatureAttributes( oPC, ABILITY_CONSTITUTION, nSubtract ); 
        break; 
   }
  int nRand2 = d3( 1 ); 
  switch( nRand2 ) { 
     case 1: 
        AdjustCreatureAttributes( oPC, ABILITY_WISDOM, -1 ); 
        break; 
     case 2: 
        AdjustCreatureAttributes( oPC, ABILITY_CHARISMA, -1 ); 
        break; 
     case 3: 
        AdjustCreatureAttributes( oPC, ABILITY_INTELLIGENCE, -1 ); 
        break; 
   }
while (inte > destroy){
while( GetIsObjectValid( oDestroy ) ) {
if( GetTag( oDestroy ) == "chem_00001" )
DestroyObject( oDestroy, 0.00, FALSE, 0.00 );
destroy = destroy -1;
oDestroy = GetNextItemInInventory( GetFirstPC() );
}
}
}
}
}

Link to comment
Share on other sites

Try this, I'm not sure if it will compile though

 

void main() {

object oDestroy = GetFirstItemInInventory( GetFirstPC() );

int count = 0;

 

while(GetIsObjectValid( oDestroy ) ) {

if( count <= 500 && GetTag( oDestroy ) == "chem_00001" )

count++;

DestroyObject( oDestroy, 0.00, FALSE, 0.00 );

oDestroy = GetNextItemInInventory( GetFirstPC() );

}

}

Link to comment
Share on other sites

i tried rewriting it as


void main()  
{

object oPC = GetSpellTargetObject();
  int nSubtract = 1; 
  int nRand = d3( 1 );
  int int3 = 1; 
  object oDestroy = GetFirstItemInInventory( GetFirstPC() );
int count = 0;

while(GetIsObjectValid( oDestroy ) ) {
if( count <= 500 && GetTag( oDestroy ) == "chem_00001" )
count++;
DestroyObject( oDestroy, 0.00, FALSE, 0.00 );
oDestroy = GetNextItemInInventory( GetFirstPC() );
}
if(count =500){


  switch( nRand ) { 
     case 1: 
        AdjustCreatureAttributes( oPC, ABILITY_STRENGTH, nSubtract ); 
        break; 
     case 2: 
        AdjustCreatureAttributes( oPC, ABILITY_DEXTERITY, nSubtract ); 
        break; 
     case 3: 
        AdjustCreatureAttributes( oPC, ABILITY_CONSTITUTION, nSubtract ); 
        break; 
   }
  switch( nRand ) { 
     case 1: 
        AdjustCreatureAttributes( oPC, ABILITY_STRENGTH, nSubtract ); 
        break; 
     case 2: 
        AdjustCreatureAttributes( oPC, ABILITY_DEXTERITY, nSubtract ); 
        break; 
     case 3: 
        AdjustCreatureAttributes( oPC, ABILITY_CONSTITUTION, nSubtract ); 
        break; 
   }
  int nRand2 = d3( 1 ); 
  switch( nRand2 ) { 
     case 1: 
        AdjustCreatureAttributes( oPC, ABILITY_WISDOM, -1 ); 
        break; 
     case 2: 
        AdjustCreatureAttributes( oPC, ABILITY_CHARISMA, -1 ); 
        break; 
     case 3: 
        AdjustCreatureAttributes( oPC, ABILITY_INTELLIGENCE, -1 ); 
        break; 
   }
}
}


 

but it now just destroys all items in my inventory

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...