Jump to content

A little scripting help


Recommended Posts

Yes it would ... you will need to set up a variable to be your counter and if you are going to use a count from one chest to figure a option on a different chest you will need to use a global variable.

 

Just to get you started ... (script added to the chest)

 

Scriptname Bla_Bla_Bla extends ObjectReference

Int OpenCount = 0

 

Event OnOpen(ObjectReference akActionReference)

OpenCount += 1
If(OpenCount==(1))
; bla bla bla
ElseIf(OpenCount==(2))
; bla bla bla
EndIf
EndEvent
Link to comment
Share on other sites

  On 7/18/2016 at 4:00 AM, NexusComa said:

 

Yes it would ... you will need to set up a variable to be your counter and if you are going to use a count from one chest to figure a option on a different chest you will need to use a global variable.

 

Just to get you started ... (script added to the chest)

 

Scriptname Bla_Bla_Bla extends ObjectReference

Int OpenCount = 0

 

Event OnOpen(ObjectReference akActionReference)

OpenCount += 1
If(OpenCount==(1))
; bla bla bla
ElseIf(OpenCount==(2))
; bla bla bla
EndIf
EndEvent

 

 

So I did some research. Correct me if I'm wrong, but I think I should use properties in the script that refers to each one of the chests (each of the three chests is a separate class).

Link to comment
Share on other sites

it depends on what you're doing ... if something is to happen to each chest yes

 

looks like lofgren may be correct on the OnOpen command ...

One place shows it for doors but i found a forum talking about it has to have a open close animation ... so i'm not sure you will need to test that.

The bit of script i gave you was more to show how to add to a variable by 1.

Link to comment
Share on other sites

For containers: A script on the container would need OnActivate rather than OnOpen.

 

You can have a script completely local to the container that keeps track of how many times said container opens. However, you won't be able to use that information any where else. Depending upon how you want to use the information and where you want to use the information determines how you share that information from the local script to other scripts or other records.

 

Example 1 -- Completely local, no sharing:

 

  Reveal hidden contents

 

 

Example 1 -- Sharing to another script:

 

  Reveal hidden contents

 

 

Example 2 -- Sharing to other records AND other scripts:

 

  Reveal hidden contents

 

 

Those are just simple examples, none of which were tested for actual compilation. There may also be more methods to communicate between scripts and other records than what I have listed here. There may also be shorter methods of the above, especially where the math is located as some of it could be combined.

Link to comment
Share on other sites

I suppose. It depends on what you want to do. In your initial post you stated that you wanted to be able to "count the number of times each was opened". That would require a separate variable for each container in order to keep the count separate.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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