Jump to content

Can't nail the syntax of a basic Papyrus function


Alighieri00

Recommended Posts

So I wanted a script that adds +20 skill to TwoHanded tree. Seems simple. The wiki says to use the following:

 

Function SetActorValue (string asValueName, float afValue)

 

 

My script reads:

 

Scriptname TwoHanded extends Perk

 

Function SetPlayerValue (TwoHanded, 20)

 

EndFunction

 

 

And I get the following errors:

 

(3,33): missing ID at ','

(3,35): no viable alternative at input '20'

 

I've tried just about every variation of this - SetActorValue (TwoHanded, 20), with and without commas, parentheses, I've tried 20.00, tried... well.. I've been trying for three hours now. Lil' help?

Link to comment
Share on other sites

Will nobody tell this poor guy that he needs to call the function inside an event ? This might help you, im not sure if its what you are trying to accomplish.. but at least it will show you the syntax.

Scriptname MyScript extends ObjectReference

Event OnEquipped(Actor akActor)
Game.GetPlayer().SetPlayerValue(TwoHanded, 20)
endEvent

So when you equip the weapon it sets two handed to 20

Link to comment
Share on other sites

Without looking further, are you sure want to set the actor value instead modifying it?

 

As it is it actually changes the actor base value, what is persistent... could make furious someone who had let's say 80 points in TwoHanded...

 

Unless you have a way to "return" the previous value you should not use SetAV but ModAV. Ahh, and since you are "getting" the actor, is ModActorValue you want and Not ModPlayerValue.

 

Edit: You should have another event to remove the boost on unequip. But this is supposition, I don't really know what is your real purpose (as in what want to achieve, just I think dangerous changing base values in persistent way).

Edited by nosisab
Link to comment
Share on other sites

Without looking further, are you sure want to set the actor value instead modifying it?

 

As it is it actually changes the actor base value, what is persistent... could make furious someone who had let's say 80 points in TwoHanded...

 

Unless you have a way to "return" the previous value you should not use SetAV but ModAV. Ahh, and since you are "getting" the actor, is ModActorValue you want and Not ModPlayerValue.

 

Edit: You should have another event to remove the boost on unequip. But this is supposition, I don't really know what is your real purpose (as in what want to achieve, just I think dangerous changing base values in persistent way).

Couldnt agree more, I just didnt use those modifiers and the author doesnt explain well what he wants to do, I was just showing the syntax, but yes if you want that on equipping the sword you better use modav, which basically what it does is to plus the value to the current skill (for example modav 20 with 60 sword skill will result in 80, and if you use -20 it will go back to 60).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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