Papyrus script fails to find Black Star

Post » Thu Jun 21, 2012 6:36 am

I'm working on a script that needs to find the Black Star and/or Azura's Star in the player's inventory to work.

Now, the problem I'm havin is, it doesn't work.

The really weird thing is, I can't see why it doesn't. The code dealing with the Black Star is exactly the same as the code dealing with Azura's Star except for the names:

SoulGem property DA01SoulGemAzurasStar autoSoulGem property DA01SoulGemBlackStar auto

int numBlackStar = Actor.GetItemCount(DA01SoulGemBlackStar)int numAzurasStar = Actor.GetItemCount(DA01SoulGemAzurasStar)

To test the script, I gave myself 10 Azura's Stars and 10 Black Stars, and triggered the script, which includes this line:

Debug.Notification("Black Stars found: "+numBlackStar+" Azura Stars: "+numAzurasStar)

When the script is triggered, it /always/ says "Black Stars found: 0 Azura Stars: x" (where x is the number of Azura's Stars in my inventory), regardless of how many Black Stars I have.

At first I thought that it might have been because the save I was playing wasn't vanilla and something was conflicting, but I still have the problem even with a brand new, vanilla game.

Could someone tell me what is wrong? Or even better, how to fix it?
User avatar
Trevi
 
Posts: 3404
Joined: Fri Apr 06, 2007 8:26 pm

Post » Thu Jun 21, 2012 6:11 am

Either your properties aren't pointed at the Azura Stars or your 'Actor' variable isn't getting set. I'd need to see the whole script, but...
ScriptName AzuraStarQuestScript extends QuestFormList Property AzuraStarFLST AutoSoulGem Property DA01SoulGemAzurasStar AutoSoulGem Property DA01SoulGemBlackStar AutoInt iAzuraStarInt iBlackAzuraStarEvent OnInit()	RegisterForUpdate(3)EndEventEvent OnUpdate()	iAzuraStar = Game.GetPlayer().GetItemCount(DA01SoulGemAzurasStar)	iBlackAzuraStar = Game.GetPlayer().GetItemCount(DA01SoulGemBlackStar)	Debug.Notification("Azura Star Count: " + iAzuraStar + ", Black Star Count: " + iBlackAzuraStar)	If !Game.GetPlayer().GetItemCount(AzuraStarFLST)		Game.GetPlayer().AddItem(DA01SoulGemAzurasStar)		Game.GetPlayer().AddItem(DA01SoulGemBlackStar)	EndIfEndEvent
...worked fine.
User avatar
Elizabeth Davis
 
Posts: 3406
Joined: Sat Aug 18, 2007 10:30 am

Post » Thu Jun 21, 2012 9:47 am

I'm editing "magicSoulTrapFXScript" to modify how it handles soul traps. The Actor is passed to it, and all the other assignments work, so it's not that it's failed to get set.

  int numPetty = Actor.GetItemCount(SoulGemPetty)  int numLesser = Actor.GetItemCount(SoulGemLesser)  int numCommon = Actor.GetItemCount(SoulGemCommon)  int numGreater = Actor.GetItemCount(SoulGemGreater)  int numGrand = Actor.GetItemCount(SoulGemGrand)  int numBlack = Actor.GetItemCount(SoulGemBlack)  int numBlackStar = Actor.GetItemCount(DA01SoulGemBlackStar) ;all except this act as expected, this is always 0  int numAzurasStar = Actor.GetItemCount(DA01SoulGemAzurasStar)

Basically, instead of the script calling "Caster.TrapSoul(victim)", it calls my function, passing the Actor and Victim in. My function does stuff and calls Actor.TrapSoul(Victim) when it's done.

Using "Game.GetPlayer().GetItemCount(DA01SoulGemBlackStar) " instead of "Actor.GetItemCount(DA01SoulGemBlackStar)" doesn't have any effect.

So, assuming the two options you gave are the only possible causes, I would have to say that it must be the properties. Although I don't see how "SoulGem property DA01SoulGemBlackStar auto" /isn't/ pointing to the Black Star.

EDIT: I added the following to the script:
FormList Property AzuraStarFLST Auto...int numStars = Actor.GetItemCount(AzuraStarFLST)Debug.Notification("Stars found: "+numStars+" Black Stars: "+numBlackStar+" Azura Stars: "+numAzurasStar)

Both the numStars /and/ the numBlackStar are 0. (For example, with 10 Black and 10 Azura's Stars in the inventory, the displayed message is: "Stars found: 0 Black Stars: 0 Azura Stars: 10", instead of 20/10/10 as expected.)

Might it have something to do with the script extending "ActiveMagicEffect", not "Quest"?
User avatar
Toby Green
 
Posts: 3365
Joined: Sun May 27, 2007 5:27 pm

Post » Thu Jun 21, 2012 3:27 am

Did you set your properties in the CK after you made your script association?

if not, all your azura references are set to None, and you will sure find nothing.
User avatar
Kevin S
 
Posts: 3457
Joined: Sat Aug 11, 2007 12:50 pm

Post » Thu Jun 21, 2012 8:32 am

Did you set your properties in the CK after you made your script association?

if not, all your azura references are set to None, and you will sure find nothing.

I did not realize that I need to do that. That would certainly explain my difficulties. I'm off to the tutorial to find out how to do that.

Thanks, McGuffin. Somehow I'm sure that'll fix the problem.
User avatar
Talitha Kukk
 
Posts: 3477
Joined: Sun Oct 08, 2006 1:14 am

Post » Thu Jun 21, 2012 4:14 am

Apparently I had to do it in multiple areas, but I did finally get it to work.

What bothers me is, on every one of the areas I needed to do it, it had the value "<>" before I chnged it. Why in the name of evrything decent doesn't the stupid CK put the right values in automatically?

(Actually, in my rather limited use so far, I noticed an awful lot of annoyances- like how long it takes to load the object list, or the fact that the "sub" windows are actually full windows in there own right, and so on. I'm sure people who've never used any other SDKs might not even notice, but I'm used to Valve's Hammer- and it is SO much better. All this is an opnion, of course. You're welcome to disagree.)
User avatar
Lil Miss
 
Posts: 3373
Joined: Thu Nov 23, 2006 12:57 pm


Return to V - Skyrim