Salk Posted May 19, 2022 Posted May 19, 2022 Hello! I was wondering if anyone has ever used the GetObjectSeen() function successfully in the KotOR game. I am trying to use it as trigger in the following code: while (GetIsObjectValid(oCreature)) { if (((GetStandardFaction(oCreature) == STANDARD_FACTION_HOSTILE_1) || (GetStandardFaction(oCreature) == STANDARD_FACTION_HOSTILE_2) || (GetStandardFaction(oCreature) == STANDARD_FACTION_INSANE)) && ((GetDistanceBetween(oCreature, oLeader) < 17.5) || (GetDistanceBetween(oCreature, oNPC2) < 17.5) || (GetDistanceBetween(oCreature, oNPC1) < 17.5))) { nCombatZone = 1; } oCreature = GetNextObjectInArea(GetArea(oSelf), OBJECT_TYPE_CREATURE); } if (IsNPCPartyMember(NPC_MISSION)) { int nUndisturbed = 0; if ((oNPC2 == OBJECT_INVALID) || (!GetObjectSeen(oNPC2, oMission))) { if ((oNPC1 == OBJECT_INVALID) || (!GetObjectSeen(oNPC1, oMission))) { nUndisturbed = 1; } } if ((GetGlobalBoolean("SURVIVAL_INSTINCT")) && ((nUndisturbed == 0) || (nCombatZone == 1) || ((!GetSoloMode()) && (GetPartyMemberCount() > 1)))) { AssignCommand(oMission, ClearAllEffects()); SetGlobalBoolean("SURVIVAL_INSTINCT", FALSE); } if ((!GetGlobalBoolean("SURVIVAL_INSTINCT")) && (nCombatZone == 0) && (nUndisturbed == 1) && (GetSoloMode() || GetPartyMemberCount() == 1)) { AssignCommand(oMission, SurvivalInstinct()); } } The goal is to verify Mission does not detect the presence of other party members so I thought of GetObjectSeen() for the purpose. There is GetLastPerceived() but it is said to be used in OnPerception scripts and that is not my case. Cheers! Quote
DarthParametric Posted May 19, 2022 Posted May 19, 2022 My own limited experience with it was not successful. One of the vanilla Xor scripts relied on it, which was probably one of the reasons why he was so broken. 1 Quote
Salk Posted May 19, 2022 Author Posted May 19, 2022 I seem to recall having also not succeeded with it in the past. What alternatives do I have (if any)? Quote
DarthParametric Posted May 19, 2022 Posted May 19, 2022 You're already doing a distance check, which would be what I would fall back to as a poor man's proxy. Quote
Guest Qui-Gon Glenn Posted May 23, 2022 Posted May 23, 2022 Custom OnPerception event? Seems like that would work essentially how you want it to. Quote
Salk Posted May 24, 2022 Author Posted May 24, 2022 Hello, Qui-Gon Glenn! 13 hours ago, Qui-Gon Glenn said: Custom OnPerception event? Seems like that would work essentially how you want it to. I thought about it too and it may be worth a try but I think there might be an issue when saving/loading the game. void main() { int nEvent = GetUserDefinedEventNumber(); if (nEvent == 2002) { object oTarget = GetLastPerceived(); if ((GetLastPerceptionSeen()) && GetIsPC(oTarget)) { // Bonus off } if ((GetLastPerceptionVanished()) && GetIsPC(oTarget)) { // Bonus on } } } Let's say I save the game after a party member was perceived. If I am not mistaken, the OnPerception event won't run when loading it again. Quote
DarthParametric Posted May 24, 2022 Posted May 24, 2022 If you want to get a better idea of what is going on, edit all the includes to change the debug logging functions to use SendMessageToPC and then recompile k_ai_master with them. The only limitation is that the feedback screen has a very small back buffer, so you'll need to be pausing every second to check it due to the volume of stuff that will be piped to it. 1 Quote
Guest Qui-Gon Glenn Posted May 24, 2022 Posted May 24, 2022 I didn't read your OP thoroughly enough. Your use case probably excludes that, making my post a little silly in retrospect. That said, my rusty out of tune brain thinks of setting a boolean. This could turn into lots of booleans, so probably a bad idea. If I knock any cobbwebs loose I'll toss an idea. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.