// fireseed_hb - fire seed and fire spawn hb void main() { object oMe=OBJECT_SELF; object oMother=GetLocalObject(oMe,"oMother"); string sRes=GetResRef(oMe); object oEnemy=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oMe,1,CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_ENEMY); if (oEnemy==OBJECT_INVALID||oMother==OBJECT_INVALID) { // despawn if (sRes=="firespawn") { // fireball AssignCommand(oMe,ClearAllActions(TRUE)); AssignCommand(oMe,ActionCastSpellAtLocation(SPELL_FIREBALL,GetLocation(oMe),METAMAGIC_ANY,TRUE)); } // fireball DelayCommand(1.0,DestroyObject(oMe)); } // despawn else { // enemy exists if (GetDistanceBetween(oMe,oMother)>20.0) { // too far from mother AssignCommand(oMe,ClearAllActions(TRUE)); AssignCommand(oMe,ActionMoveToObject(oMother,TRUE,4.0)); } // too far from mother } // enemy exists ExecuteScript("nw_c2_default1", OBJECT_SELF); }