Help with a script please

Post » Mon Jun 18, 2012 5:10 am

Updated.

Fixed
User avatar
Carlitos Avila
 
Posts: 3438
Joined: Fri Sep 21, 2007 3:05 pm

Post » Mon Jun 18, 2012 7:02 pm

Edit: ignore this.
User avatar
Rachel Hall
 
Posts: 3396
Joined: Thu Jun 22, 2006 3:41 pm

Post » Mon Jun 18, 2012 1:22 pm

It's set up as a Quest ReferenceAlias, Enabled on Start. with no quest stages. Run Once is ticked (if unticked it applies the debuffs in OnInit 2x (could somone explain that?)).
I brought this up during the beta testing period. Here's what one of the developers (SmkViper) has to say about it:
OnInit is run when an object first becomes scripted and will run whenever an object is reset (since a reset clears all your properties and variables back to their initial values).

So what you’re seeing is the quest being created and the script attached running OnInit, then the game starting up the quest (since it starts enabled), which, because the quest can run more than once, will reset the script and re-run the OnInit event.

As far as your script can tell, it’s only been run once, but external systems (in this case, the message box) are getting two commands. You would see the same thing for any scripts attached to aliases on that quest, since they initialize and reset at the same time the quest does.

About your script - your "RemoveRested" function won't compile within the event because events are actually functions. You need to declare your functions outside of any events.

@trira:
It's not actually necessary to wrap conditions in parentheses, although I'll agree that it should be considered best practice.

Cipscis

EDIT:

It also looks like you haven't yet realised that Papyrus includes "bool" types, which would be appropriate for all of your "int" variables.

Cipscis
User avatar
BEl J
 
Posts: 3397
Joined: Tue Feb 13, 2007 8:12 am

Post » Mon Jun 18, 2012 6:15 pm

@trira:
It's not actually necessary to wrap conditions in parentheses, although I'll agree that it should be considered best practice.

Cipscis
Huh... how did I not notice that while reading the tutorials... My bad.
User avatar
noa zarfati
 
Posts: 3410
Joined: Sun Apr 15, 2007 5:54 am

Post » Mon Jun 18, 2012 4:21 am

About your script - your "RemoveRested" function won't compile within the event because events are actually functions. You need to declare your functions outside of any events.
Cipscis

I had this at one point and it was compiling but I was afraid it would run everytime the script was loaded - which was before I fully understood the relationship between OnInit and RunOnce. Thanks for the info!

Anyone have bright ideas as to why my ELSEIF statements aren't ever being satisfied? (see code original post)
User avatar
Carys
 
Posts: 3369
Joined: Wed Aug 23, 2006 11:15 pm

Post » Mon Jun 18, 2012 8:15 pm

About your script - your "RemoveRested" function won't compile within the event because events are actually functions. You need to declare your functions outside of any events.
EDIT:It also looks like you haven't yet realised that Papyrus includes "bool" types, which would be appropriate for all of your "int" variables.
Cipscis
Fixed above.
User avatar
Juliet
 
Posts: 3440
Joined: Fri Jun 23, 2006 12:49 pm

Post » Mon Jun 18, 2012 7:44 pm

Seems like this is the problem, but I don't know how to interpret it.

I get this trace error in the log:

error: HasMagicEffect called with invalid Magic Effectstack:[ (00000014)].Actor.HasMagicEffect() - "" Line ?[alias ALIAS_GETPLAYER on quest aaaDNInitDebuff (25000D62)].aaaRestedCheck.OnUpdate() - "aaaRestedCheck.psc" Line 49

And here's the line of code it's referring to :

if (Game.GetPlayer().HasMagicEffect(RestedWellSkillEffect))
User avatar
Lynette Wilson
 
Posts: 3424
Joined: Fri Jul 14, 2006 4:20 pm

Post » Mon Jun 18, 2012 8:44 am

Just a thought: did you assign any values to your properties when you attached your script?
User avatar
Mélida Brunet
 
Posts: 3440
Joined: Thu Mar 29, 2007 2:45 am

Post » Mon Jun 18, 2012 4:28 pm

Well I never set any properties on the script in the CK, so I went and looked at them. Appears they are automatically read and set from the script. The values were set at Default, so I changed to Auto, but i get the same errors in the log.

As I said this is set up as a Reference Alias. In the Reference Alias window I selected "Specific Reference" and set this to "Player".

Now on the long button to the right of "Specific Reference", it says Ref: 'PlayerRef' (00000014) to NPC_'Player' (00000007).

I believe that has something to do with the error - like my code is pointing to (00000014) when it should point to (0000007).


I get this trace error in the log:

 error: HasMagicEffect called with invalid Magic Effect stack:[ (00000014)].Actor.HasMagicEffect() - "" Line ? [alias ALIAS_GETPLAYER on quest aaaDNInitDebuff (25000D62)].aaaRestedCheck.OnUpdate() - "aaaRestedCheck.psc" Line 49 

And here's the line of code it's referring to :

 if (Game.GetPlayer().HasMagicEffect(RestedWellSkillEffect)) 
User avatar
Wane Peters
 
Posts: 3359
Joined: Tue Jul 31, 2007 9:34 pm


Return to V - Skyrim

cron