Getitemcount in quests

Post » Fri Apr 15, 2011 6:34 pm

Alright, so if I'm using the getitemcount condition in a quest stage, should I run it on target? For example, when you use this condition in dialogues and want to check if the player has an x amount of y item in his inventory you check the run on target checkbox. What to do here? I suppose I could test it manually, but the fact is that it's less time consuming to ask here rather than test, as I'm sure someone here knows the answer.
User avatar
Nims
 
Posts: 3352
Joined: Thu Jun 07, 2007 3:29 pm

Post » Sat Apr 16, 2011 1:05 am

if ( player.getitemcount y == x )

Should do the trick if the target is the player. As far as I'm aware, quest scripts don't run on a target refference so specifying one before the function is compulsory.

~Blessed be
User avatar
Richard Thompson
 
Posts: 3302
Joined: Mon Jun 04, 2007 3:49 am

Post » Sat Apr 16, 2011 3:16 am

if ( player.getitemcount y == x )

Should do the trick if the target is the player. As far as I'm aware, quest scripts don't run on a target refference so specifying one before the function is compulsory.

~Blessed be


I never mentioned a quest script. I said quest stage conditions. I even said that I was wondering if I should check the box that runs on target. Here's a http://img693.imageshack.us/img693/7185/huhe.jpg of what I'm talking about. Please don't reply if you are not 100% sure (e.g. Have done this before or seen it done).
User avatar
maddison
 
Posts: 3498
Joined: Sat Mar 10, 2007 9:22 pm

Post » Sat Apr 16, 2011 6:48 am

The 'target' is the person that the NPC is talking to. Which is the player.

If you use a getitemcount check without ticking the 'on target' box, the condition will check the talking NPC's inventory for the item, instead of the player's. So if you want to check if the player has a certain item you need to tick that 'on target' box.

Edit: Oops, this isn't dialogue, and you knew that already. :facepalm:

I've done things like this before but it has been a while so I'm not 100% sure, but I think that In this case you don't have to tick the 'on target' box, because quest stages aren't really targetted at anymore. In this case the regular GetItemCount without the 'on target' box checked should check the player's inventory.
User avatar
Bethany Short
 
Posts: 3450
Joined: Fri Jul 14, 2006 11:47 am

Post » Fri Apr 15, 2011 4:33 pm

I 'd like to know the answer to this question too - if you find out please post it here.
User avatar
rebecca moody
 
Posts: 3430
Joined: Mon Mar 05, 2007 3:01 pm

Post » Fri Apr 15, 2011 11:22 pm

I never mentioned a quest script. I said quest stage conditions. I even said that I was wondering if I should check the box that runs on target. Here's a http://img693.imageshack.us/img693/7185/huhe.jpg of what I'm talking about. Please don't reply if you are not 100% sure (e.g. Have done this before or seen it done).

In the image you submitted, the section titled Result Script, I thought you were attempting an if condition (conditional statement) in that field. Also, you mentioned a check-box in your example of a different tab, and only mentioned the words "run on target" with reference to your actual question. I apologize that I misunderstood your question but I must insist that I was 100% sure I knew what I was talking about.

So, to correct myself and answer your question as you intended it:

"Conditions: The conditions must be true for the quest stage item to be applied. Note that most reference functions are invalid when attached to a quest stage, since the stage is not a reference. Note also that "Run on Target" is invalid for conditions attached to quest stages. When setting a variable in a script as a condition, the variable must be changed before SetStage is called."
~http://cs.elderscrolls.com/constwiki/index.php/Quest_Stages_Tab

"The Run on Target checkbox is used to indicate that the function should be run on the actor’s current target instead of on the actor themselves. The Player is usually considered a target for conditions in quests. Quest Targets are an exception to this because the Player is considered the Actor for purposes of checking conditions. The same is true for any object not in the possession of the actor checking the condition."
~http://cs.elderscrolls.com/constwiki/index.php/Category:Conditions

~Blessed be
User avatar
Shannon Marie Jones
 
Posts: 3391
Joined: Sun Nov 12, 2006 3:19 pm

Post » Sat Apr 16, 2011 8:11 am

In the image you submitted, the section titled Result Script, I thought you were attempting an if condition (conditional statement) in that field. Also, you mentioned a check-box in your example of a different tab, and only mentioned the words "run on target" with reference to your actual question. I apologize that I misunderstood your question but I must insist that I was 100% sure I knew what I was talking about.

So, to correct myself and answer your question as you intended it:

"Conditions: The conditions must be true for the quest stage item to be applied. Note that most reference functions are invalid when attached to a quest stage, since the stage is not a reference. Note also that "Run on Target" is invalid for conditions attached to quest stages. When setting a variable in a script as a condition, the variable must be changed before SetStage is called."
~http://cs.elderscrolls.com/constwiki/index.php/Quest_Stages_Tab

"The Run on Target checkbox is used to indicate that the function should be run on the actor’s current target instead of on the actor themselves. The Player is usually considered a target for conditions in quests. Quest Targets are an exception to this because the Player is considered the Actor for purposes of checking conditions. The same is true for any object not in the possession of the actor checking the condition."
~http://cs.elderscrolls.com/constwiki/index.php/Category:Conditions

~Blessed be


Oh, sorry, but that "please don't reply" wasn't meant for you, but rather everyone. Don't worry, I wasn't angry or anything, I just wanted to make things more clear. Sorry if I might have came on too aggressively and thank you for the answer.
User avatar
James Baldwin
 
Posts: 3366
Joined: Tue Jun 05, 2007 11:11 am


Return to IV - Oblivion