Vylssius Posted August 4, 2021 Share Posted August 4, 2021 I'm pretty new to modding and all that so I'm sorry if I am overlooking something blatantly obvious. I am trying to make a mod where you have an aid item, and when you use it, it will open a container to store things in. I have a script on a magic effect that is using the activate function on the player to open the container. Problem is I keep getting the error (Activate is not a function or does not exist) I have tried a lot of things to fix this, but it seems like all the documentation I have found is incredibly vague. I assume I'm overlooking or missing something but I haven't been able to find anything on it. As far as the official creation kit wiki is concerned, I am using it exactly how it is meant to be used... so I don't understand why it isn't working. Thank you in advance for your help! [sOLVED]Well I kind of feel stupid but at least I learned something.For anyone else who might be having the same problem, you have to define your container as an ObjectReference instead of Container, because activate works on objectreference. ObjectReference Property ContainerName auto constNOTContainer Property ContainerName auto consteven though its a container you are activating... Link to comment Share on other sites More sharing options...
DieFeM Posted August 4, 2021 Share Posted August 4, 2021 a magic effect that is using the activate function on the player If you want to open the container then use activate on the container. Link to comment Share on other sites More sharing options...
Vylssius Posted August 4, 2021 Author Share Posted August 4, 2021 a magic effect that is using the activate function on the player If you want to open the container then use activate on the container. I have that, under the event OnEffectStart i have the line ContainerName.Activate(game.GetPlayer(), true) but im still getting the error :/ Link to comment Share on other sites More sharing options...
DieFeM Posted August 4, 2021 Share Posted August 4, 2021 The container must be the object reference (the one placed in the world). Link to comment Share on other sites More sharing options...
Vylssius Posted August 4, 2021 Author Share Posted August 4, 2021 The container must be the object reference (the one placed in the world).Yeah I have that (Container Property ContainerName Auto Const)Or do you mean something else? Link to comment Share on other sites More sharing options...
DieFeM Posted August 5, 2021 Share Posted August 5, 2021 container is a base object, the object reference is the object placed in the world, activate only works for references: ObjectReference Property ContainerName Auto Const And fill the property with the container from the render window. Link to comment Share on other sites More sharing options...
Vylssius Posted August 5, 2021 Author Share Posted August 5, 2021 Ohhh! That makes so much sense now! I'm so upset that flew over my head. Thank you for the explanation DieFeM! Link to comment Share on other sites More sharing options...
DieFeM Posted August 5, 2021 Share Posted August 5, 2021 You're welcome. A simple example that will help you to understand the way papyrus works: Note that, in the wiki, each script function has its own script type (ObjectReference, Actor, Weapon, Armor, etc...), and Activate() is part of ObjectReference. If for example you wanted to use GetAmmo(), which is part of Weapon Script, you should use a Weapon Property, or infiere it from the object reference, you can get the base object from a reference using GetBaseObject(), this returns a Form, which is a base object with an undefined type of script (it is a basic script type tho, which has some basic functions that all child objects can use), to convert this base object to a Weapon script you need to cast it using AS, once it is a weapon script you can call GetAmmo on it, and that's how you travers over the different types of scripts from object reference, which is the most commonly used since every object in the world are object references: Ammo MyWeaponAmmo = (WeaponReference.GetBaseObject() As Weapon).GetAmmo() Link to comment Share on other sites More sharing options...
Vylssius Posted August 7, 2021 Author Share Posted August 7, 2021 You're welcome. A simple example that will help you to understand the way papyrus works: Note that, in the wiki, each script function has its own script type (ObjectReference, Actor, Weapon, Armor, etc...), and Activate() is part of ObjectReference. If for example you wanted to use GetAmmo(), which is part of Weapon Script, you should use a Weapon Property, or infiere it from the object reference, you can get the base object from a reference using GetBaseObject(), this returns a Form, which is a base object with an undefined type of script (it is a basic script type tho, which has some basic functions that all child objects can use), to convert this base object to a Weapon script you need to cast it using AS, once it is a weapon script you can call GetAmmo on it, and that's how you travers over the different types of scripts from object reference, which is the most commonly used since every object in the world are object references: Ammo MyWeaponAmmo = (WeaponReference.GetBaseObject() As Weapon).GetAmmo()That is some very useful information! Thank you for clarifying, I wish this information was more widely available, seems like a lot of information around papyrus is a secret lolI wish I knew people who were into this stuff so I wouldn't have to make so many forum posts when I need help, but I am not very good at making friends :/ Link to comment Share on other sites More sharing options...
Recommended Posts