Author Topic: Quest not ending (again)  (Read 457 times)

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Quest not ending (again)
« on: January 01, 2016, 01:02:58 pm »


               

okay not entirely sure what I did wrong here, certainly it is something very minor but it does not seem to go past the point where the plotgiver tells you that he will open the door and reward you when you show proof of the deed you agreed to.


 


QG- Wanna kill vilain for me?


P- Yes


QG- Actiontakentab




#include "pqj_inc"

void main()

{

    // Set the variables

    SetLocalInt(GetPCSpeaker(), "p002state", 100);

// Get the PC who is in this conversation.

    object oPC = GetPCSpeaker();

 

    // Update the player's journal.

    AddPersistentJournalQuestEntry("p002", 1, oPC, FALSE);

 

object oTarget;

 

 

    // Unlock and open "DOOR_TO_CHICKEN_HOUSE".

    oTarget = GetObjectByTag("DOOR_TO_CHICKEN_HOUSE");

    SetLocked(oTarget, FALSE);

    AssignCommand(oTarget, ActionOpenDoor(oTarget));

}

 

 



 



QG- Got the head? (Textg appears when)




int StartingConditional()

{

 

    // Inspect local variables

     if (!(GetLocalInt(GetPCSpeaker(), "NW_JOURNAL_ENTRY" + "p002") == 1))

        return FALSE;

 

    return TRUE;

}

 

 



 


P- Yes (TAW)




int StartingConditional()

{

int nShow = OBJECT_INVALID != GetItemPossessedBy(GetPCSpeaker(), "ChickenHead");

return nShow;

}

 

 



 




QG-  reward




#include "pqj_inc"

void main()

{

    // Give the speaker some gold

    GiveGoldToCreature(GetPCSpeaker(), 150);

 

    // Give the speaker some XP

    GiveXPToCreature(GetPCSpeaker(), 200);

 

 

    // Remove items from the player's inventory

    object oItemToTake;

    oItemToTake = GetItemPossessedBy(GetPCSpeaker(), "ChickenHead");

    if(GetIsObjectValid(oItemToTake) != 0)

        DestroyObject(oItemToTake);

    // Set the variables

    SetLocalInt(GetPCSpeaker(), "p002state", 300);

// Get the PC who is in this conversation.

    object oPC = GetPCSpeaker();

 

    // Update the player's journal.

    AddPersistentJournalQuestEntry("p002", 3, oPC, FALSE);

 

 

object oTarget;

 

 

    // Close and lock "DOOR_TO_CHICKEN_HOUSE".

    oTarget = GetObjectByTag("DOOR_TO_CHICKEN_HOUSE");

    AssignCommand(oTarget, ActionCloseDoor(oTarget));

    SetLocked(oTarget, TRUE);

}

 

 



 



okay so what did I do wrong here?



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Quest not ending (again)
« Reply #1 on: January 01, 2016, 01:52:12 pm »


               

Is there a starting conditional on the first QG option, or is the "got the head?" one listed first?


 


Aside from some parts that are hard to read, that looks like it should be working otherwise. If you have the "wanna kill villian?" line first with no TAW then it will fire all the time.



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Quest not ending (again)
« Reply #2 on: January 02, 2016, 05:12:09 am »


               


int StartingConditional()

{

int nShow = !GetLocalInt(OBJECT_SELF, "p002began");

return nShow;

}

 

 



 



is the line when you first speak with the QG



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Quest not ending (again)
« Reply #3 on: January 02, 2016, 01:42:01 pm »


               

And you are setting that variable ("p002began")  to TRUE where?


 


You could probably change that starting conditional to something like this, since you want it to return TRUE if and only if the quest has not been started (JOURNAL state is 0):



if (GetLocalInt(GetPCSpeaker(), "NW_JOURNAL_ENTRY" + "p002") == 0)
        return TRUE;
    return FALSE;

If you use p002began elsewhere then you probably want to set it in that first actiontaken you listed.



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Quest not ending (again)
« Reply #4 on: January 03, 2016, 08:40:23 am »


               


And you are setting that variable ("p002began")  to TRUE where?


 


You could probably change that starting conditional to something like this, since you want it to return TRUE if and only if the quest has not been started (JOURNAL state is 0):



if (GetLocalInt(GetPCSpeaker(), "NW_JOURNAL_ENTRY" + "p002") == 0)
        return TRUE;
    return FALSE;

If you use p002began elsewhere then you probably want to set it in that first actiontaken you listed.




 


now i did that and the quest no longer works at the point you got to return the item xD


               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Quest not ending (again)
« Reply #5 on: January 03, 2016, 08:48:23 am »


               

okay found out what the problem was here, it was the starting conditions on the second time you speak to the QG, it was set to check for the wrong phase of the quest! Thanks for your help guys! '<img'>