Onacquireitem: check for three items to add journal entry
#1
Posté 24 octobre 2010 - 04:40
I want the PC to get a new journal entry "magicalitems" DS 3, when he has gathered three items. I already made a custom onacquireitem script for the module events for another item which triggers a journal entry.
How do I do it for more than one item?
Thanks in advance, you guys are a great help!
#2
Posté 24 octobre 2010 - 06:21
void main()
{
object oPC = GetModuleItemAcquiredBy();
object oItem = GetModuleItemAcquired();
if(GetTag(oItem) == "ItemTag3" &&
GetIsObjectValid(GetItemPossessedBy(oPC, "ItemTag2")) &&
GetIsObjectValid(GetItemPossessedBy(oPC, "ItemTag1")))
{
AddJournalQuestEntry("magicalitems", 3, oPC);
}
}
-420
Modifié par 420, 24 octobre 2010 - 06:22 .
#3
Posté 25 octobre 2010 - 06:39
Now I am trying to do a similar thing with a script from conversation. I want a text to appear if either of three items is in posession. I have this script now:
int StartingConditional()
{
object oPC = GetPCSpeaker();
if (GetItemPossessedBy(oPC, "Roseruby") == OBJECT_INVALID) return FALSE;
if (GetItemPossessedBy(oPC, "Fireopal") == OBJECT_INVALID) return FALSE;
if (GetItemPossessedBy(oPC, "Bloodcoral") == OBJECT_INVALID) return FALSE;
return TRUE;
}
But with this script you have to have all of the items, and not either one of them...
Modifié par Eva_hop, 25 octobre 2010 - 06:47 .
#4
Posté 25 octobre 2010 - 08:00
Your best bet is to flip the options - set all tests to not equal instead of equal, return true instead of false, and then return false at the end if it gets that far. Then it should do what you want.
#5
Posté 25 octobre 2010 - 08:14
int StartingConditional() {
object oPC = GetPCSpeaker();
int nCount = 0;
if (GetIsObjectValid(GetItemPossessedBy(oPC, "Roseruby")))
nCount++;
if (GetIsObjectValid(GetItemPossessedBy(oPC, "Fireopal")))
nCount++;
if (GetIsObjectValid(GetItemPossessedBy(oPC, "Bloodcoral")))
nCount++;
if (nCount > 0 && nCount < 3)
return TRUE;
return FALSE;
}That returns TRUE if any of the 3 items is in the PCs inventory, but FALSE if all of them are - I assume that's what you want since you have a seperate condition for all 3, correct?
Funky
Modifié par FunkySwerve, 25 octobre 2010 - 08:16 .
#6
Posté 25 octobre 2010 - 08:27
@ Funky Swerve: No, I want the script to play if either one of the gems is in posession, or two, or all three. So I think I should go for what Greycloak is suggesting. The problem is that the script fires only if all three are in posession.
This is what I have now. How do I set it to 'not equal' instead of 'equal'?
int StartingConditional()
{
object oPC = GetPCSpeaker();
if (GetItemPossessedBy(oPC, "Roseruby") == OBJECT_INVALID) return TRUE;
if (GetItemPossessedBy(oPC, "Fireopal") == OBJECT_INVALID) return TRUE;
if (GetItemPossessedBy(oPC, "Bloodcoral") == OBJECT_INVALID) return TRUE;
return FALSE;
}
Modifié par Eva_hop, 25 octobre 2010 - 08:37 .
#7
Posté 25 octobre 2010 - 09:12
{
object oPC = GetPCSpeaker();
if (GetItemPossessedBy(oPC, "Roseruby") != OBJECT_INVALID) return TRUE;
if (GetItemPossessedBy(oPC, "Fireopal") != OBJECT_INVALID) return TRUE;
if (GetItemPossessedBy(oPC, "Bloodcoral") != OBJECT_INVALID) return TRUE;
return FALSE;
}
#8
Posté 26 octobre 2010 - 10:15





Retour en haut






