Debug notification always displays despite being inside the

Post » Sat Nov 17, 2012 10:30 pm

I'm probably making a silly error, but I can't stop the debug notification from displaying despite being inside the "else" of an if/endif.

The script is as follows:

Scriptname ShrineDonationArkay extends ObjectReference  MiscObject Property Gold001 autoEvent OnActivate(ObjectReference akActionRef)If Game.GetPlayer().GetItemCount(Gold001) >= 10		Game.GetPlayer().RemoveItem(Gold001, 10)	; Do whatever was being paid for here.else	Debug.Notification("You need at least 10 gold to make a donation!") ;(make the transaction fail)EndifEndEvent

The "You need at least" is displayed even if I have enough gold.

In case it makes a difference, I also have another script affecting the same activator, which is a slightly edited vanilla script:
Scriptname TempleBlessingScript extends ObjectReference Conditional  Spell Property TempleBlessing  Auto  MiscObject Property Gold001 autoEvent OnActivate(ObjectReference akActionRef)If Game.GetPlayer().GetItemCount(Gold001) >= 10	TempleBlessing.Cast(akActionRef, akActionRef)	if akActionRef == Game.GetPlayer()		AltarRemoveMsg.Show()		BlessingMessage.Show()	endifendifEndEventMessage Property BlessingMessage  Auto  Message Property AltarRemoveMsg  Auto 

...and yes, I probably should combine the 2 scripts...but didn't want to delete script references from the vanilla game as I heard that could cause issues, so edited the vanilla script as much as I could and did the rest with additional scripts.
(I'm planning on having different offering requirements for each shrine, which is why I didn't want to make the scripts universal).

The scripts work as intended, subtracting gold if the player has it and giving a blessing, and if the player doesn't have the gold the blessing is prevented - it's just the debug that I'd only like to appear if the player doesn't have the gold.
User avatar
luke trodden
 
Posts: 3445
Joined: Sun Jun 24, 2007 12:48 am

Post » Sat Nov 17, 2012 11:19 am

First of all, do your money go down? I mean, does that script actually take your money or it just gives you the message?

If you only get the message, then there's something wrong in the if statement, otherwise it's just the script parser.....
User avatar
His Bella
 
Posts: 3428
Joined: Wed Apr 25, 2007 5:57 am

Post » Sat Nov 17, 2012 11:31 pm

Yep, the money goes down fine...and when it gets down to 0 it doesn't grant the blessings as expected.

How do you mean, "script parser"?
User avatar
Andy durkan
 
Posts: 3459
Joined: Fri Aug 03, 2007 3:05 pm

Post » Sat Nov 17, 2012 5:25 pm

With "script parser" I mean that part of the CK that reads your script and interprets it.

So, your problem is that it does take your money and bless you, but it ALSO tells you you dont have enough money.

It seems your "else" key word is totally ignored. I'm not a script expert, actually I can barely program in C, but are you sure that's the right syntax for an if/else/endif block?


Edit: what about that "." at the end of the preceding line? How does the script parser interpret points?
User avatar
DeeD
 
Posts: 3439
Joined: Sat Jul 14, 2007 6:50 pm

Post » Sat Nov 17, 2012 11:39 pm

Has anyone seen this problem but you? I notice someone in your release thread says they used the mod without problems. Are you testing it with a clean save, made before you first installed the mod?

Also, how much gold do you have when you test?
User avatar
Laura Tempel
 
Posts: 3484
Joined: Wed Oct 04, 2006 4:53 pm

Post » Sat Nov 17, 2012 11:00 pm

Try putting a notification or a trace in the other branch of the if. See if that also displays.

Also try

    int gold = Game.GetPlayer().GetItemCount(Gold001)	debug.notification("player has " + gold + "gold.")	if gold > 10		; code as before ...


Which will give you a sanity check in whether or not the logic is correct. It's possible, for example, that your gold property is pointing at something else that the player has none of. In which case the code would be functioning correctly...
User avatar
Georgia Fullalove
 
Posts: 3390
Joined: Mon Nov 06, 2006 11:48 pm

Post » Sun Nov 18, 2012 1:48 am

Thanks for the suggestions.

With "script parser" I mean that part of the CK that reads your script and interprets it.

So, your problem is that it does take your money and bless you, but it ALSO tells you you dont have enough money.

It seems your "else" key word is totally ignored. I'm not a script expert, actually I can barely program in C, but are you sure that's the right syntax for an if/else/endif block?

Edit: what about that "." at the end of the preceding line? How does the script parser interpret points?

That summarises the issue. I don't think the "." makes a difference as it's just a note, but I'll try without just to be sure.


Has anyone seen this problem but you? I notice someone in your release thread says they used the mod without problems. Are you testing it with a clean save, made before you first installed the mod?

Also, how much gold do you have when you test?

This is a newer version I'm playing around with, so I'm the only one testing at the moment - the released version has a simpler script which grants the blessing even if the player doesn't have the gold - roleplayed as the gods being pitiful on the poor :smile:
This is the only mod active, and I coc'd from the main menu in order to test, creating a default character with I think about 140 gold.

Try putting a notification or a trace in the other branch of the if. See if that also displays.

Also try

	int gold = Game.GetPlayer().GetItemCount(Gold001)	debug.notification("player has " + gold + "gold.")	if gold > 10		; code as before ...


Which will give you a sanity check in whether or not the logic is correct. It's possible, for example, that your gold property is pointing at something else that the player has none of. In which case the code would be functioning correctly...

Thanks, will try that now.
User avatar
vanuza
 
Posts: 3522
Joined: Fri Sep 22, 2006 11:14 pm

Post » Sat Nov 17, 2012 7:31 pm

Interesting - I added a debug notification to the other branch ("You have more than 10 gold"), but that doesn't appear although it should as I do have the money!

Scriptname ShrineDonationArkay extends ObjectReference  MiscObject Property Gold001 autoEvent OnActivate(ObjectReference akActionRef)If Game.GetPlayer().GetItemCount(Gold001) >= 10        Game.GetPlayer().RemoveItem(Gold001, 10) Debug.Notification("You have more than 10 gold")   ; Do whatever was being paid for here.else    Debug.Notification("You need at least 10 gold to make a donation!") ;(make the transaction fail)EndifEndEvent

Regarding your other code, I must admit I'm not completely sure what this does, or where to place it in my code - I tried both inside and outside the if, but compilation fails :(
"int gold = Game.GetPlayer().GetItemCount(Gold001)
debug.notification("player has " + gold + "gold.")
if gold > 10
; code as before ..."


Where exactly should I place this?

Thanks again
User avatar
Charleigh Anderson
 
Posts: 3398
Joined: Fri Feb 02, 2007 5:17 am

Post » Sun Nov 18, 2012 3:19 am

This is the only mod active, and I coc'd from the main menu in order to test, creating a default character with I think about 140 gold.
Try not doing that. You should use a clean save instead for testing. COCing from the main menu doesn't represent an actual use-case and may potentially cause problems.

I would make sure that you don't have two copies of this script executing. It almost sounds like you have two copies running, one with Gold001 resolved to the Gold object correctly, and one that isn't. In one case it succeeds, and in another the condition fails because Gold001 isn't resolved and GetItemCount returns 0. Did you attach the script to the base Activator object and create a reference of it in the world so that the script is inherited by the reference? Or did you apply the script to the reference directly? (not that it should matter)
User avatar
Nathan Barker
 
Posts: 3554
Joined: Sun Jun 10, 2007 5:55 am

Post » Sat Nov 17, 2012 3:55 pm

Try not doing that. You should use a clean save instead for testing. COCing from the main menu doesn't represent an actual use-case and may potentially cause problems.

I would make sure that you don't have two copies of this script executing. It almost sounds like you have two copies running, one with Gold001 resolved to the Gold object correctly, and one that isn't. In one case it succeeds, and in another the condition fails because Gold001 isn't resolved and GetItemCount returns 0. Did you attach the script to the base Activator object and create a reference of it in the world so that the script is inherited by the reference? Or did you apply the script to the reference directly? (not that it should matter)

Ummm.... :blink:

I'm very much a novice at scripting, and I'm learning as I go, so I get confused easily...please bear with me!

From the objects window I selected WorldObjects->Activator->Clutter->Shrines and then selected the shrine I wanted from there. Is that the base Activator?

I'll try removing the current scripts and recompiling, and will try creating a new game (is Live Another Life ok for testing, or do I need to do the intro sequence once more...?)


Edit: I used auto-fill to associate gold001 - is this ok?

Edit 2: Hmmm...I deleted all related scripts, recompiled, started a new character - and it now appears to be working! Will apply same changes to the rest of the shrines and see if all is ok there too.

Edit 3: Well I don't know whether it was because of the recompiling or because I started a new game, but it's all working now- thanks!
User avatar
Vincent Joe
 
Posts: 3370
Joined: Wed Sep 26, 2007 1:13 pm

Post » Sat Nov 17, 2012 4:17 pm

Maybe the problem is that you are changing the subject of the check. I mean, you have 70 coins, you check if you have 10, you have, you substract 10, but now the program is not sure if the condition continues meeting or not and it uses the else. Maybe trying with elseif instead could work. Also, if you assing the game.getplayer().getitemcount() value to an int variable and you use it in the if instead of all those instructions, the else may work correctly.
User avatar
michael flanigan
 
Posts: 3449
Joined: Thu Jun 14, 2007 2:33 pm

Post » Sun Nov 18, 2012 2:24 am

From the objects window I selected WorldObjects->Activator->Clutter->Shrines and then selected the shrine I wanted from there. Is that the base Activator?
Yes. That's what's referred to as a Base Object. Any copy of that Base Object that you place into the world is referred to as an Object Reference.

I'll try removing the current scripts and recompiling, and will try creating a new game (is Live Another Life ok for testing, or do I need to do the intro sequence once more...?)

Use LAL to bypass the intro, save, deactivate LAL, load that save, and save again with no other mods in your load order. You have a clean save.

Edit 3: Well I don't know whether it was because of the recompiling or because I started a new game, but it's all working now- thanks!
Glad to hear.
User avatar
james tait
 
Posts: 3385
Joined: Fri Jun 22, 2007 6:26 pm

Post » Sat Nov 17, 2012 10:39 pm

Thanks for the explanations - it's gradually all making sense to me!
User avatar
Anthony Rand
 
Posts: 3439
Joined: Wed May 09, 2007 5:02 am

Post » Sat Nov 17, 2012 6:20 pm

Ok, so I'm now trying to get more complex...and have it mostly figured out, but with one issue -

This time I'm trying to integrate the vanilla blessing into this script, as well as put a condition in to check that the player hasn't completed any daedric quests. If they had dealings with daedra, Stendarr will refuse to bless them.

I've nested the vanilla script into my script, added a new if/else and then made both elses into elseifs as I'm now checking on these. In-game, it correctly refuses the blessing and displays the appropriate debug notification for that (You've consorted with Daedra!) if the player has completed any daedric quests. It also correctly refuses the blessing if the player doesn't have the money - but doesn't display the debug notification for that (You need at least 10 gold!).

Scriptname ShrineDonationStendarr extends ObjectReference  MiscObject Property Gold001 AutoSpell Property TempleBlessing AutoMessage Property BlessingMessage Auto  Message Property AltarRemoveMsg Auto  Event OnActivate(ObjectReference akActionRef)If Game.GetPlayer().GetItemCount(Gold001) >= 10	If (Game.QueryStat("Daedric Quests Completed") <1)			Game.GetPlayer().RemoveItem(Gold001, 10)		TempleBlessing.Cast(akActionRef, akActionRef)		if akActionRef == Game.GetPlayer()		AltarRemoveMsg.Show()		BlessingMessage.Show()	endifelseif (Game.QueryStat("Daedric Quests Completed") >=1)	Debug.Notification("You have consorted with Daedra and Stendarr has rejected your offering!") ;(make the transaction fail)elseif Game.GetPlayer().GetItemCount(Gold001) <= 9	Debug.Notification("You need at least 10 gold to make a donation!") ;(make the transaction fail)endifendifEndEvent

Edit: This time I started afresh with a clean save, and made sure to remove and recompile scripts before testing.
User avatar
Jack Walker
 
Posts: 3457
Joined: Wed Jun 06, 2007 6:25 pm

Post » Sat Nov 17, 2012 10:55 pm

elseif Game.GetPlayer().GetItemCount(Gold001) <= 9Debug.Notification("You need at least 10 gold to make a donation!") ;(make the transaction fail)endifendif

Look at those endifs. Your check for gold <= 9 is done inside the first if (that checked gold >= 10) - it will never be true.

You should be using else, which would save you some checks as well. You could replace the above with

else   Debug.Notification("You need at least 10 gold to make a donation!") ;(make the transaction fail)endif

The double check for daedric quests also looks redundant, and probably not quite as you want it: if the player has 10 gold but has done a daedric quest you don't take their money, but you don't say why. The message only gets shown to people with less gold. I suggest putting the daedric check first, and then the money check (after an elseif).
User avatar
Lloyd Muldowney
 
Posts: 3497
Joined: Wed May 23, 2007 2:08 pm

Post » Sat Nov 17, 2012 11:50 am

Thank you. I'm really struggling to get my head around the logic - what I really want is an "andif" rather than an "elseif", which is why I put the two first "ifs" together ...I want to check both conditions...and can't get away from the mindset of wanting an "andif"....

At the moment, the way I understand it, my script says:

If the player has gold
and if the player has not completed a daedric quest
then remove 10 gold
and grant shrine blessing
and show the shrine blessing message
that's the end of this first "if", so

otherwise if the player has completed more 1 or more daedric quests
then show message "you have consorted with daedra"
and otherwise if the player has less than 10 gold
then show message "you don't have enough gold".
end both of these last 2 ifs to wrap up the condition.

Is this the wrong reading of my script then? If I put the gold elseif back to your suggestion (the way I had it in my earlier script) then the compilation now fails - (...)+ loop did not match anything at input 'Debug'.
I think I'm misunderstanding something quite fundamental here.
User avatar
Bereket Fekadu
 
Posts: 3421
Joined: Thu Jul 12, 2007 10:41 pm

Post » Sat Nov 17, 2012 4:09 pm

Here's my guess at cleaning that up a bit, at least to my liking. I'm at work so can't test it. It looks to me like you have one too many endif's, but I would think that would error out when trying to compile.

Scriptname ShrineDonationStendarr extends ObjectReference MiscObject Property Gold001 AutoSpell Property TempleBlessing AutoMessage Property BlessingMessage Auto Message Property AltarRemoveMsg Auto Event OnActivate(ObjectReference akActionRef)If Game.GetPlayer().GetItemCount(Gold001) < 10	    Debug.Notification("You need at least 10 gold to make a donation!") ;(make the transaction fail)ElseIf (Game.QueryStat("Daedric Quests Completed") != 0)			   Debug.Notification("You have consorted with Daedra and Stendarr has rejected your offering!") ;(make the transaction fail)Else			    Game.GetPlayer().RemoveItem(Gold001, 10)			    TempleBlessing.Cast(akActionRef, akActionRef)			    if akActionRef == Game.GetPlayer()			    AltarRemoveMsg.Show()			    BlessingMessage.Show()EndIfEndEvent

You have an && operator, which sounds like what you're thinking you want to do. http://www.creationkit.com/Operator_Reference
User avatar
Dawn Farrell
 
Posts: 3522
Joined: Thu Aug 23, 2007 9:02 am

Post » Sun Nov 18, 2012 12:06 am

what I really want is an "andif"

That can be done:

bool a = Truebool b = Trueif a == True && b == True	;If a and b are true...	;stuffendif

"&&" is the AND operator. Conversely, here is the OR version (uses the || operator):


bool a = Truebool b = Falseif a == True || b == True	;If a or b are true...	;stuffendif
User avatar
Dark Mogul
 
Posts: 3438
Joined: Tue Feb 20, 2007 11:51 am

Post » Sat Nov 17, 2012 6:44 pm

Ooh- that sounds like just the sort of thing I'm looking for - will look into those - thanks!

I think I had my logic the wrong way around in my script - I was checking that the player meets the conditions first, and apply the reward for meeting these, and then check afterwards if they didn't meet the conditions and displaying the reason why at that stage.
User avatar
sarah simon-rogaume
 
Posts: 3383
Joined: Thu Mar 15, 2007 4:41 am

Post » Sat Nov 17, 2012 4:14 pm

It looks to me like you have one too many endif's, but I would think that would error out when trying to compile.

I think a lot of the confusion has come from the code after 'if akActionRef == Game.GetPlayer()' line not being indented properly.
User avatar
Emmanuel Morales
 
Posts: 3433
Joined: Sat Oct 06, 2007 2:03 pm

Post » Sun Nov 18, 2012 3:41 am

jackstarr - check this. This should work. Using PlayerRef is a better (faster) practice than querying Game.GetPlayer(). Also, you had one too few endifs (not that it matters since I reframed the logic with a PlayerRef check)

Scriptname ShrineDonationStendarr extends ObjectReferenceMiscObject Property Gold001 AutoSpell Property TempleBlessing AutoMessage Property BlessingMessage AutoMessage Property AltarRemoveMsg AutoActor property PlayerRef autoimport debugEvent OnActivate(ObjectReference akActionRef)	if akActionRef == PlayerRef			;We don't want NPCs activating this		If PlayerRef.GetItemCount(Gold001) < 10			notification("You need at least 10 gold to make a donation!") ;(make the transaction fail)	;<===Convert to message object		ElseIf (Game.QueryStat("Daedric Quests Completed") != 0)			notification("You have consorted with Daedra and Stendarr has rejected your offering!") ;(make the transaction fail)	;<===Convert to message object		Else			PlayerRef.RemoveItem(Gold001, 10)			TempleBlessing.Cast(akActionRef, akActionRef)			AltarRemoveMsg.Show()			BlessingMessage.Show()		Endif	endifEndEvent

So we're saying,

"IF the activator is the player,
IF they don't have enough gold, Error, ELSE
IF they've consorted with the daedra, Error, ELSE
(they have gold, they have not consorted with daedra) Remove gold, grant blessing, show messages"

I see what you're getting at with wanting to use an AND, but the way you have it set up here is fine because you want to keep the failure cases separate. If you said something like,

If PlayerRef.GetItemCount(Gold001) >= 10 && (Game.QueryStat("Daedric Quests Completed") == 0)    ;apply blessingendif

Then you would have no way to know which condition failed when attempting to print your error messages.
User avatar
Auguste Bartholdi
 
Posts: 3521
Joined: Tue Jun 13, 2006 11:20 am

Post » Sat Nov 17, 2012 10:42 pm

That seems to do the trick nicely - many thanks!

I'll now add my other conditions, and keep my fingers crossed I don't break anything else!
User avatar
Justin Bywater
 
Posts: 3264
Joined: Tue Sep 11, 2007 10:44 pm

Post » Sat Nov 17, 2012 4:23 pm

One thing I always like to do is set up the logic to dispose of uninteresting cases one by one. Each one with a comment explaining why it doesn't apply. It simplifies things greatly.

I've also added an explanation of my previous suggestion into the comments

Scriptname ShrineDonationStendarr extends ObjectReferenceMiscObject Property Gold001 AutoSpell Property TempleBlessing AutoMessage Property BlessingMessage AutoMessage Property AltarRemoveMsg AutoActor property PlayerRef autoimport debugEvent OnActivate(ObjectReference akActionRef)	;	;	if a function is one big IF statement, it's worth inverting the logic	;	and returning from the function. It simplifies the remaining logic	;	if akActionRef != PlayerRef			;We don't want NPCs activating this		return	endif	;	; From here on down, we know we're dealing with the player.	;	; We know how much gold the tester thinks the PC is carrying.	; what's the game's opinion?	;	; We can assign the number of GP to a variable	;	int num_gold = PlayerRef.GetItemCount(Gold001)		;	; Let's print that out so we know for sure.	;	; This fires regardless of how much gold the player is carrying, so you can use this to	; check your assumptions when the code doesn't behave as expected.	;	trace("the player is carrying " + num_gold + " gold pieces"	notification("the player is carrying " + num_gold + " gold pieces"	;	; And we can use the same variable in tests	;	If num_gold < 10		notification("You have consorted with Daedra and Stendarr has rejected your offering!")		return	; and go home early	Endif		;	; Now we know the game has more than 9 gp	;	If (Game.QueryStat("Daedric Quests Completed") != 0)		notification("You have consorted with Daedra and Stendarr has rejected your offering!")		return	; and go home early	Endif	;	; this is the interesting bit. Now we can focus on it a bit more clearly	;	PlayerRef.RemoveItem(Gold001, 10)	TempleBlessing.Cast(akActionRef, akActionRef)	AltarRemoveMsg.Show()	BlessingMessage.Show()EndEvent

I hope that's helpful.
User avatar
Theodore Walling
 
Posts: 3420
Joined: Sat Jun 02, 2007 12:48 pm

Post » Sun Nov 18, 2012 3:34 am

Adding comments as you suggest in the post above seems to make sense - I started to do this as I added more conditions, but got quite confused - going by this I think I have too many conditions that I'm checking on for the script to work correctly.

I now have the script working to also check if the player has ever been a vampire or werewolf, and have added a check for number of daedra killed before granting the blessing - if the player has killed less than 25, he is granted the usual blessing and pays 25 gold. If the player has killed more than 25 daedra, he receives the blessing but does not pay the 25 gold. If the player has killed more than 50 daedra, he receives a superior version of the blessing and does not pay the 25 gold.

If the player has the gold, everything works exactly as it should in-game, and the conditions behave correctly.

However, the way the script is set up at the moment, if the player doesn't have the gold but has killed enough daedra, he still doesn't get the option to get his "free" blessing, as the script checks for gold first. I tried getting around this by adding sub-conditions to the branch if player has less than 25 gold, but of course that doesn't work because at that stage it's not checking that he hasn't completed any daedric quests/been vampire etc. I'd then need to add sub-sub conditions for each and every potential situation - and I'm sure there's a more sensible way to do it than that!

Worse-case scenario, I could just argue that the gold requires you to want to offer the gold, and therefore to have it to offer, before he tells you he won't accept it on this occasion - but from a scripting point-of-view I'd like to solve this if possible.

This is the code that works fine as long as the player has the gold:

Scriptname ShrineDonationStendarr extends ObjectReferenceMiscObject Property Gold001 AutoSpell Property TempleBlessing AutoSpell Property TempleBlessingSuperior AutoMessage Property BlessingMessage AutoMessage Property AltarRemoveMsg AutoActor property PlayerRef autoimport debugEvent OnActivate(ObjectReference akActionRef)        if akActionRef == PlayerRef                     ;We don't want NPCs activating this                If PlayerRef.GetItemCount(Gold001) < 25                        debug.messagebox("You need at least 25 gold to offer a donation!") ;(make the transaction fail)      ;<===Convert to message object                ElseIf (Game.QueryStat("Daedric Quests Completed") != 0)                        debug.messagebox("You have consorted with daedra and Stendarr has rejected your offering!") ;(make the transaction fail)    ;<===Convert to message object		   ElseIf (Game.QueryStat("Days as a Vampire") != 0)                        debug.messagebox("You have been corrupted by vampirism & Stendarr has rejected your offering!") ;(make the transaction fail)    ;<===Convert to message object                ElseIf (Game.QueryStat("Days as a Werewolf") != 0)                       debug.messagebox("You have been corrupted by lycanthropy & Stendarr has rejected your offering!") ;(make the transaction fail)    ;<===Convert to message object                Else			If (Game.QueryStat("Daedra Killed") > 50)			   TempleBlessingSuperior.Cast(akActionRef, akActionRef)                       AltarRemoveMsg.Show()                       BlessingMessage.Show()			   debug.messagebox("You are pure of soul and have killed more than 50 daedra - Stendarr grants a superior blessing for free")			ElseIf (Game.QueryStat("Daedra Killed") > 25)			   TempleBlessing.Cast(akActionRef, akActionRef)                       AltarRemoveMsg.Show()                       BlessingMessage.Show()			   debug.messagebox("You are pure of soul and have killed more than 25 daedra - Stendarr grants your blessing for free")									Else                        PlayerRef.RemoveItem(Gold001, 25)                        TempleBlessing.Cast(akActionRef, akActionRef)                        AltarRemoveMsg.Show()                        BlessingMessage.Show()			   debug.messagebox("You are pure of soul and Stendarr accepts your offering!")			Endif                Endif        endifEndEvent
User avatar
R.I.p MOmmy
 
Posts: 3463
Joined: Wed Sep 06, 2006 8:40 pm

Post » Sat Nov 17, 2012 9:43 pm

start with the stuff that kicks the player out, then the free stuff, then the $$ check.

Scriptname ShrineDonationStendarr extends ObjectReferenceMiscObject Property Gold001 AutoSpell Property TempleBlessing AutoSpell Property TempleBlessingSuperior AutoMessage Property BlessingMessage AutoMessage Property AltarRemoveMsg AutoActor property PlayerRef autoimport debugEvent OnActivate(ObjectReference akActionRef)	    if akActionRef == PlayerRef					 ;We don't want NPCs activating this-			    If (Game.QueryStat("Days as a Vampire") != 0)					 debug.messagebox("You have been corrupted by vampirism & Stendarr has rejected your offering!") ;(make the transaction fail)    ;<===Convert to message object			   			    ElseIf (Game.QueryStat("Days as a Werewolf") != 0)					 debug.messagebox("You have been corrupted by lycanthropy & Stendarr has rejected your offering!") ;(make the transaction fail)    ;<===Convert to message object			    ElseIf (Game.QueryStat("Daedric Quests Completed") != 0)					    debug.messagebox("You have consorted with daedra and Stendarr has rejected your offering!") ;(make the transaction fail)    ;<===Convert to message object			   			    ElseIf (Game.QueryStat("Daedra Killed") > 50)					 TempleBlessingSuperior.Cast(akActionRef, akActionRef)					 AltarRemoveMsg.Show()					 BlessingMessage.Show()					 debug.messagebox("You are pure of soul and have killed more than 50 daedra - Stendarr grants a superior blessing for free")						  				 ElseIf (Game.QueryStat("Daedra Killed") > 25)    ;you can add a cost here but would have to do an && check for money					  TempleBlessing.Cast(akActionRef, akActionRef)					  AltarRemoveMsg.Show()					  BlessingMessage.Show()					  debug.messagebox("You are pure of soul and have killed more than 25 daedra - Stendarr grants your blessing for free")				 ElseIf PlayerRef.GetItemCount(Gold001) < 25					   debug.messagebox("You need at least 25 gold to offer a donation!") ;(make the transaction fail)	  ;<===Convert to message object				 Else					    PlayerRef.RemoveItem(Gold001, 25)					    TempleBlessing.Cast(akActionRef, akActionRef)					    AltarRemoveMsg.Show()					    BlessingMessage.Show()					    debug.messagebox("You are pure of soul and Stendarr accepts your offering!")				 EndIf			   	    endifEndEvent

if you want to charge a smaller amount for the daedra < 25,
ElseIf (Game.QueryStat("Daedra Killed") > 25) && PlayerRef.GetItemCount(Gold001) > 9 ;this is if you want to charge 10
User avatar
Tiff Clark
 
Posts: 3297
Joined: Wed Aug 09, 2006 2:23 am

Next

Return to V - Skyrim