Aller au contenu

Photo

more pqj questions...


  • Veuillez vous connecter pour répondre
18 réponses à ce sujet

#1
seventh_son

seventh_son
  • Members
  • 37 messages
I think his might actually be an OnDeath of NPC issue, but i am using the PQJ (Persistant Quest Journal) system and I love it, but..... I am no scripter and so far have muddled my way through using it, but somethings I have questions on. First, When a players summon creature or familiar killes a NPC that is meant to be killed as part of a quest the journal does not update for the player as the player didnt make the killing shot. can this be fixed.? I will post below my ondeath script. I dried using the Script gen. to create a new script but it gives me the exact script I am using. I need the script to update the journal and give the item to the player even if the player wasnt the killer of the NPC.

 #include "pqj_inc"

//Put this script OnDeath
void main()
{


object oPC = GetLastKiller();

while (GetIsObjectValid(GetMaster(oPC)))
{
oPC=GetMaster(oPC);
}

if (!GetIsPC(oPC)) return;

CreateItemOnObject("geo_cleagehead", oPC);
{
if(RetrieveQuestState("CLEAGE",oPC) == 1) // quest started
{
AddPersistentJournalQuestEntry("CLEAGE",2, oPC,FALSE);
}
else
{
// player has not started the quest yet, return item to chest
// CreateItemOnObject(GetResRef(oItem));
// DestroyObject(oItem);
SendMessageToPC(oPC,"You haven't started this quest yet...");
}
}
}

#2
seventh_son

seventh_son
  • Members
  • 37 messages
Nope actually i guess the script works fine... but if anyone has any ideas on how to make it so no matter who kills the NPC in the party (Player or otherwise), the player working on the quest gets the journal update and the quest item...

#3
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
This should do, as long as the PC is in the same party and can see the NPC killed.

Note: Untested.

#include "pqj_inc"
//Put this script OnDeath
void main()
{

    object oPC = GetLastKiller();
    while (GetIsObjectValid(GetMaster(oPC)))
    {
        oPC=GetMaster(oPC);
    }
    if (!GetIsPC(oPC)) return;
    CreateItemOnObject("geo_cleagehead", oPC);
    if (RetrieveQuestState("CLEAGE",oPC) != 1)
    {
       object oTest= GetFirstFactionMember(oPC);
       while (GetIsObjectValid(oTest))
       {
           if((RetrieveQuestState("CLEAGE",oTest) == 1) && GetObjectSeen(OBJECT_SELF,oTest))
           {
               oPC = oTest;
               break;
           }
           GetNextFactionMember(oPC);
       }
    }
    if(RetrieveQuestState("CLEAGE",oPC) == 1) // quest started
    {
           AddPersistentJournalQuestEntry("CLEAGE",2, oPC,FALSE);
    }
    else
    {
          // player has not started the quest yet, return item to chest
          // CreateItemOnObject(GetResRef(oItem));
          // DestroyObject(oItem);
         SendMessageToPC(oPC,"You haven't started this quest yet...");
    }
}


EDIT: corrected endless loop.

Modifié par Lightfoot8, 06 septembre 2010 - 02:50 .


#4
Shadooow

Shadooow
  • Members
  • 4 470 messages
I have, you must loop to party.

#include "pqj_inc"

//Put this script OnDeath
void main()
{
object oPC = GetLastKiller();
object oArea = GetArea(oPC);

object oPartyMember = GetFirstFactionMember(oPC,TRUE);
 while(oPartyMember != OBJECT_INVALID)
 {
  if(GetArea(oPartyMember) == oArea && GetDistanceBetween(oPC,oPartyMember) < 35.0)
  {
  CreateItemOnObject("geo_cleagehead", oPartyMember);
   if(RetrieveQuestState("CLEAGE",oPartyMember) == 1) // quest started
   {
   AddPersistentJournalQuestEntry("CLEAGE",2, oPartyMember,FALSE);
   }
   else
   {
   // player has not started the quest yet, return item to chest
   // CreateItemOnObject(GetResRef(oItem));
   // DestroyObject(oItem);
   SendMessageToPC(oPartyMember,"You haven't started this quest yet...");
   }
  }
oPartyMember = GetNextFactionMember(oPC,TRUE);
 }
}

This way, head will be given to all players doing the quest (hmm I would consider this) and they get update too.

EDIT: LightFoot8 you outrunned me again, but you didn't made exactly what I at least, so it had sense.

Modifié par ShaDoOoW, 06 septembre 2010 - 03:01 .


#5
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Yes, I was barly ahead. just to not differances for the OP. My script will only update for and give the item to one PC in the party. Shadows will Give it to all the PC's that are doing the quest in the same party.

The one thing you did miss though shadow is if the server is of the type where everyone like to party up to talk. A PC in a far off corner of the world,has Started the quest, they will get updated for the quest when they are no where around.

Edit: Shadows script is however better written. You may just want to add the dead guy seen to the check. 

Modifié par Lightfoot8, 06 septembre 2010 - 02:59 .


#6
Shadooow

Shadooow
  • Members
  • 4 470 messages

Lightfoot8 wrote...

The one thing you did miss though shadow is if the server is of the type where everyone like to party up to talk. A PC in a far off corner of the world,has Started the quest, they will get updated for the quest when they are no where around.

Yes, you are right, thanks fot catching this, I updated my script to check area and distance from killer.

EDIT: checking for GetObjectSeen might be really better, but I have not experiences with it, so I keep it this way.

Modifié par ShaDoOoW, 06 septembre 2010 - 03:04 .


#7
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

ShaDoOoW wrote...

EDIT: checking for GetObjectSeen might be really better, but I have not experiences with it, so I keep it this way.


lol,  Yes,  that is why I put my untested disclaimer on it.  I do not know if it will return correctly for the dying NPC.

#8
Shadooow

Shadooow
  • Members
  • 4 470 messages
Now as far as multiple head concerned...

This was quite issue at The Three Towns server, in past you get only one head for party (in loot), so if whole party want to fulfill the quest they must have wait in area for respawn of the boss - this was pardon me, but very stupid. Now they giving into loot multiple heads.

But giving head to each player might not be very logical and "rp". I can suggest you, not to require the head in your quest in order to finish it, but rather the quest variable - so if the quest variable will be 1000 (finish) or any other number you desire, allow PC to finish the quest, then if he got head, destroy it, if not, nevermind. If you would go this way, then it would look like this:

#include "pqj_inc"

//Put this script OnDeath
void main()
{
CreateItemOnObject("geo_cleagehead",OBJECT_SELF); // only one head will appear in loot remains
object oPC = GetLastKiller();
object oArea = GetArea(oPC);

object oPartyMember = GetFirstFactionMember(oPC,TRUE);
 while(oPartyMember != OBJECT_INVALID)
 {
  if(GetArea(oPartyMember) == oArea && GetDistanceBetween(oPC,oPartyMember) < 35.0)
  {
   if(RetrieveQuestState("CLEAGE",oPartyMember) == 1) // quest started
   {
   AddPersistentJournalQuestEntry("CLEAGE",2, oPartyMember,FALSE);
   }
   else
   {
   // player has not started the quest yet, return item to chest
   // CreateItemOnObject(GetResRef(oItem));
   // DestroyObject(oItem);
   SendMessageToPC(oPartyMember,"You haven't started this quest yet...");
   }
  }
 oPartyMember = GetNextFactionMember(oPC,TRUE);
 }
}


EDIT: also, just giving the quest variable does not tell the player whats going on. You need to add journal update, and best some message to!

Modifié par ShaDoOoW, 06 septembre 2010 - 03:35 .


#9
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
AddPersistentJournalQuestEntry("CLEAGE",2, oPartyMember,FALSE);



Is a wrapper around JournalQuestEntry So the journal does get updated.

#10
seventh_son

seventh_son
  • Members
  • 37 messages
hhhmmm... not sure I understand ShaDoOoW I do not know anything about variables. what will happen in the script...?

#11
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Basicly he is saying. When a PC goes to compleat the quest do not use the head for the test of having compleated it. Instead use



if(RetrieveQuestState("CLEAGE",oPC) == 2)



as the test and dont worry to much about them having the head or not.

#12
seventh_son

seventh_son
  • Members
  • 37 messages
im not sure I understand still, the script he provided is still creating "geo_cleagehead" on the player. What should the script look like if it doesnt give the head? and will the journal update no matter who kills Cleage in the party?

#13
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Yes It will update for all players who are in the same area and within 35m who have taken the quest. The diffrence in his last script is that it will give only one head and not a head per PC.

#14
seventh_son

seventh_son
  • Members
  • 37 messages
so what should the script look like if I dont want it to give the head at all but instead just update the journal to show that part of the quest is done?

#15
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Just remove the one line that gives the Head.



CreateItemOnObject("geo_cleagehead",OBJECT_SELF); // only one head will appear in loot remains


#16
seventh_son

seventh_son
  • Members
  • 37 messages
I will give it a try, thanks for the help guys.

#17
zero-feeling

zero-feeling
  • Members
  • 144 messages
so, i use PQJ System as well, heres what i have for the exact thing your asking... it works 100%, just change the things you need to like quest name and state

#include "pqj_inc"

void main()
{
object oPC = GetLastKiller();
if(!GetIsPC(oPC))
{
oPC = GetMaster(oPC); // for pets
}
if(!GetIsPC(oPC))
{
return;
}

object oArea = GetArea(oPC);
object oParty = GetFirstFactionMember(oPC);
while(GetIsObjectValid(oParty)) // make sure they are in the party
{
if(GetArea(oParty) == oArea) //same area check
{
if(RetrieveQuestState("YOUR_QUEST",oParty) == 10) //quest check //10 to your quest state
{
AddPersistentJournalQuestEntry("YOUR_QUEST",20,oParty,FALSE,FALSE,FALSE); //journal update //change the 20 to your quest state
FloatingTextStringOnCreature( "** Your Journal Has Been Updated **", oParty);
CreateItemOnObject("YOUR_HEAD",oParty);
}
}
oParty = GetNextFactionMember(oPC); // finds next member
}
}

hope this helps :)


edit:
use the line lightfoot8 gave you if you only want one head in the loot sack, mine gives one head to each player in the party, as long as they are in the same map.

Modifié par zero-feeling, 06 septembre 2010 - 04:39 .


#18
seventh_son

seventh_son
  • Members
  • 37 messages
ShaDoOoW, that script was just what I needed...

Thanks for your help everyone....



zero-feeling, sorry ShaDoOoW beat you to it, but I would have tried your script... Thanks as well for your help...

#19
zero-feeling

zero-feeling
  • Members
  • 144 messages
hey, don't wory, ShaDoOoW helps me a lot, and prolly helped me with this scipt.... just can't remember anymore :P