Author Topic: Problem with Quest script  (Read 322 times)

Legacy_nagurtha

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Problem with Quest script
« on: February 03, 2013, 05:02:20 pm »


                can anyone let me know where Im falling down here? - Script to set up quest for solo or party. Just added the PC value assignments as Im not sure that faction function includes the PC or just his "other" party members. REM out the if statements to see if they were cause, but not. Compiles fine but doesnt fire from conversation.

#include "x0_i0_partywide"
#include "nw_i0_tool"
#include "pqj_inc"
void main()

object oPC = GetLastSpeaker();
string quest = GetLocalString(OBJECT_SELF, "quest");
 string questitem = GetLocalString(OBJECT_SELF, "questitem");
 string prequest = GetLocalString(OBJECT_SELF, "prequest");   
int state;

   // do the PC - not sure if needed   
state = GetCampaignInt (quest, "state", oPC);
 // if (!state > 1)      
// {       
state = 1;       
SendMessageToPC (oPC, "test"); //not showing up!       
AddPersistentJournalQuestEntry (quest, state, oPC,FALSE,FALSE);       
SetCampaignInt (quest, "state", state, oPC);       
// }   
// Get the first PC party member   
object oPM = GetFirstFactionMember(oPC, TRUE);   
CreateItemOnObject(prequest, oPC);   
// We stop when there are no more valid PC's in the party.   
while(GetIsObjectValid(oPM) == TRUE)   
{       
// Do something to party member       
state = GetCampaignInt (quest, "state", oPM);       
if (!state > 1)     
 {       
state = 1;       
AddPersistentJournalQuestEntry (quest, state, oPM,FALSE,FALSE);       
SetCampaignInt (quest, "state", state, oPM);       
}       
// Get the next PC member of oPC's faction.       
// If we put anything but oPC into this, it may be a totally       
// unreliable loop!       
oPM = GetNextFactionMember(oPC, TRUE);   
}
}
               
               

               


                     Modifié par nagurtha, 03 février 2013 - 05:13 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Problem with Quest script
« Reply #1 on: February 03, 2013, 06:51:36 pm »


               Well right off the top, you are using the wrong accesor to to get the PC.

GetLastSpeaker is used in OnConversation events.  That is the event that is set within the Creatures blueprint.  

In a conversation you need to use GetPCSpeaker to get the PC involved in the conversation.
               
               

               
            

Legacy_nagurtha

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Problem with Quest script
« Reply #2 on: February 03, 2013, 06:58:34 pm »


               Doh! thanks, Does the getfirstfaction / get next faction include the PC or just the rest of the party?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Problem with Quest script
« Reply #3 on: February 03, 2013, 07:00:22 pm »


               yes they do.  That is include the PC.
               
               

               
            

Legacy_nagurtha

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Problem with Quest script
« Reply #4 on: February 03, 2013, 07:04:11 pm »


               Thanks you very much for taking the time, will fiddle with it a bit now its firing. Having problems with the if statement I think, not sure what an empty database int returns for comparison.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Problem with Quest script
« Reply #5 on: February 04, 2013, 04:16:28 am »


               Your problem may be that the last Argument in the function ( oPC) applies to a PC only. It does not apply to a NPC. It will not store one entry of one  NPC and another one for another NPC. So if you are using oPC to try and store values for two differant NPC you are simply overriting the same value.
               
               

               


                     Modifié par Lightfoot8, 04 février 2013 - 04:17 .
                     
                  


            

Legacy_nagurtha

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Problem with Quest script
« Reply #6 on: February 04, 2013, 10:03:32 pm »


               Yep its supposed to be PC only. all the variables are on the NPC quest giver. This script sets up the journal and database entries for all PCs in the party (not henchmen etc). This one now does what it should, and the next in the chain (areaexit script) checks for items and queststate to move the journal along if the PCs get the quest item out of the quest area. Last piece to do is the reward script on turning in the item.