HollownessDevoured Posted April 15, 2023 Share Posted April 15, 2023 First off, yes, my UTCs are set to interactive. I believe it is a script making them ambient. And unlike the Ostagar NPCs that can go from Ambient to interactive this one doesn't. I am not very good at mods, but usually I can make a few edits, so I need assistance. Any suggestions on how to make these scripts turn them interactive? bhm100cr_classroom3_stud: #include "log_h" #include "utility_h" #include "wrappers_h" #include "events_h" #include "plt_bhm_generic_actions" #include "sys_ambient_h" #include "bhm_constants_h" void main() { event ev = GetCurrentEvent(); int nEventType = GetEventType(ev); string sDebug; object oPC = GetHero(); object oParty = GetParty(oPC); int nEventHandled = FALSE; switch(nEventType) { case EVENT_TYPE_AMBIENT_CONTINUE: { SetObjectInteractive(oSelf, TRUE); SetObjectInteractive(oMentor, TRUE); break; } case EVENT_TYPE_CUSTOM_EVENT_01: { int nCount = GetLocalInt(OBJECT_SELF, CREATURE_COUNTER_1); event evDrop = Event(EVENT_TYPE_CUSTOM_EVENT_02); //Recharge mana SetCreatureMana(OBJECT_SELF, GetCreatureMaxMana(OBJECT_SELF)); //Cast spell shield WR_AddCommand(OBJECT_SELF, CommandUseAbility(ABILITY_SPELL_SPELL_SHIELD, OBJECT_SELF, [0.0, 0.0, 0.0]), TRUE); if(nCount == 0) { SetLocalInt(OBJECT_SELF, CREATURE_COUNTER_1, 1); } if(nCount == 1) { DelayEvent(10.0f, OBJECT_SELF, evDrop); SetLocalInt(OBJECT_SELF, CREATURE_COUNTER_1, 2); } break; } case EVENT_TYPE_CUSTOM_EVENT_02: { int nAmb = GetLocalInt(OBJECT_SELF, CREATURE_COUNTER_1); //WR_SetPlotFlag(PLT_BHM_GENERIC_ACTIONS, STUDENT_PREPARES_DEFENSE, FALSE); //WR_SetPlotFlag(PLT_BHM_GENERIC_ACTIONS, MENTOR_CASTS_SPELL_1, FALSE); RemoveAllEffects(OBJECT_SELF); if(nAmb == 2) { // The student will move to a new position. UT_QuickMove(GetTag(OBJECT_SELF)); Ambient_Start(OBJECT_SELF, AMBIENT_SYSTEM_ENABLED, AMBIENT_MOVE_NONE, AMBIENT_MOVE_PREFIX_NONE, 75, AMBIENT_ANIM_FREQ_ORDERED); // So will the mentor UT_QuickMove(BHM_CR_CLASSROOM_3_MENTOR); object oMentor = UT_GetNearestObjectByTag(OBJECT_SELF, BHM_CR_CLASSROOM_3_MENTOR); Ambient_Start(oMentor, AMBIENT_SYSTEM_ENABLED, AMBIENT_MOVE_NONE, AMBIENT_MOVE_PREFIX_NONE, 76, AMBIENT_ANIM_FREQ_ORDERED); SetLocalInt(OBJECT_SELF, CREATURE_COUNTER_1, 3); } break; } } if (!nEventHandled) { HandleEvent(ev, RESOURCE_SCRIPT_CREATURE_CORE); } } Maybe bhm100cr_mentor3 too: #include "log_h" #include "utility_h" #include "wrappers_h" #include "events_h" #include "bhm_constants_h" #include "plt_bhm_generic_actions" void main() { event ev = GetCurrentEvent(); int nEventType = GetEventType(ev); string sDebug; object oPC = GetHero(); object oParty = GetParty(oPC); int nEventHandled = FALSE; switch(nEventType) { case EVENT_TYPE_AMBIENT_CONTINUE: { /*int iRand = Random(15); if(iRand == 0 && WR_GetPlotFlag(PLT_BHM_GENERIC_ACTIONS, STUDENT_PREPARES_MAGE_CASTS) == FALSE) //1 in 15 chance of firing a dialogue but not if it is currently "playing" { WR_SetPlotFlag(PLT_BHM_GENERIC_ACTIONS, STUDENT_PREPARES_MAGE_CASTS, TRUE, TRUE); }*/ break; } case EVENT_TYPE_CUSTOM_EVENT_01: { //Recharge mana SetCreatureMana(OBJECT_SELF, GetCreatureMaxMana(OBJECT_SELF)); //Get the student target object oStud = GetObjectByTag(BHM_CR_CLASSROOM_3_STUDENT); //Cast fireball WR_AddCommand(OBJECT_SELF, CommandUseAbility(ABILITY_SPELL_FIREBALL, oStud, [0.0, 0.0, 0.0]), TRUE); break; } case EVENT_TYPE_CUSTOM_EVENT_02: { UT_Talk(OBJECT_SELF, OBJECT_SELF); //Unset this plot WR_SetPlotFlag(PLT_BHM_GENERIC_ACTIONS, STUDENT_PREPARES_MAGE_CASTS, FALSE); break; } case EVENT_TYPE_CUSTOM_EVENT_03: { //Recharge mana SetCreatureMana(OBJECT_SELF, GetCreatureMaxMana(OBJECT_SELF)); //Get the student target object oStud = GetObjectByTag(BHM_CR_CLASSROOM_3_STUDENT); //Cast mana cleanse WR_AddCommand(OBJECT_SELF, CommandUseAbility(ABILITY_SPELL_MANA_CLEANSE, oStud, [0.0, 0.0, 0.0]), TRUE); break; } } if (!nEventHandled) { HandleEvent(ev, RESOURCE_SCRIPT_CREATURE_CORE); } } Example script pre100pt_ambient: #include "log_h" #include "utility_h" #include "wrappers_h" #include "plot_h" #include "plt_pre100pt_ambient" #include "pre_objects_h" #include "sys_ambient_h" int StartingConditional() { event eParms = GetCurrentEvent(); // Contains all input parameters int nType = GetEventType(eParms); // GET or SET call string strPlot = GetEventString(eParms, 0); // Plot GUID int nFlag = GetEventInteger(eParms, 1); // The bit flag # being affected object oParty = GetEventCreator(eParms); // The owner of the plot table for this script object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any int nResult = FALSE; // used to return value for DEFINED GET events object oPC = GetHero(); plot_GlobalPlotHandler(eParms); // any global plot operations, including debug info if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only { int nValue = GetEventInteger(eParms, 2); // On SET call, the value about to be written (on a normal SET that should be '1', and on a 'clear' it should be '0') int nOldValue = GetEventInteger(eParms, 3); // On SET call, the current flag value (can be either 1 or 0 regardless if it's a set or clear event) // IMPORTANT: The flag value on a SET event is set only AFTER this script finishes running! switch(nFlag) { case PRE_AMBIENT_EVANGELIST_SPEECH: { object oEvangelist = UT_GetNearestCreatureByTag(oPC, PRE_CR_EVANGELIST); if(nValue == 1) { SetObjectInteractive(oEvangelist, FALSE); } else { SetObjectInteractive(oEvangelist, TRUE); } break; } case PRE_AMBIENT_SERGEANT_TALK: { object oSergeant = UT_GetNearestCreatureByTag(oPC, PRE_CR_SERGEANT); if(nValue == 1) { SetObjectInteractive(oSergeant, FALSE); } else { SetObjectInteractive(oSergeant, TRUE); } break; } case PRE_AMBIENT_GOSSIP_TALK: { object oGossip1 = UT_GetNearestCreatureByTag(oPC, PRE_CR_GOSSIP_1); object oGossip2 = UT_GetNearestCreatureByTag(oPC, PRE_CR_GOSSIP_2); if(nValue == 1) { SetObjectInteractive(oGossip1, FALSE); SetObjectInteractive(oGossip2, FALSE); } else { SetObjectInteractive(oGossip1, TRUE); SetObjectInteractive(oGossip2, TRUE); } break; } case PRE_AMBIENT_EVANGELIST_END_3: { object oEvangelistTalkTrig = UT_GetNearestObjectByTag(oPC, PRE_TR_EVANGELIST_TALK); object oAudience1 = UT_GetNearestObjectByTag(oPC, PRE_CR_AUDIENCE_1); object oAudience2 = UT_GetNearestObjectByTag(oPC, PRE_CR_AUDIENCE_2); object oAudience3 = UT_GetNearestObjectByTag(oPC, PRE_CR_AUDIENCE_3); object oAudience4 = UT_GetNearestObjectByTag(oPC, PRE_CR_AUDIENCE_4); object oAudience5 = UT_GetNearestObjectByTag(oPC, PRE_CR_AUDIENCE_5); object oAudience6 = UT_GetNearestObjectByTag(oPC, PRE_CR_AUDIENCE_6); object oAudience7 = UT_GetNearestObjectByTag(oPC, PRE_CR_AUDIENCE_7); WR_SetObjectActive(oEvangelistTalkTrig, FALSE); UT_QuickMove(PRE_CR_EVANGELIST, "3", FALSE, TRUE, TRUE, TRUE); UT_ExitDestroy(oAudience1, FALSE, "mp_pre100cr_soldier_fem_1", FALSE); Ambient_Start(oAudience2, AMBIENT_SYSTEM_ENABLED, 9, "mp_audience2", 28, 3.3f); UT_ExitDestroy(oAudience3, FALSE, "pre100wp_kings_highway", FALSE); Ambient_Start(oAudience4, AMBIENT_SYSTEM_ENABLED, 9, "mp_audience4", 24, 1.6f); Ambient_Start(oAudience5, AMBIENT_SYSTEM_ENABLED, 9, "mp_audience5", 28, 3.7f); Ambient_Start(oAudience6, AMBIENT_SYSTEM_ENABLED, 9, "mp_audience6", 68, -1.0f); UT_ExitDestroy(oAudience7, FALSE, "pre100wp_from_wilds", FALSE); //UT_QuickMove(PRE_CR_AUDIENCE_1, "3", FALSE, TRUE, TRUE, TRUE); break; } case PRE_AMBIENT_GOSSIP_END_3: { object oGossipTalkTrig = UT_GetNearestObjectByTag(oPC, PRE_TR_GOSSIP_TALK); WR_SetObjectActive(oGossipTalkTrig, FALSE); UT_QuickMove(PRE_CR_GOSSIP_1, "6", FALSE, TRUE, TRUE, TRUE); UT_QuickMove(PRE_CR_GOSSIP_2, "6", FALSE, TRUE, TRUE, TRUE); break; } case PRE_AMBIENT_SERGEANT_END_3: { object oSergeantTalkTrig = UT_GetNearestObjectByTag(oPC, PRE_TR_SERGEANT_TALK); WR_SetObjectActive(oSergeantTalkTrig, FALSE); break; } case PRE_AMBIENT_SPRITE_ARMY_BARK: { object oSoldier = UT_GetNearestCreatureByGroup(oPC, GROUP_FRIENDLY); PlaySoundSet(oSoldier, SS_COMBAT_BATTLE_CRY, 1.0); break; } case PRE_AMBIENT_SPRITE_ARMY_BARK_2: { object oSoldier = UT_GetNearestCreatureByGroup(oPC, GROUP_FRIENDLY); PlaySoundSet(oSoldier, SS_COMBAT_ATTACK, 1.0); break; } case PRE_AMBIENT_SPRITE_ARMY_BARK_3: { object oSoldier = UT_GetNearestCreatureByGroup(oPC, GROUP_FRIENDLY); PlaySoundSet(oSoldier, SS_COMBAT_ENEMY_KILLED, 1.0); break; } case PRE_AMBIENT_KNIGHT_STEALING_WALKS_AWAY: { UT_QuickMove(PRE_CR_KNIGHT_STEALING, PRE_WP_KNIGHT_STEALING_BY_TENT, FALSE, TRUE, TRUE, TRUE); break; } } } else // EVENT_TYPE_GET_PLOT -> defined conditions only { switch(nFlag) { } } plot_OutputDefinedFlag(eParms, nResult); return nResult; } Link to comment Share on other sites More sharing options...
Pasquale1223 Posted April 15, 2023 Share Posted April 15, 2023 It looks to me like that first script is already coded to set them both interactive if/when it is invoked with an EVENT_TYPE_AMBIENT_CONTINUE event. I don't know whether it ever gets invoked with that event, though. It looks like Ambient_Start is called for both characters after they finish going through the lesson. If you're sure you want to do that (usual disclaimers about changing vanilla code): You could replace the calls to Ambient_Start with calls to SetObjectInteractive. You may or may not like the behavior. It may or may not break something else. Link to comment Share on other sites More sharing options...
HollownessDevoured Posted April 15, 2023 Author Share Posted April 15, 2023 (edited) It won't compile with this switch out and gives this error: E: 08:50:07 - bhm100cr_classroom3_stud.nss - bhm100cr_classroom3_stud.nss(93): Declaration does not match parameters (SetObjectInteractive) (while compiling var_constants_h.nss) And just in case you are wondering, yes, I wait till they get to the chalkboard every time. Edited April 15, 2023 by HollownessDevoured Link to comment Share on other sites More sharing options...
Recommended Posts