Jump to content

Adding weapons to weapon rack from container


raboni

Recommended Posts

noone has writen anything in 3 days so i take it there is no way to access a script property inside a object from a script in another object?

I'm not entirely sure what you're asking, but this is what I think you're asking:

 

How do I reference a property from ScriptA on ObjectReference A in ScriptB on ObjectReference B? If so, here's how:

 

Create a property in ScriptB of type ScriptA, like so:

ScriptA Property ScrA Auto
; ScrA is the property name, so it may be whatever you like
Then you can reference a property (say the name of the property to reference in ScriptA is called PropA) in ScriptB like so:

ScrA.PropA
An example of how to use it:

ScriptA Propery ScrA Auto

If ScrA.PropA == 0

     ; do some stuff

EndIf
Obviously you'd need the events and such, but that's the basic idea.

 

Is that what you were looking for?

Edited by Matthiaswagg
Link to comment
Share on other sites

 

noone has writen anything in 3 days so i take it there is no way to access a script property inside a object from a script in another object?

I'm not entirely sure what you're asking, but this is what I think you're asking:

 

How do I reference a property from ScriptA on ObjectReference A in ScriptB on ObjectReference B? If so, here's how:

 

Create a property in ScriptB of type ScriptA, like so:

ScriptA Property ScrA Auto
; ScrA is the property name, so it may be whatever you like
Then you can reference a property (say the name of the property to reference in ScriptA is called PropA) in ScriptB like so:

ScrA.PropA
An example of how to use it:

ScriptA Propery ScrA Auto

If ScrA.PropA == 0

     ; do some stuff

EndIf
Obviously you'd need the events and such, but that's the basic idea.

 

Is that what you were looking for?

 

the thing is that i have alot of objects with the same script, and i need to get not just the variable but also the state it's in (true/false for boolean). if i do it like that, how do i use ScriptB in ObjectReferance B and ScriptB in ObjectReferance C while still getting two different states?

Link to comment
Share on other sites

Set up a hidden Bool property on the script used by multiple objects and change its variable depending upon the state that is running. Then on the other script check that variable as well. It's true/false value will tell you what state that script instance is in so that you can use the other variable accordingly.

Link to comment
Share on other sites

what is a state? what i meant with state is what value the variables have (english is not my main language). i apparently still have some to learn how the papyrus works (i'm pretty new to papyrus).

Link to comment
Share on other sites

State as used by Papyrus (Skyrim's scripting language).

 

The link I gave you in post #9 in regards to using property variables from one script into another script is what you need to do. For every script instance (object with script attached) you will need to use that method.

 

Easiest may be to give an example:

 

I have 9 containers all with the same script. Each instance can have a different value for a specific variable. I want access to that variable for each container on a different script. On the script that will be using said variable I set up 9 properties and fill each to point to the same script but on the different forms.

abimIMSContainerScript Property Cont001Script Auto
abimIMSContainerScript Property Cont002Script Auto
abimIMSContainerScript Property Cont003Script Auto
abimIMSContainerScript Property Cont004Script Auto
abimIMSContainerScript Property Cont005Script Auto
abimIMSContainerScript Property Cont006Script Auto
abimIMSContainerScript Property Cont007Script Auto
abimIMSContainerScript Property Cont008Script Auto
abimIMSContainerScript Property Cont009Script Auto

Whenever I wish to use a variable pertaining to a specific form I simply call that variable with the correct property associated with both the script and the form in question. (See Matthias' examples in post #12 or the link in post #9)

Link to comment
Share on other sites

the thing is that i have a lot of objects with the same script, and i need to get not just the variable but also the state it's in (true/false for boolean). if i do it like that, how do i use ScriptB in ObjectReferance B and ScriptB in ObjectReferance C while still getting two different states?

That is exactly what MatthiasSwagg just explained to you. the property will be:

 

ScriptB property MyREF auto

 

Then when you attach the script to an object reference you fill MyREF with the objectreference that you want to grab properties from.

 

In order to get the state you would then write (e.g.) if(MyREF.bProp == true)

Link to comment
Share on other sites

 

the thing is that i have a lot of objects with the same script, and i need to get not just the variable but also the state it's in (true/false for boolean). if i do it like that, how do i use ScriptB in ObjectReferance B and ScriptB in ObjectReferance C while still getting two different states?

That is exactly what MatthiasSwagg just explained to you. the property will be:

 

ScriptB property MyREF auto

 

Then when you attach the script to an object reference you fill MyREF with the objectreference that you want to grab properties from.

 

In order to get the state you would then write (e.g.) if(MyREF.bProp == true)

 

but how do i fill MyREF with the objectreference?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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