krestor Posted December 9, 2022 Posted December 9, 2022 I am trying to make a mod where the the player can pick up a special lockpick and lockpicks do not break and if they drop it lock picks break again this is one of the scripts i have tried any idea why it wont compile. I am very new to scripting. Script[ Scriptname UnbreakablePickTest extends ObjectReference Perk Properties Unbreakable auto Event OnItemAdded() Game.GetPlayer().AddPerk(MUBUnbreakLock) Debug.Notification("Perk Should Be Added") EndEvent]
traison Posted December 9, 2022 Posted December 9, 2022 (edited) Perk Property Unbreakable Auto Edited December 9, 2022 by traison 1
Visio Diaboli Posted December 9, 2022 Posted December 9, 2022 (edited) Apart from properties->property, make sure that your event signature on line 5 reads Event(OnItemAdded(FormakBaseItem,intaiItemCount,ObjectReferenceakItemReference,ObjectReferenceakSourceContainer) as this matches the signature the engine is going to expect the event to have when it tries to receive it. (the parameter names aren't important, e.g. akBaseItem can be pickedUpItem or whatever you want, but the types need to match) Also, OnItemAdded will only be called when the ObjectReference it's attached to receives an item. I can't tell what your script is attached to, but if it is supposed to be invoked when the player receives the item, you'll want it to be attached to the player. You can't modify the player's OnItemAdded directly, so what you'll probably want to do is: 1. Make a quest 2. Make an alias in that quest, and point it to the player 3. Create a new script on that alias, and paste <everything but the Scriptname line> into that file so that the player gets your OnItemAdded attached to them via the alias Edited December 9, 2022 by Visio Diaboli
MTB Posted December 9, 2022 Posted December 9, 2022 (edited) Its property not properties (Usually looking at the first error gives a good hint at which line to start. Following errors often make less sense as the compiler is already off on the wrong path...) Assuming this script is placed on the item you likely want something like : Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) if akNewContainer == Game.getPlayer() ; ensure perk active else ; ensure perk inactive endif EndEvent rather than OnItemAdded Edit: Oops too late well the last part might be useful yet as it's easier than VD's valid solution. Edited December 9, 2022 by MTB 1
Visio Diaboli Posted December 9, 2022 Posted December 9, 2022 3 minutes ago, MTB said: Edit: Oops too late well the last part might be useful yet as it's easier than VD's valid solution. Yea either way, though now I think MTB's is probably wiser lol
krestor Posted December 9, 2022 Author Posted December 9, 2022 @MTB So what is ;ensure perk active and i don't see how to add the perk. sorry if the answer is obvious
krestor Posted December 9, 2022 Author Posted December 9, 2022 I am starting to think it might be a good idea to do it threw a quest i don't know
krestor Posted December 9, 2022 Author Posted December 9, 2022 So i have tried add ing the unbreakable perk then i tried adding a perk i made that is supose to make make picks unbreakable then i tried adding the skeliton key perk and the lockpick still breaks
traison Posted December 9, 2022 Posted December 9, 2022 My recommendation would be for you to look at the Locksmith perks from Fallout 4 as they do what you're trying to do here. That is assuming you own that game.
MTB Posted December 9, 2022 Posted December 9, 2022 (edited) 1 hour ago, krestor said: So i have tried add ing the unbreakable perk then i tried adding a perk i made that is supose to make make picks unbreakable then i tried adding the skeliton key perk and the lockpick still breaks 1 hour ago, krestor said: @MTB So what is ;ensure perk active and i don't see how to add the perk. sorry if the answer is obvious ; this is a comment. So ; ensure perk active would be what you already had: Game.GetPlayer().AddPerk( Unbreakable ) Debug.Notification( ""Perk Should Be Added" ) Do you see the notification when you pick up the item ? If so the script is running. Make sure you filled the property on the script. (Try it with the unbreakable perk that is already in the lockpick tree before trying to make your own perk. Is that the one you mean when you say `skeliton key perk' ?) If not: the script is not running. Did you place it on the objectbase of the item that is supposed to supply this power / or the actual object reference ? (Try placing the object somewhere out in the world. Or just dropping it and picking it up again; Inventory objects don't always exist as object references.) Edited December 9, 2022 by MTB
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now