Jump to content

Help: How do I assign Script Properties to an object created by the "placeatme" function?


Recommended Posts

Currently I am using PlaceAtMe with abInitiallyDisabled = true, so it is invisible when created. Then I use AddItem to add it to the inventory, and then I enable it. (I noticed that if I don't enable it afterwards, it still appears in the inventory, but remains disabled if they drop it so they can never pick it up again.) This has been working well in my testing.

Link to comment
Share on other sites

I hate to write this but papyrus does not have a Constructor, yeah PlaceAtMe  is the closest thing to it,  but it just a shitty little language.. with sweet f*#@ all functionally. Please note I am not saying it cannot be done, but I think you need to upgrade to C++ and SKSE plugin to solve this problem, btw you can use C# too if you know that, but for a Game I would 100% recommend C++

 

Link to comment
Share on other sites

the information on C++ you will not find for free either, you need to pay for a course, get some experience then revisit this

Answers this using a class diagram explain  to me what an Activator is

Screenshot 2024-05-22 104815.png

Don't bother looking at psc all that only has is bottom half, to do this your manipulating  private variables in top half with functions you create using C++ using a class you create extending the activator. Tell me what are the private variables in an Activator you need to fill for this to work?

Tough Love if you cannot cannot draw that  Activator diagram, even with some basic C++ you have not got a hope in hell of doing this.. or even understanding what required, see above above above about  experience, Good Luck on your journey, no matter what happens, you are going to learning a few thing, like Visual Studio Community edition is free, and how to make the most basic SKSE plugin ever..

Link to comment
Share on other sites

Lastly once you done all that work guess what, You will be using Papyrus PlaceAtMe(myActivator), do you still think place at me is a solution ?

EDIT

even @jaxonz reach out to @expired6978 for help on issues like this, try asking for help from someone active at the moment to help getting some generic experience on what to do, but no one gonna specific answer C++ or SKSE plugin question here. Rightfully so too, this is basic Skyrim Papyrus Forum

Link to comment
Share on other sites

3 hours ago, PeterMartyr said:

I hate to write this but papyrus does not have a Constructor, yeah PlaceAtMe  is the closest thing to it,  but it just a shitty little language.. with sweet f*#@ all functionally. Please note I am not saying it cannot be done, but I think you need to upgrade to C++ and SKSE plugin to solve this problem, btw you can use C# too if you know that, but for a Game I would 100% recommend C++

 

I hate to have to say this, but you don't know what you're talking about. PlaceAtMe is absolutely a constructor. Each object reference placed with PlaceAtMe is a new and unique form in game. I've had no problems using it in my own mods, (the most recent which I released a few days ago called Note Crafting.) There's actually another constructor too, which is ActiveMagicEffect. Each ActiveMagicEffect is likewise a new and unique form. 

Even if this problem, (linking two object references at runtime) weren't easily solvable with papyrus alone, there's absolutely zero reason to create an entirely new skse plugin when skse plugins for papyrus already exist that will accomplish this. I can think of two off the top of my head. PapyrusUtil includes StorageUtil which has the SetFormValue function. Papyrus Extender also has a SetLinkedRef function. 

SKSE plugins can be a powerful tool to accomplish things that weren't already possible in papyrus, but this isn't one of those instances. Also, the downside of making an SKSE plugin is that it breaks each time they update Skyrim, which is all too often.

And if you're serious about SKSE plugin development, there are a lot of free resources available. Mrowrpurr has an excellent youtube tutorial series on creating skse plugins. 

 

 

There's also a free course on c++ here https://www.learncpp.com/. Both I found very useful.

Link to comment
Share on other sites

@dylbill  I would say doing a course at uni and joining an open source project  is better way to get experience,  pfft.. following a video on youtube is not a replacement for that... so I am going to ask you, show us the class diagram for an Activator so you know what private variables you need to fill with this... 

ObjectReference Function PlaceAtMe(Form akFormToPlace, int aiCount = 1,
   bool abForcePersist = false, bool abInitiallyDisabled = false) native

Seriously? I am embarrassed for you, how are going fill the filled variables in the Activator? That you not going to show us with that Class Diagram, with place at me, I am alway open to being corrected, plus increasing my knowledge, but please do not point me to video on youtube designed for people WHO CAN NOT CODE.

I made to many Dynamic-linked Libraries to count and do not need a video explaining  it to me, plus I will admit I made none for skyrim cos I have move on.

Place At Me is the closest thing to a constructor skyrim has but it is part of the Objective Reference Script MATE and NOT a True Constructor, and I am ABSOLUTELY sure on that are you?

  

On 5/22/2024 at 11:18 AM, PeterMartyr said:

Lastly once you done all that work guess what, You will be using Papyrus PlaceAtMe(myActivator), do you still think place at me is a solution ?

EDIT

even @jaxonz reach out to @expired6978 for help on issues like this, try asking for help from someone active at the moment to help getting some generic experience on what to do, but no one gonna specific answer C++ or SKSE plugin question here. Rightfully so too, this is basic Skyrim Papyrus Forum

Link to comment
Share on other sites

🤣🤣🤣🤣 It's always the people boasting they are the best that are usually full of it, which you definitely are. If you could read, you'd know this issue is already resolved. Please go and read my first comment in this thread to find it. And your solution to this problem, instead of writing 4 or 5 lines of papyrus code is to learn a new language, reverse engineer the game to write an skse plugin which already exists. Brilliant 🤣. You are one the biggest trolls I've ever encountered. I haven't seen you post one piece of actual usable advice here. You either mock the op asking the question, or boast that you're gods gift to programming without posting any actual code. Here you go MATE.

 

HERE'S ALL THAT ATTENTION YOU ORDERED - iFunny.jpg

Link to comment
Share on other sites

it was not mark as resolve when made my comment, I never directed any comment at you,  I never troll you you troll me with placeAtme is true constructor when clearly is not. and if placing an item disabled on the ground solve this? WeLl I guess PIG can fly too, and if you think free limited courses and youtube video is replacement for UNI, and open source project experience you are entitled to your opinion

But please do not call me a troll when clear as day I never trolled you, but the opposite is true..  I never even directed a comment at you until you attacked me

this my first troll comment: a troll solve this issue and got it resolved with a random  place it on the ground disabled

BTW Cloning not Constructor Either 

and PlaceAtMe is like Cloning, HAS your free stuff explained that to you

your see this in action when a user place a copy of the player with place at me..  a friggen clone

Now I am trolling YOU

plus when people say use move to Me not place at Me else you get a clone or a copy, this is well established knowledge..   too, how could you not  know this

So let go over what I wrote, PlaceAtMe is not a true Constructor , but an ObjectReference Cloner (it was implied in first reply to @dylbill when I stated it is function in the Object Reference Script)

now who beside @dylbill wants to disagree with that?  ASKING? It not a crime.. OK 😂😂😂😂 it can only  clone ObjectiveReference and can construct S W  E E T F U C K A L L

Link to comment
Share on other sites

Well at least you're posting actual code now, so that's a positive, but you're still giving out wrong information. 

I will reiterate, PlaceAtMe IS a constructor, it constructs a new objectReference. Moreover, each script in papyrus is it's own class or type, which means that yes you can create your own types. You can ALSO write your own constructor for your new class / type in papyrus. There is no need to use SKSE for this. Here's an example of adding playing cards to the game, just to prove a point. 

scriptname PlayingCard extends ObjectReference 
;attach to a new misc object in the creation kit

string[] property suitStrings auto hidden


string[] property facecardStrings auto hidden

int property suit auto
int property number auto

Event OnInit()
    suitStrings = new string[4]
    suitStrings[0] = "CLUBS"
    suitStrings[1] = "DIAMONDS"
    suitStrings[2] = "HEARTS"
    suitStrings[3] = "SPADES"

    facecardStrings = new string[4]
    facecardStrings[0] = "ACE" 
    facecardStrings[1] = "JACK"
    facecardStrings[2] = "QUEEN"
    facecardStrings[3] = "KING" 
EndEvent

PlayingCard function Create(int iNumber, int iSuit, MiscObject playingCardMisc, objectReference placeAtMeRef = none, bool abForcePersist = false, bool abInitiallyDisabled = false) Global
    if !playingCardMisc 
        return none 
    endif 

    if !placeAtMeRef
        placeAtMeRef = Game.GetPlayer()
    Endif 

    if iNumber < 1
        iNumber = 1
    elseif iNumber > 13
        iNumber = 13 
    Endif

    ObjectReference cardObj = placeAtMeRef.PlaceAtMe(playingCardMisc, 1, abForcePersist, abInitiallyDisabled)
    PlayingCard card = cardObj as PlayingCard 
    if card 
        card.Number = iNumber
        card.suit = iSuit
        return card
    Endif
EndFunction 

string function getSuitString()
    return suitStrings[suit]
EndFunction

string function getNumberString()
    if number >= 2 && number <= 10 
        return number as string 
    elseif number == 1
        return facecardStrings[0]
    else 
        return facecardStrings[number - 10]
    endif
EndFunction

string function getFullCardString()
    string suitString = getSuitString()
    string numberString = getNumberString()
    return numberString + " OF " + suitString
EndFunction 

 

Then in another script you can do this: 

MiscObject Property playingCardMisc Auto 
;PlayingCard script is attached

Event OnInit() 
    Utility.wait(1)
    PlayingCard cardA = PlayingCard.Create(0, 3, playingCardMisc) ;ace of spades
    PlayingCard cardB = PlayingCard.Create(12, 2, playingCardMisc) ;queen of hearts
    PlayingCard cardC = PlayingCard.Create(9, 1, playingCardMisc) ;9 of diamonds
    PlayingCard cardD = PlayingCard.Create(7, 0, playingCardMisc) ;7 of clubs 

    Debug.MessageBox(cardA.getFullCardString() + "\n" +\
    cardB.getFullCardString() + "\n" +\
    cardC.getFullCardString() + "\n" +\ 
    cardD.getFullCardString())
EndEvent 

 

I've attached a photo of the result. 

skyrimCardTest.jpg

Link to comment
Share on other sites

  • Recently Browsing   0 members

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