Author Topic: is this wrong?  (Read 452 times)

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
is this wrong?
« on: November 11, 2013, 01:19:53 am »


               so i have this statue the player will touch set as plot and useable with this script in the on used tab:

 #include "pqj_inc"//Put this script OnUsedvoid main(){   object oPC = GetLastUsedBy();   object oItem;   {   if (!GetIsPC(oPC)) return;   if (GetItemPossessedBy(oPC, "plot_quill")== OBJECT_INVALID)      return;   if (GetItemPossessedBy(oPC, "plot_parchment")== OBJECT_INVALID)      return;   if(RetrieveQuestState("q_pirates", GetLastUsedBy()) == 0)      return;   }
CreateItemOnObject("plot_p_note", oPC);AddJournalQuestEntry("q_pirates", 10, oPC, FALSE, FALSE);}

it compiles and all, but dosn't seem to work. no update or note is given. obviously i'm thinking i did something wrong, but im no scripter, so please help me if you can.

thanks
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
is this wrong?
« Reply #1 on: November 11, 2013, 02:59:59 am »


               See if the tags match the intended items.  Capitalization could be an issue.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
is this wrong?
« Reply #2 on: November 11, 2013, 08:47:41 am »


               #include "pqj_inc"
//Put this script OnUsed
void main()
{
    object oPC = GetLastUsedBy();
    object oItem;
    {
    if (!GetIsPC(oPC)) return;
    if (GetItemPossessedBy(oPC, "plot_quill")== OBJECT_INVALID) return;
    if (GetItemPossessedBy(oPC, "plot_parchment")== OBJECT_INVALID) return;
    if (RetrieveQuestState("q_pirates", oPC) == 0) return;
    }
    CreateItemOnObject("plot_p_note", oPC);
    AddJournalQuestEntry("q_pirates", 10, oPC, FALSE, FALSE);
}

If I'm looking at the script right:

Declared "object oItem" but didn't use it in the script.

A couple extra curly brackets you don't need.

You already have object oPC declared as GetLastUsedBy(). Might as well use it instead.

And finally it's always kinda fun to add debug messages in your script to tell you in testing where you're getting hung up:

#include "pqj_inc"
//Put this script OnUsed
void main()
{
    object oPC = GetLastUsedBy();
    SendMessageToPC(oPC, "Ok you used the item...");
    if (!GetIsPC(oPC))
    {
        SendMessageToPC(oPC, "You are not a pc..return");
        return;
    }
    if (GetItemPossessedBy(oPC, "plot_quill")== OBJECT_INVALID)
    {
        SendMessageToPC(oPC, "You don't have the plot_quill...return");
        return;
    }
    if (GetItemPossessedBy(oPC, "plot_parchment")== OBJECT_INVALID)
    {
        SendMessageToPC(oPC, "You don't have plot_parchment...return");
        return;
    }
    if (RetrieveQuestState("q_pirates", oPC) == 0)
    {
        SendMessageToPC(oPC, "q_pirates quest state at zero...return");
        return;
    }
    CreateItemOnObject("plot_p_note", oPC);
    AddJournalQuestEntry("q_pirates", 10, oPC, FALSE, FALSE);
}

Hope it helps.
               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
is this wrong?
« Reply #3 on: November 12, 2013, 12:48:33 am »


               so ty ghost for the debugs. im not sure how the debug works, but i did get 2 messages when testing.

first : Ok you used the item...
second : q_pirates quest state at zero...return

no other messages were given and no journal update and no note given. i've checked all the tags on all plot items involved and all are correct. thanks again.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
is this wrong?
« Reply #4 on: November 12, 2013, 02:34:55 am »


               This means that the script does not think that you have begun the quest.  If the quest is displayed in your quest log, then check the quest name "q_pirates" against what it was originally named.
               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
is this wrong?
« Reply #5 on: November 12, 2013, 04:18:56 am »


               well the quest is not supposed to be started yet. this is the start.

AddJournalQuestEntry("q_pirates", 10, oPC, FALSE, FALSE);

this is the first entry of the quest journal as i do them in intervals of 10, 20 being step 2. in this script there's supposed to be a check to see if the quest has been started and add if not, and the player has the 2 required items, they get the first update and the note to go on to the second part.

if it matters at all, i'm using the sea idol placeable, set to plot and useable for this. i have the script in the OnUsed tab as well.

the quest enty does not get added either, so the last 2 lines in the script are not working for sure.
               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
is this wrong?
« Reply #6 on: November 12, 2013, 06:57:58 am »


               In that case, change this line:

if (RetrieveQuestState("q_pirates", oPC) == 0)

to this:

if (RetrieveQuestState("q_pirates", oPC) > 0)

The problem is that the line was aborting the script if the quest was not started. Instead, you want to abort if it has already been started.
               
               

               


                     Modifié par Squatting Monk, 12 novembre 2013 - 06:59 .
                     
                  


            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
is this wrong?
« Reply #7 on: November 12, 2013, 01:04:01 pm »


               thank you much monk, works now and thanks to all that replied as well... so funny that one little change makes all the difference.

thanks again guys