Jump to content

Script hanging at startup


Recommended Posts

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 _GuardProtect

short danger
short resetnpc

if ( resetnpc == 1 )
StopCombat
set danger to 0
set resetnpc to 0
endif

if ( 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
endif
endif

if ( 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
endif
endif

End _GuardProtect

================================================================================================================

END CODE

Edited by Skibidyboparoobopadopa
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...