Author Topic: little help with this..  (Read 656 times)

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
little help with this..
« on: November 03, 2010, 05:25:26 am »


               so i got this script here thats supposed to check 3 things: quest state, and 2 items. then, if these things are found, do some lights and such and spawn a chest...

it compiles fine, but dosn't seem to work. heres the script:

#include "pqj_inc"
#include "nw_i0_tool"
#include "nw_i0_2q4luskan"
void main()
   {
   object oPC = GetEnteringObject();
   if (!GetIsPC(oPC))
      return;
   int nInt;
   if(RetrieveQuestState("q_ezra", oPC) == 0)
      return;
   if (GetItemPossessedBy(oPC, "b_water")== OBJECT_INVALID)
      return;
   if (GetItemPossessedBy(oPC, "e_gumroot")== OBJECT_INVALID)
      return;
   object oTarget;
      oTarget = GetObjectByTag("ezra_invis");
      nInt = GetObjectType(oTarget);
   if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_EPIC_UNDEAD), oTarget);
   else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_EPIC_UNDEAD), GetLocation(oTarget));
   location lTarget;
      oTarget = GetWaypointByTag("e_wp");
      lTarget = GetLocation(oTarget);
      DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "c_chest", lTarget));
   effect eEffect;
      eEffect = EffectVisualEffect(VFX_IMP_HARM);
      DelayCommand(2.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eEffect, lTarget));
   object oItem;
      oItem = GetFirstItemInInventory(oPC);
   while (GetIsObjectValid(oItem))
      {
      if (GetTag(oItem)=="b_water") DestroyObject(oItem);
         oItem = GetNextItemInInventory(oPC);
   }
      oItem = GetFirstItemInInventory(oPC);
   while (GetIsObjectValid(oItem))
      {
      if (GetTag(oItem)=="e_gumroot") DestroyObject(oItem);
         oItem = GetNextItemInInventory(oPC);
   }
}

if someone could see what the problem is and help me fix it, it would be appreciated.

thanks
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
little help with this..
« Reply #1 on: November 03, 2010, 06:56:20 am »


               Cleaned it up a bit for readability. If it's supposed to work the way I think it does, it should work as it is now. If it still doesn't work then let us know which part exactly isn't working. All of it? Just one thing? Etc...? If it is only certain parts then it could be something as simple as the wrong tag or resref. But anyway here ya go:


#include "pqj_inc"
#include "nw_i0_2q4luskan"
void main()
{
    object oPC = GetEnteringObject();
    if (!GetIsPC(oPC))
        return;
    if (RetrieveQuestState("q_ezra", oPC) == 0)
        return;
    if (GetItemPossessedBy(oPC, "b_water") == OBJECT_INVALID)
        return;
    if (GetItemPossessedBy(oPC, "e_gumroot") == OBJECT_INVALID)
        return;

    object oTarget;
    effect eEffect;
    location lTarget;

    oTarget = GetObjectByTag("ezra_invis");
    eEffect = EffectVisualEffect(VFX_FNF_SUMMON_EPIC_UNDEAD);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);

    oTarget = GetWaypointByTag("e_wp");
    lTarget = GetLocation(oTarget);
    eEffect = EffectVisualEffect(VFX_IMP_HARM);
    DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "c_chest", lTarget));
    DelayCommand(2.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eEffect, lTarget));

    object oItem = GetFirstItemInInventory(oPC);
    while (GetIsObjectValid(oItem))
    {
        if (GetTag(oItem) == "b_water" ||
            GetTag(oItem) == "e_gumroot")
        DestroyObject(oItem);
        oItem = GetNextItemInInventory(oPC);
    }
}


Hope that helps. Good luck.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
little help with this..
« Reply #2 on: November 03, 2010, 11:31:57 pm »


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

       return;

This line is saying if Quest state is 0 return and do nothing else.  



Is that what you wanted ?
               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
little help with this..
« Reply #3 on: November 04, 2010, 12:10:21 am »


               well, this little bit:
if(RetrieveQuestState("q_ezra", oPC) == 0)
is supposed to be, if you haven't started the quest, state = 0, and then check for the other two items, continue with the script. I really couldn't say where the error is, but i do know for sure the tags, resrefs are all correct. i spent 10 minutes checking and rechecking them to make sure of this, testing each time i checked.
if it wouldn't be too much trouble, maybe some debug lines inserted would help me... never been good with those things, hell, i didn't even thing this script would compile when i made it (major cut and paste job here)

thanks again.

oh, and your script didn't work GoG, just so you know 'Image
               
               

               
            

Legacy_Dagesh

  • Jr. Member
  • **
  • Posts: 55
  • Karma: +0/-0
little help with this..
« Reply #4 on: November 04, 2010, 01:18:59 am »


               What is not working?  Are the effects not firing?  Is the chest not being created?  All of the above?
               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
little help with this..
« Reply #5 on: November 04, 2010, 01:36:50 am »


               sorry, nothing seems to be working. I have all the requiremennts on the toon i'm useing, have the script in the trigger, have the waypoint and object for the effects to hit down.... everything is in place, just nothing is working... thats why i asked about the debug.

thanks
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
little help with this..
« Reply #6 on: November 04, 2010, 03:59:03 am »


               Give this a try:

#include "pqj_inc"
#include "nw_i0_2q4luskan"
void main()
{
    object oPC = GetEnteringObject();
    if (!GetIsPC(oPC))
    {
        ///
        SendMessageToPC(oPC, "You are not a player.");
        ///
        return;
    }
    if (RetrieveQuestState("q_ezra", oPC) == 0)
    }
        ///
        SendMessageToPC(oPC, "Your quest state is 0.");
        ///
        return;
    }
    if (GetItemPossessedBy(oPC, "b_water") == OBJECT_INVALID)
    {
        ///
        SendMessageToPC(oPC, "You do not have the item with the tag b_water.");
        ///
        return;
    }
    if (GetItemPossessedBy(oPC, "e_gumroot") == OBJECT_INVALID)
    {
        ///
        SendMessageToPC(oPC, "You do not have the item with the tag e_gumroot.");
        ///
        return;
    }

    SendMessageToPC(oPC, "You made it past all the checkpoints.");

    object oTarget;
    effect eEffect;
    location lTarget;

    oTarget = GetObjectByTag("ezra_invis");
    ///
    if (GetIsObjectValid(oTarget))
    SendMessageToPC(oPC, "ezra_invis exists.");
    ///
    eEffect = EffectVisualEffect(VFX_FNF_SUMMON_EPIC_UNDEAD);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);

    oTarget = GetWaypointByTag("e_wp");
    ///
    if (GetIsObjectValid(oTarget))
    SendMessageToPC(oPC, "e_wp exists");
    ///
    lTarget = GetLocation(oTarget);
    eEffect = EffectVisualEffect(VFX_IMP_HARM);
    DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "c_chest", lTarget));
    DelayCommand(2.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eEffect, lTarget));

    object oItem = GetFirstItemInInventory(oPC);
    while (GetIsObjectValid(oItem))
    {
        if (GetTag(oItem) == "b_water" ||
            GetTag(oItem) == "e_gumroot")
        DestroyObject(oItem);
        oItem = GetNextItemInInventory(oPC);
    }
}


If no messages show up at all, then the script probably isn't even firing.
               
               

               


                     Modifié par GhostOfGod, 04 novembre 2010 - 03:59 .
                     
                  


            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
little help with this..
« Reply #7 on: November 04, 2010, 04:24:11 am »


               ok, so i tested it, it says "state 0" but nothing else.
thats about as far as it goes.

if i drop the items, i still don't get any message stating i don't have the items.
               
               

               


                     Modifié par zero-feeling, 04 novembre 2010 - 04:26 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
little help with this..
« Reply #8 on: November 04, 2010, 04:34:37 am »


               Yes..so that is your problem. The quest state is 0 so the script ends there. If the quest state is being set on the player to anything other then 0 then it will pass this check.
So this means the quest has not been started yet. You need to check out how you are setting the quest state and make sure that it is started(not 0).
               
               

               


                     Modifié par GhostOfGod, 04 novembre 2010 - 04:35 .
                     
                  


            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
little help with this..
« Reply #9 on: November 04, 2010, 04:40:32 am »


               ok, so here is a basic check (from conversation) useing this same style

#include "pqj_inc"
int StartingConditional()
{
    if(RetrieveQuestState("q_cold", GetPCSpeaker()) == 0)
    return TRUE;
  else
    return FALSE;
}

maybe this will help in figuring out what i did wrong.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
little help with this..
« Reply #10 on: November 04, 2010, 05:24:22 am »


               In the line from your first script:

if (RetrieveQuestState("q_ezra", oPC) == 0)
       return;

You are saying that if the quest "q_ezra" is not started yet (since its on 0) then end this script now (return;).

What you have posted here:

#include "pqj_inc"
int StartingConditional()
{
    if(RetrieveQuestState("q_cold", GetPCSpeaker()) == 0)
    return TRUE;
  else
    return FALSE;
}

is basically saying that if the quest "q_ezra" has not started yet then return true and whatever line of text this is on will appear since the quest has not been started.

So the first script (I'm assuming you want it to completely fire only when the quest has been started or finished or what not?) is functioning just fine.

What you need to do is advance that journal entry when the player advances the quest. If it is in it's completed stage then maybe you will set the quest state to 1 or 10 or 100, whatever you prefer. Then your script will see that the quest has been started/finished (not 0) and the rest of the script will fire.
               
               

               


                     Modifié par GhostOfGod, 04 novembre 2010 - 05:26 .
                     
                  


            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
little help with this..
« Reply #11 on: November 04, 2010, 05:38:58 am »


               well i get what your saying, but the problem is, this is how the quest starts. the player will get clues to how to start the quest from NPC's, find the items needed, then when they open the chest that appears and take the item inside after this script runs, they will get the first update (10). if you look at the conversation script above your most recent post, it checks for 0 as well, and that script runs just fine. i'm assuming theres a way to incorperate that into this script, is there not?

thats probably where something is going wrong.

i tried adding the :

return TRUE;

 else

   return FALSE;

section to the first script, but got errors, so i came here to see if it can be fixed to RUN if :

1: they have not started the quest (quest state = 0), and 2: they have the two items....

so i want to be clear about what i'm saying cause i think theres a bit of confussion here...

i don't want the script to stop if they are at state 0, but rather continue. if they have state 10, i want it to end.

thanks
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
little help with this..
« Reply #12 on: November 04, 2010, 05:44:22 am »


               Ah ha. So then this:

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

Should be:

if (RetrieveQuestState("q_ezra", oPC) != 0)

not = to 0
So if the state is anything other than 0 then end the script.
               
               

               


                     Modifié par GhostOfGod, 04 novembre 2010 - 05:47 .
                     
                  


            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
little help with this..
« Reply #13 on: November 04, 2010, 05:48:24 am »


               HAHAHAHAAAAaaaa.......

amazing how one little ! can change everything.

thank you very much, now to test '<img'>
               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
little help with this..
« Reply #14 on: November 04, 2010, 05:51:04 am »


               ok, so now everything works all peachy keen..

thanks again for the help