scorrp10 Posted January 12, 2023 Share Posted January 12, 2023 Umm... from OnRead, you are calling not your 'AddPerk' - you are calling AddPerk on the player Actor. Incorrectly too, cause it expects a Perk type parameter. Just move the contents of your AddPerk function into OnRead... unless you plan to invoke it from other places. In which case: Event OnRead() AddNextAlchemyPerk()EndEvent Function AddNextAlchemyPerk()... It would be ok to use 'AddPerk' function name, since neither ObjectReference not Form classes define it, but it helps to avoid confusing it with AddPerk being called on the player, and gives better idea about what function does. Link to comment Share on other sites More sharing options...
maxarturo Posted January 13, 2023 Share Posted January 13, 2023 You can't declare a Function's name as an already existing Papyrus function = AddPerk()* Plus, you have 'Typos'* Also, Don't use in succession the function 'Game.GetPlayer()', this function is very espensive and can cause lags.Use it once to declare and store it. Perk property Experimenter30AlchemyRedone auto Perk property Experimenter50AlchemyRedone auto Perk property Experimenter70AlchemyRedone auto Perk property Experimenter90AlchemyRedone auto Bool Property Exp30 = False Auto Hidden Bool Property Exp50 = False Auto Hidden Bool Property Exp70 = False Auto Hidden Bool Property Exp90 = False Auto Hidden Actor ActorPlayer Event OnRead() ActorPlayer = Game.GetPlayer() if Exp30 = False ActorPlayer.AddPerk(Experimenter30AlchemyRedone) Exp30 = True elseif Exp50 = False ActorPlayer.AddPerk(Experimenter50AlchemyRedone) Exp50 = True elseif Exp70 = False ActorPlayer.AddPerk(Experimenter70AlchemyRedone) Exp70 = True elseif Exp90 = False ActorPlayer.AddPerk(Experimenter90AlchemyRedone) Exp90 = True endif EndEvent Link to comment Share on other sites More sharing options...
WalkerInShadows Posted January 14, 2023 Author Share Posted January 14, 2023 (edited) Okay. So I had an idea, and tried something new: Scriptname AlchemyRedoneAddPerkExp extends ObjectReference Perk property Alchemist00AlchemyRedone auto Perk property Experimenter30AlchemyRedone auto Perk property Experimenter50AlchemyRedone auto Perk property Experimenter70AlchemyRedone auto Perk property Experimenter90AlchemyRedone auto Event OnRead() Game.GetPlayer().AddPerk() EndEvent FunctionAddPerk() if Game.GetPlayer().HasPerk(Alchemist00AlchemyRedone) Game.GetPlayer().AddPerk(Experimenter30AlchemyRedone) elseif Game.GetPlayer().HasPerk(Experimenter30AlchemyRedone) Game.GetPlayer().AddPerk(Experimenter50AlchemyRedone) elseif Game.GetPlayer().HasPerk(Experimenter50AlchemyRedone) Game.GetPlayer().AddPerk(Experimenter70AlchemyRedone) elseif Game.GetPlayer().HasPerk(Experimenter70AlchemyRedone) Game.GetPlayer().AddPerk(Experimenter90AlchemyRedone) endif EndFunction I finally figured out how to view the compiler log (man, the CK is seriously unintuitive), and it gave me this: AlchemyRedoneAddPerkExp.psc(13,15): no viable alternative at input '('No output generated for AlchemyRedoneAddPerkExp, compilation failed. I can see it's pointing to lines 13 and 15, but beyond that, I'm lost. Edited January 14, 2023 by WalkerInShadows Link to comment Share on other sites More sharing options...
scorrp10 Posted January 14, 2023 Share Posted January 14, 2023 Did you read my prior post? Scriptname AlchemyRedoneAddPerkExp extends ObjectReference Perk property Alchemist00AlchemyRedone autoPerk property Experimenter30AlchemyRedone autoPerk property Experimenter50AlchemyRedone autoPerk property Experimenter70AlchemyRedone autoPerk property Experimenter90AlchemyRedone auto Event OnRead() Game.GetPlayer().AddPerk() <<<< This will call 'AddPerk' on the Player object, NOT 'AddPerk' that you define below.EndEvent FunctionAddPerk() <<<< You need a space between Function and AddPerk. The error you get means problem in line 13, position 15. This is line 13. The problem is you got open parenthesis following something compiler does not recognize as function. if Game.GetPlayer().HasPerk(Alchemist00AlchemyRedone) <<<<< Game.GetPlayer is effin' expensive, AVOID using it. Game.GetPlayer().AddPerk(Experimenter30AlchemyRedone) elseif Game.GetPlayer().HasPerk(Experimenter30AlchemyRedone) Game.GetPlayer().AddPerk(Experimenter50AlchemyRedone) elseif Game.GetPlayer().HasPerk(Experimenter50AlchemyRedone) Game.GetPlayer().AddPerk(Experimenter70AlchemyRedone) elseif Game.GetPlayer().HasPerk(Experimenter70AlchemyRedone) Game.GetPlayer().AddPerk(Experimenter90AlchemyRedone) endifEndFunctionYou also completely messed up your function logic.What you had before:If player had no perk, it would give 'Experimenter30'. If player already had that, it would give 'Experimenter50' and so on.What you have now (assuming player has already been assigned Alchemist00 perk elsewhere) - it would every time succeed in 1st if, repeatedly re-adding 'Experimenter30' and never going to higher perks. What you should have instead:Scriptname AlchemyRedoneAddPerkExp extends ObjectReference Actor property PlayerRef auto <<<<< Instead of abusing Game.GetPlayer(), define a property.Perk property Alchemist00AlchemyRedone autoPerk property Experimenter30AlchemyRedone autoPerk property Experimenter50AlchemyRedone autoPerk property Experimenter70AlchemyRedone autoPerk property Experimenter90AlchemyRedone autoEvent OnRead() AddNextAlchemyPerk() <<<< This will call the function that is defined locally. And you should avoid defining custom functions with same name as native functions.EndEventFunction AddNextAlchemyPerk() if !PlayerRef.HasPerk(Experimenter30AlchemyRedone) PlayerRef.AddPerk(Experimenter30AlchemyRedone) elseif !PlayerRef.HasPerk(Experimenter50AlchemyRedone) PlayerRef.AddPerk(Experimenter50AlchemyRedone) elseif !PlayerRef.HasPerk(Experimenter70AlchemyRedone) PlayerRef.AddPerk(Experimenter70AlchemyRedone) elseif !PlayerRef.HasPerk(Experimenter90AlchemyRedone) PlayerRef.AddPerk(Experimenter90AlchemyRedone) endifEndFunction Then, in your .esp script properties, make sure to fill the PlayrRef property like this: Link to comment Share on other sites More sharing options...
WalkerInShadows Posted January 16, 2023 Author Share Posted January 16, 2023 (edited) Sorry.. for some reason, those two posts didn't show up. Like I said, I have zero expertience with Papyrus - all I know is what I've picked up from reading the wiki. I was using Game.GetPlayer because (surprise!) that's the example the wiki uses. Nice to know I had it (mostly) right the first time. :laugh: And thanks for the help. Edited January 16, 2023 by WalkerInShadows Link to comment Share on other sites More sharing options...
WalkerInShadows Posted January 16, 2023 Author Share Posted January 16, 2023 Another question: How do you check for multiple conditions? I want to do this: If A && B && CAddPerk PurityAlchemyRedone I'm fairly sure Papyrus doesn't use the && operand, so how does it work now? Link to comment Share on other sites More sharing options...
maxarturo Posted January 16, 2023 Share Posted January 16, 2023 (edited) It does:https://www.creationkit.com/index.php?title=Papyrus_Glossaryhttps://www.creationkit.com/index.php?title=Operator_Reference Edited January 16, 2023 by maxarturo Link to comment Share on other sites More sharing options...
maxarturo Posted January 16, 2023 Share Posted January 16, 2023 (edited) Example: If ( actor01.IsDead() ) && ( Actor02.IsDead() ) && ( Actor03.IsDead() ) ;;;;;;Do My Stuff EndIf Edited January 16, 2023 by maxarturo Link to comment Share on other sites More sharing options...
WalkerInShadows Posted January 17, 2023 Author Share Posted January 17, 2023 Oh, cool. Thanks! Link to comment Share on other sites More sharing options...
WalkerInShadows Posted January 19, 2023 Author Share Posted January 19, 2023 I was looking this script over, and I realized that it would add ALL the perks at the same time. I want to add an Alchemy check to add them at specific times. I know the command (PlayerRef.GetActorValue(Alchemy)), but I'm not sure how to implement it. The wiki isn't very clear on this point - I assume it's a separate function to check for the value... but then how do I apply it to this line: if !PlayerRef.HasPerk(MedAlchemyAlchemyRedone) && PlayerRef.GetActorValue(Alchemy) Link to comment Share on other sites More sharing options...
Recommended Posts