more pqj questions...
#1
Posté 05 septembre 2010 - 11:48
#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
Posté 06 septembre 2010 - 12:44
#3
Posté 06 septembre 2010 - 02:48
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
Posté 06 septembre 2010 - 02:49
This way, head will be given to all players doing the quest (hmm I would consider this) and they get update too.#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);
}
}
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
Posté 06 septembre 2010 - 02:57
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
Posté 06 septembre 2010 - 03:02
Yes, you are right, thanks fot catching this, I updated my script to check area and distance from killer.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.
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
Posté 06 septembre 2010 - 03:23
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
Posté 06 septembre 2010 - 03:31
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
Posté 06 septembre 2010 - 03:44
Is a wrapper around JournalQuestEntry So the journal does get updated.
#10
Posté 06 septembre 2010 - 03:53
#11
Posté 06 septembre 2010 - 04:01
if(RetrieveQuestState("CLEAGE",oPC) == 2)
as the test and dont worry to much about them having the head or not.
#12
Posté 06 septembre 2010 - 04:04
#13
Posté 06 septembre 2010 - 04:10
#14
Posté 06 septembre 2010 - 04:12
#15
Posté 06 septembre 2010 - 04:18
CreateItemOnObject("geo_cleagehead",OBJECT_SELF); // only one head will appear in loot remains
#16
Posté 06 septembre 2010 - 04:20
#17
Posté 06 septembre 2010 - 04:37
#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
Posté 07 septembre 2010 - 02:51
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
Posté 08 septembre 2010 - 03:25





Retour en haut






