Skibidyboparoobopadopa Posted June 12, 2014 Share Posted June 12, 2014 (edited) This script is attached to my custom guards. This method worked for an npc Citizen targeting the player or another npc, but not for multiple targets. It tells me it cannot find an object (Custom Bandit NPC) and crashes my game when I click new game. I was looking through the functions available and it seems like there is none for getting an NPC's current cell. Only the Players. I need a way to compare both NPC's Cells, without the script actually referencing that object unless the cells match, otherwise ending the script. Looks like morrowind scripting is extremely limited. Can anyone throw some ideas my way that would help? CODE:===============================================================================================================Begin _GuardProtectshort dangershort resetnpcif ( resetnpc == 1 ) StopCombat set danger to 0 set resetnpc to 0endifif ( danger != 1 ) if ( GetDistance, "_Bandit_Archer_F_B" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_F_B_T_1" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_F_B_T_2" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_F_B_T_3" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_F_D" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_F_D_T_1" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_F_D_T_2" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_F_D_T_3" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_F_I" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_F_I_T_1" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_F_I_T_2" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_F_I_T_3" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_B" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_B_T_1" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_B_T_2" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_B_T_3" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_D" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_D_T_1" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_D_T_2" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_D_T_3" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_I" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_I" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_I_T_1" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_I_T_2" < 300 ) set danger to 1 elseif ( GetDistance, "_Bandit_Archer_M_I_T_3" < 300 ) set danger to 1 else return endifendifif ( danger == 1 ) if ( GetDistance, "_Bandit_Archer_F_B" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_F_B" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_F_B_T_1" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_F_B_T_1" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_F_B_T_2" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_F_B_T_2" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_F_B_T_3" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_F_B_T_3" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_F_D" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_F_D" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_F_D_T_1" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_F_D_T_1" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_F_D_T_2" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_F_D_T_2" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_F_D_T_3" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_F_D_T_3" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_F_I" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_F_I" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_F_I_T_2" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_F_I_T_2" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_F_I_T_3" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_F_I_T_3" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_M_B" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_M_B" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_M_B_T_1" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_M_B_T_1" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_M_B_T_2" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_M_B_T_2" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_M_B_T_3" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_M_B_T_3" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_M_D" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_M_D" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_M_D_T_1" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_M_D_T_1" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_M_D_T_2" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_M_D_T_2" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_M_D_T_3" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_M_D_T_3" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_M_I" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_M_I" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_M_I_T_1" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_M_I_T_1" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_M_I_T_2" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_M_I_T_2" > 350 ) set resetnpc to 1 endif if ( GetDistance, "_Bandit_Archer_M_I_T_3" < 250 ) StartCombat Player elseif ( GetDistance, "_Bandit_Archer_M_I_T_3" > 350 ) set resetnpc to 1 endifendifEnd _GuardProtect================================================================================================================END CODE Edited June 12, 2014 by Skibidyboparoobopadopa Link to comment Share on other sites More sharing options...
Recommended Posts