Assigning Dialogue to NPCs Problem 2575 0

O temacie

Autor Vic7im

Zaczęty 19.03.2018 roku

Wyświetleń 2575

Odpowiedzi 0

Vic7im

Vic7im

Użytkownicy
posty84
Propsy92
Profesjabrak
  • Użytkownicy
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. I wanted to share it but it doesn't work XD

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
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
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

func void b_assigncatchertalk(var C_Npc slf)
{
    if(Hlp_GetInstanceID(slf) == Hlp_GetInstanceID(thiefcatcher))
    {
        b_assigntalkgotyou(slf);       
    };
};

This is B_AssignTalkGotYou()
Spoiler
func void B_AssignTalkGotYou(var C_Npc slf)
{
    dia_assigntalkgotyou.npc = Hlp_GetInstanceID(slf);
};

And then the dialogues:
Spoiler
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!
 


0 użytkowników i 1 Gość przegląda ten wątek.
0 użytkowników
Do góry