Xiskio Posted September 21, 2008 Share Posted September 21, 2008 Hi all, If I want to make sure that a certain script runs whenever the party enters combat, how would I achieve that? Is there an event I can use? If so, how do I attach the script to it? See ya Xiskio Link to comment Share on other sites More sharing options...
Kovâná Ẑelezný Posted September 21, 2008 Share Posted September 21, 2008 As far as I can tell, In K2 there is an "OnAttacked" that is used in the scripts section of a UTC file. The script looks like the right one. You will probably need to redefine "k_def_attacked1". #include "k_inc_switch" #include "k_inc_debug" void main() { ExecuteScript("k_ai_master", OBJECT_SELF, KOTOR_DEFAULT_EVENT_ON_ATTACKED); /* //Shout that I was attacked SpeakString("GEN_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK); //SpeakString("GEN_COMBAT_ACTIVE", TALKVOLUME_SILENT_TALK); if(GetCommandable() && !GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if(!GN_GetIsFighting(OBJECT_SELF)) { GN_MyPrintString("GENERIC DEBUG *************** Determine Combat Round from On Attacked"); GN_DetermineCombatRound(); //Shout that I was attacked SpeakString("GEN_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK); //SpeakString("GEN_COMBAT_ACTIVE", TALKVOLUME_SILENT_TALK); } else if(GetCurrentAction() == ACTION_QUEUEEMPTY) { GN_MyPrintString("GENERIC DEBUG *************** Determine Combat Round from On Attacked"); GN_DetermineCombatRound(); //Shout that I was attacked SpeakString("GEN_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK); } } if(GN_GetSpawnInCondition(SW_FLAG_EVENT_ON_ATTACKED)) { SignalEvent(OBJECT_SELF, EventUserDefined(1005)); } */ } Link to comment Share on other sites More sharing options...
Xiskio Posted September 22, 2008 Author Share Posted September 22, 2008 Thanks for the hint. It seems to work but not exactly as I would have wished. The event seems to be fired whenever someone is hit and not as soon as the party enters combat. I am currently looking deeper into the event handling. Any ideas where I can get some more infos about it? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.