void replacetrap(object oObject) { string sResref=GetTag(oObject); int nRandom=d3(); string sRandom=IntToString(nRandom); string sWP=sResref+"_wp"+sRandom; location lLoc=GetLocation(GetWaypointByTag(sWP)); DestroyObject(oObject); CreateObject(OBJECT_TYPE_PLACEABLE,sResref,lLoc); } void main() { object oPC=GetLastDisarmed(); int nDif=GetTrapDisarmDC(OBJECT_SELF); if (GetHitDice(oPC)<2) { GiveXPToCreature(oPC,nDif/3); } ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_IMP_IMPROVE_ABILITY_SCORE),oPC); //FloatingTextStringOnCreature("*Trap disarmed*",oPC); object oChest=OBJECT_SELF; DelayCommand(120.0,replacetrap(oChest)); }