Hello everyone, I'm having a little bit of an issue with assigning dialogues to NPCs.
I've managed to create a thieving system similar to Gothic 1, based on Returning 2.0's code.
If your dexterity is lower than the target's, they should turn around and start a conversation with you where you can try to talk your way out or get attacked.
Problem is, I can't get them to talk, at all. The Npcs turn around, look at me for a split second, then go back to their duties, if I talk to them they won't recognize the theft and act normal.
Going logically from point A to point B, this is the code of what happens.
Hero gets caught by focused NPC
Spoiler:(zum lesen bitte Text markieren)Code:var oCNpc _hero; _hero = Hlp_GetNpc(PC_HERO); var c_npc pNpc; pNpc = MEM_PtrToInst(_hero.focus_vob); var C_NPC thiefcatcher; [...] if(pNpc.aivar[AIV_PlayerHasPickedMyPocket] == FALSE && !Npc_CanSeeNpc(pNpc,hero)&& hero.attribute[ATR_DEXTERITY] < pNpc.attribute[ATR_DEXTERITY] && pNpc.npcType != npctype_friend) { thiefcatcher = hlp_getnpc(pNpc); hero_caughtstealing = true; AI_TurnToNpc(pNpc,_hero); //npc_clearaiqueue(pNpc); b_resetthieflevel(); //b_clearperceptions(pNpc); AI_StartState(pNpc,zs_observeplayer,1,""); };
Into ZS_ObservePlayer loop I put a condition that checks if the one who's looking at the player is the one who caught him (the thiefcatcher)
Spoiler:(zum lesen bitte Text markieren)Code:func int ZS_ObservePlayer_Loop() { if(hero_caughtstealing == TRUE) { b_assigncatchertalk(self); }; [...] };
Calling B_AssignCatcherTalk() that should assign the "Got you" dialogues I wrote to the NPC that has the same ID of the thiefcatcher
Spoiler:(zum lesen bitte Text markieren)Code:func void b_assigncatchertalk(var C_Npc slf) { if(Hlp_GetInstanceID(slf) == Hlp_GetInstanceID(thiefcatcher)) { b_assigntalkgotyou(slf); }; };
This is B_AssignTalkGotYou()
Spoiler:(zum lesen bitte Text markieren)Code:func void B_AssignTalkGotYou(var C_Npc slf) { dia_assigntalkgotyou.npc = Hlp_GetInstanceID(slf); };
And then the dialogues:
Spoiler:(zum lesen bitte Text markieren)Code:instance dia_assigntalkgotyou(c_info) { nr = 1; condition = dia_assigntalkgotyou_condition; information = dia_assigntalkgotyou_info; permanent = true; important = true; }; [...] I put as condition the hero_caughtstealing variable.
I made the game print me the name of the thiefcatcher NPC to see if I did something wrong, but it correctly writes down the name of the NPC that caught me.
Problem is, I don't know why it won't talk to me.
Cheers!