Script not always working.

Post » Thu Jun 21, 2012 2:01 pm

Alright, so I am writting a script and it works fine on all of my test forges, but it seems to break down when actually implamented.

I tested this in qasmoke, and a general testing room I made. It worked fine. But when I try it out in whiterun, I noticed that it ignores the script and lets the player activate the forge normally?

I made sure to make sure I assigned the forge an owner (Lydia, because I am also testing another thing on here that adds the gold to the player who owns the forge)

So the forge in whiterun by warmaidens is owned by Lydia, which means my script should ask to charge me some money? but it doesnt it just activates it normally.

Any Ideas


Script
Spoiler
scriptName  BlacksmithForge01 extends ObjectReferenceimport Debug; How we going to get things to work!!!!spell property FlameDamage AutoMessage Property BlackSmithForgeMSGOwned  AutoMiscObject Property Gold001 autoFormList Property EmptyFLST AutoEVENT OnInit()BlockActivation()  ; Can't let you activate this just yet, lets validate some.endEventEVENT onActivate ( objectReference triggerRef ); You better be the player. Otherwise, I don't care about you.if (triggerRef == game.getplayer())  ; Do you own the forge, if so, sorry, you can use it freely!  If (triggerRef.GetActorOwner() != Game.GetPlayer().GetActorBase())   ; Ha, you don't own this forge, bet you can't afford it.   If (Game.GetPlayer().GetItemCount(Gold001) >= 10)    ; My plans are foiled once again, BUT do you really want to pay for it?    int checkBtn = BlackSmithForgeMSGOwned.Show()    If (checkBtn == 0)	 ; Damn, I guess you can use the forge, if you really must	 Game.GetPlayer().removeItem(Gold001, 10)	 self.activate(triggerRef, true)	 playAnimation("activate")    EndIf   EndIf  Else   playAnimation("activate")  EndIfElse  self.activate(triggerRef, true)  playAnimation("activate")EndIfendEventEvent OnTriggerEnter ( objectReference triggerRef )if (triggerRef == Game.GetPlayer())  FlameDamage.Cast(triggerRef, triggerRef)endIfendEvent
User avatar
Unstoppable Judge
 
Posts: 3337
Joined: Sat Jul 29, 2006 11:22 pm

Post » Thu Jun 21, 2012 8:58 pm

You have:

if (triggerRef == game.getplayer())    ; Do you own the forge, if so, sorry, you can use it freely!    If (triggerRef.GetActorOwner() != Game.GetPlayer().GetActorBase())

I think you mean Self.GetActorOwner() ?
User avatar
Lyndsey Bird
 
Posts: 3539
Joined: Sun Oct 22, 2006 2:57 am

Post » Thu Jun 21, 2012 6:59 am

What's the difference? It appears to work my way. I'll male you suggestion change and see if I feet a different result. Thank you?

I would still to know the difference if you don't mind?

User avatar
Alexandra walker
 
Posts: 3441
Joined: Wed Sep 13, 2006 2:50 am

Post » Thu Jun 21, 2012 6:15 am

"triggerRef" is the actor who triggered the forge. In the first "if" line that I quoted you're checking that this actor is the player. So then your second "if" statement says, "if the owner actor of the player is not the player"--which doesn't make logical sense. What you're trying to do, I believe, is check the ownership of the forge. You don't really even need the "self" that I suggested, but I find it useful to include for just this sort of logic readability.
User avatar
Robyn Howlett
 
Posts: 3332
Joined: Wed Aug 23, 2006 9:01 pm

Post » Thu Jun 21, 2012 11:28 am

What's the difference? It appears to work my way. I'll male you suggestion change and see if I feet a different result. Thank you?

I would still to know the difference if you don't mind?
That line, as it is, is asking if the player owns the player. *'GetActorOwner()' will check the ObjectReference the script is attached to.

*'Self' is unnecessary given GetActorOwner() can be called implicitly. Avoid 'Self' unless they're needed, like passing as an argument like 'FXShader.Play(Self)'.
User avatar
Helen Quill
 
Posts: 3334
Joined: Fri Oct 13, 2006 1:12 pm

Post » Thu Jun 21, 2012 10:00 am

"triggerRef" is the actor who triggered the forge. In the first "if" line that I quoted you're checking that this actor is the player. So then your second "if" statement says, "if the owner actor of the player is not the player"--which doesn't make logical sense. What you're trying to do, I believe, is check the ownership of the forge. You don't really even need the "self" that I suggested, but I find it useful to include for just this sort of logic readability.
That line, as it is, is asking if the player owns the player. *'GetActorOwner()' will check the ObjectReference the script is attached to.

*'Self' is unnecessary given GetActorOwner() can be called implicitly. Avoid 'Self' unless they're needed, like passing as an argument like 'FXShader.Play(Self)'.

Thanks guys. Sorry for the blunder, I am still trying to figure out this scripting for Skyrim. Was so much easier in oblivion and morrowind (Could be that I was more use to them.) The wiki is as useful to me as a man speaking Latin. I would be lost without the forums. Thank you very much. Ill have to try this and see if my problems magically disappear
User avatar
Erin S
 
Posts: 3416
Joined: Sat Jul 29, 2006 2:06 pm


Return to V - Skyrim