Jump to content

Need help scripting


Extragorey

Recommended Posts

I'd recommend looking to see if there is a OnSkillUp method to bounce your Get skill and addperk script off of.

 

Running off loading or time is most certainly a waste of resources and just not a good practice.

 

I haven't dived into the Papyrus yet, but when I get home I'll look for a good method for you to bounce your script off of.

Edited by gengrimm
Link to comment
Share on other sites

  On 2/8/2012 at 9:26 PM, gengrimm said:

I'd recommend looking to see if there is a OnSkillUp method to bounce your Get skill and addperk script off of.

 

Running off loading or time is most certainly a waste of resources and just not a good practice.

 

I haven't dived into the Papyrus yet, but when I get home I'll look for a good method for you to bounce your script off of.

 

This one miiiight be better:

http://www.creationkit.com/OnTrackedStatsEvent_-_Form

 

Haven't toyed much with it yet, and the docs are slim in nature.

 

(There is no onLevelUp or onSkillUp events)

Edited by grey79
Link to comment
Share on other sites

Thanks for your help everyone - the script now compiles, which is a good start.

But...

It crashes the game.

 

 

  Reveal hidden contents

 

 

I set it to run when I activate the "WETempActivator" used in the wiki's scripting tutorial. I teleport to the test cell, activate the pillar and a few seconds later the game freezes.

Which as I see it could mean one of several things:

1) I'm declaring too many variables, which is ridiculous - this is a 21st-century computer we're talking about

2) The declared perks still aren't recognised as the pre-existing perks; it's trying to invent new ones

3) Judging by the fact that it takes a few seconds before it freezes (which is about how long it should be before the second procedure runs), there's probably something similar to an infinite loop or other problem with my code which is taking too much processing time. Which, considering I'm only using if statements, is also ridiculous.

 

So I'm going with 2), because it actually kind of makes sense that it's trying to add to the player a null perk which I've just declared but haven't defined.

Any futher ideas people? This script is getting to be more trouble than it's worth...

 

EDIT: @grey79, That looks more to do with stats than skills. But I don't suppose you'd happen to know anything about this "SomeFunction" the wiki uses in all its examples? Does this function have to be called from somewhere else in another script, or is it actually defining the function?

 

I'm also not sure about the "RegisterForUpdateGameTime(0.00139)" line. The floating decimal might be getting rounded to 2 decimal places or something (0.00 in this case), which would either not work at all or cause the second procedure to run repeatedly, no doubt crashing the game.

Edited by Teh Masterer
Link to comment
Share on other sites

Also, just the addperk line by itself in an OnActivate event still doesn't correctly add the perk.

 

Honestly, unless anyone who knows how the language works can advise me on how to fix it, I'm just going to give up until there's some proper tutorials for Papyrus.

The official tutorials consist of little more than Hello World and a few if statements, so there's just no way I'm going to be able to learn how to properly write this script without weeks of trial and error.

 

It's a shame, though, because I have a few friends who really wanted this.

Edited by Teh Masterer
Link to comment
Share on other sites

I did some looking my self and didn't see any on skillup or onlevel up. Next idea would be to find one that activates on activation of the perk, and refund a perk point to the player.
Link to comment
Share on other sites

  On 2/9/2012 at 5:54 AM, Teh Masterer said:

Also, just the addperk line by itself in an OnActivate event still doesn't correctly add the perk

 

Have you defined the perk in the properties window?

 

If you created the script before assigning it to the object, you need to open the "Scripts" tab in the Reference Window for the pillar you're activating from, select your script and click properties.

 

Then, for each property (i.e perk) you need to assign it to the correct property in the drop down list. Since you've used the correct perk names, you should be able to just click Auto-fill for each of them, and it will use the correct perk.

Link to comment
Share on other sites

  On 2/9/2012 at 3:25 PM, Edlennion said:
  On 2/9/2012 at 5:54 AM, Teh Masterer said:

Also, just the addperk line by itself in an OnActivate event still doesn't correctly add the perk

 

Have you defined the perk in the properties window?

 

Replying with QUOTE above for emphasis. This is VERY important. None of the tutorials seem to point that out. I learned about it writing scripts attached to objects, but then forgot completely about it when working on a script for a quest and got bit. You MUST do the above.

 

-MM

Link to comment
Share on other sites

Thank you Edlennion and MofoMojo, it worked!

 

The script now runs exactly as it should. Now I only need to think of a good place to call it. I agree that running it every 5 seconds is a bad idea - I think I'll make it run when the player wakes up from sleeping.

 

EDIT: Argh, you need to "RegisterForSleep()" to use that event. Which, of course, needs to be in a different procedure. Sort of redundant really. Why must everything be so complicated with this language?

 

EDIT2: Okay, I made it run OnSit. Random, I know, but it seems the simplest because you don't need to register for it.

So now whenever you sit down it checks to see if there's any perks it can grant you! Now to upload to the nexus.

Edited by Teh Masterer
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...