Hello, Im doing a school project in the NWN2 Toolset. I have a script that will check for an item, and then If you have that item, advance to a secrtion in the journal log. Code below. I want to make it so that it checks that I am already on already on the quest, so If i pick up the item and I'm not on the quest, the Log advancement doesnt happen.
void main()
{
// Get the object which was acquired
object itemAcquired = GetModuleItemAcquired();
if(itemAcquired != OBJECT_INVALID) {
// Get the tag of the acquired item
// If it is "my_item_tag" we got the right item
if ( GetTag(itemAcquired) == "N2_ARHE001" && (CODE THAT CHECKS IF IM ON QUEST) {
// Get the object (player) who now possess the item
object oPC = GetItemPossessor(itemAcquired);
// Add an appropriate journal entry to his journal
AddJournalQuestEntry ("King", 40, oPC);
}
}
}
So basically I need to know the piece of code that goes where i put "code that checks if im on quest." I looked around a bit but couldn't din anything. Thanks in advance!
Scripting journal events help needed
Débuté par
JammedSafety
, janv. 27 2011 07:56
#1
Posté 27 janvier 2011 - 07:56
#2
Posté 27 janvier 2011 - 08:11
GetJournalEntry is the inverse of AddJournalQuestEntry. It returns an integer that represents the state of the quest (going by how it's numbered in the journal editor).
#3
Posté 27 janvier 2011 - 08:11
Code to check if on quest (this checks the journal and sees if it is at least at some current value):
if (GetLocalInt(oPC, "NW_JOURNAL_ENTRY" + sJournalTag) == nValue)
sJournalTag (string variable) is the quest's tag, nValue is the value you want to look for. You can change the == to other operators for less than, greater than, etc.
if (GetLocalInt(oPC, "NW_JOURNAL_ENTRY" + sJournalTag) == nValue)
sJournalTag (string variable) is the quest's tag, nValue is the value you want to look for. You can change the == to other operators for less than, greater than, etc.
#4
Posté 27 janvier 2011 - 08:42
Thanks guys
#5
Posté 27 janvier 2011 - 09:36
One last thing, I'm having trouble on. Im trying to get my quest log to advance when i kill a certain monster. I have the following script in the onDeath script for the monster.
void main(string sCategoryTag, int nEntryID, int bAllPartyMembers, int bAllPlayers, int bAllowOverrideHigher)
{
object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());
AddJournalQuestEntry("King", 30, oPC, 1, 0, 0);
}
But nothing happens, when I kill this monster. Any Ideas?
void main(string sCategoryTag, int nEntryID, int bAllPartyMembers, int bAllPlayers, int bAllowOverrideHigher)
{
object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());
AddJournalQuestEntry("King", 30, oPC, 1, 0, 0);
}
But nothing happens, when I kill this monster. Any Ideas?
#6
Posté 27 janvier 2011 - 10:10
Creature event scripts don't work exactly the same as conversation scripts, in particular they don't have parameters passed through their main function, and they can't properly use the GetPCSpeaker() function, since there is no PC speaking to anyone at the time of their death.
You need to use GetFirstPC() to get a hold of your player character instead.
You need to use GetFirstPC() to get a hold of your player character instead.
#7
Posté 27 janvier 2011 - 11:09
thanks so much, I never would have found that out!
#8
Posté 28 janvier 2011 - 03:50
My tutorial linked in sig below might be of some use to you, written for the novice scripter.
#9
Posté 28 janvier 2011 - 10:30
you can actually pass paramater on creature event script if you declare them propelly in the VAR field below the scripts panel.
Or you can store them in an OBJECT and get them from this OBJECT with a GetLocal, or GetGlobal function depending on how you stored it.
Or you can store them in an OBJECT and get them from this OBJECT with a GetLocal, or GetGlobal function depending on how you stored it.
#10
Posté 28 janvier 2011 - 01:56
And if you're doing any event scripts, Pain's page on referencing objects in scripts could certainly come in handy. It notes the objects that are defined in various scripts (GetEnteringOjbect() in OnEnter, etc.).





Retour en haut






