Jump to content

OnActivate Script Request


diamok

Recommended Posts

So, my scripting skills are far below what I would like them to be, as such, I just cannot figure out how to write what I need.

 

Now, I do not like coming out and blatantly asking someone else to do work for me, but I am about this | | close to being able to upload my mod to the Nexus, all I really need is this script. Also, if it's blasphemy to ask someone else to do this for me, I accept all criticism and understand.

 

Ok so, what I have is a piece of furniture, when it is activated I need a script to check the players inventory, if the player has the required items (an Inkwell and a Quill) the furniture interaction will proceed normally. However, if the player does not have both of the items, a pop up message will come up stating something like "You do not have the required Items to use this.". Upon hitting an ok button the interaction will finish and nothing will happen.

 

Hope I explained that good enough. If not and you are willing to write this for me, feel free to pm me.

 

Credit will be given for whatever work is done.

 

Again, forgive me for making this request and please be kind. :)

 

Take care,

Link to comment
Share on other sites

I gotchu...

 

Event OnCellAttach()
 Debug.Notification("Our parent cell has attached")
 self.BlockActivation()
endEvent

Event OnActivate(ObjectReference akActionRef)
 Debug.Notification("Activated by " + akActionRef)
if (Game.GetPlayer().GetItemCount(QuillProperty) > 0)
 Debug.Notification("Player has a quill")
 if (Game.GetPlayer().GetItemCount(InkProperty) > 0
   Debug.Notification("Player has ink")
   self.activate(game.getplayer(), true)
 else
     Debug.Notification("Player doesn't have ink")
     Message2Property.show() ; If you want to get specific, otherwise use MessageProperty
 endif
else
 Debug.Notification("Player doesn't have quill")
 MessageProperty.show()
endIf
EndEvent

 

You will need to add the following properties

 

MessageProperty

Message2Property

InkProperty

QuillProperty

 

in no particular order. And assign them the correct types.

 

The "Debug.Notification..." is for you to test with. To make these messages disappear, either remove them from the code, or follow this recommendation I will tell you now:

 

place a ";" in from of the very first character (letter) of that line of code.

 

so...

"Debug.Notification..."

becomes...

"; Debug.Notification..."

 

This is called "commenting it out" ... anything with a ; in front of it is ignored by the script, and is only there for your benefit as the coder/reader, and may be used to turn things off and on to test stuff, like we are doing here.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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