Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Obtaining forms from another script


TripleSixes
 Share

Recommended Posts

Preface: I am going to simplify my scripts to ease troubleshooting.

I have script "A", which is used to declare properties that global functions in script "B" can use.

Script "A":   

 ScriptName rsAPI_Properties Extends Quest
    {Contains all the properties for rsAPI scripts}
    
    MiscObject Property myMiscObjectProperty Auto

 

Script "B":   

 ScriptName rsAPI_Functions Extends Quest Hidden
    {Contains all the functions for the rsAPI scripts}
    ;This function gets the forms from Script "A"
    rsAPI_Properties Function GetFrameworkProperties() Global
      return (Game.GetFormFromFile(0x294A97, "MyPlugin.esp") as Quest) as rsAPI_Properties
    EndFunction

    ;This function gets a specific form from Script "A" with the help of the above function.
    MiscObject Function GetMiscObject() Global
      return GetFrameworkProperties().myMiscObjectProperty
    EndFunction

    ;This function is an example of how I would like to handle the miscobject passed from Script "A"
    Function GivePlayerMiscObject(int howMany) Global
      Game.GetPlayer().AddItem((GetMiscObject()), howMany); I have tried declaring a MiscObject outside this command as well, but neither worked.
    EndFunction

The second function in Script "B" is used to return a miscobject, but it only returns NONE. This way of obtaining a property from another script seems to only work for certain types of forms. The properties have been defined in the CK in Script "A".

Any pointers papyrus wizards?

p.s. The reason I am approaching it this way is because Script "A" and Script "B" are an API of sorts. I want to use a function in Script "B" that references properties in Script "A" after passing parameters directly from Script "C", which would utilize the third function in Script "B" like this:   

 

Script "C":

ScriptName GivePlayerItem Extends Activator
    {Utilizes the rsAPI framework to give the player 2 MiscObjects}

    Event OnActivate(Actor akActionRef)
      rsAPI_Functions.GivePlayerMiscObject(2)
    EndEvent

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...