Jump to content

Get object ID the script is attached to


theimmersion

Recommended Posts

You're not explaining what you want. Or maybe you are, but you're including it in entire pages of other stuff.

 

First you ask for a way to get the base ID, which you can get by looking at the item in your own mod that you're working on. You don't want to 'hardcode' the base ID in the script? Well, I don't know what that means but if you mean you don't want to write the name of base object of the duffel bag in the script, I really have no idea why. And I have asked. Why are you trying to access the base ID in the first place if you don't want to use it? Is it somehow dynamic? Is it going to change? When you talk of making 10 duffel bags, do you mean placing 10 instances of the same base object in the world or making ten different base objects that you want to attach the same script to without altering it?

 

Wherever you need to do it, just use GetSelf with a reference variable and then use the reference variable in your script. Now, you know that GetSelf will only work on the duffel bag if the duffel bag is the calling reference, yes? So I don't know where you were planning on using the function but that's how it's used. I'm expecting that if the item is equipped in the backpack slot, you may find GetEqObj more useful than GetSelf.

 

Now, again, I'm asking you, are you or are you not using JIP LN in your mod?

Link to comment
Share on other sites

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

And making 10 scripts with minor variances isn't that hard.

You just cut paste the last one into the next. When an ID has to signify a different script ,object , whatever ...you simply use a suffix increment on it like ...

 

SCNMyBacPackScript01 ,SCNMyBacPackScript02,SCNMyBacPackScript03

 

Which you place on the corresponding base ID

 

MyBackPack01 , MyBackPack02 , MyBackPack03

 

And you have them refer to the remote containers in the same way.

 

MyRemoteContainer01,MyRemoteContainer02,MyRemoteContainer03

 

So you wrote one script , which you copy pasted 10 times , and simply made the increment suffixes match.

Easy Peasy :wink:

 

Whether or not your script works ... IDK , but some testing should tell you.

Link to comment
Share on other sites

Sorry EPDGaffney xD

 

And making 10 scripts with minor variances isn't that hard.

You just cut paste the last one into the next. When an ID has to signify a different script ,object , whatever ...you simply use a suffix increment on it like ...

 

SCNMyBacPackScript01 ,SCNMyBacPackScript02,SCNMyBacPackScript03

 

Which you place on the corresponding base ID

 

MyBackPack01 , MyBackPack02 , MyBackPack03

 

And you have them refer to the remote containers in the same way.

 

MyRemoteContainer01,MyRemoteContainer02,MyRemoteContainer03

 

So you wrote one script , which you copy pasted 10 times , and simply made the increment suffixes match.

Easy Peasy :wink:

 

Whether or not your script works ... IDK , but some testing should tell you.

 

I guess that will have to do. It would still be nice to know if there is a way to get the base id of a object the script is attached to.

Link to comment
Share on other sites

Sorry EPDGaffney xD

 

I guess that will have to do. It would still be nice to know if there is a way to get the base id of a object the script is attached to.

 

Are you not understanding what you are saying ?

 

If a base id has a script attatched ... that means the base ID holds the script and is internal. Therefore GetSelf returns what ?

 

Ya maybe it is returning the Ref ID ... but what would you be needing the base ID for anyways ? Cuz sheeze and rice ... it is holding the script.

Link to comment
Share on other sites

 

I guess that will have to do. It would still be nice to know if there is a way to get the base id of a object the script is attached to.

Em...it's GetBaseObject. But why do you want to do this?

 

 

But that seems to be saying it is for lvled items (lvled actors ?)

Not just any ref object made from a base ID.

 

And I am still confused what is the difference between GBO / GBF ? that ya'll were talking about in the other thread.

Link to comment
Share on other sites

 

Sorry EPDGaffney xD

 

I guess that will have to do. It would still be nice to know if there is a way to get the base id of a object the script is attached to.

 

Are you not understanding what you are saying ?

 

If a base id has a script attatched ... that means the base ID holds the script and is internal. Therefore GetSelf returns what ?

 

Ya maybe it is returning the Ref ID ... but what would you be needing the base ID for anyways ? Cuz sheeze and rice ... it is holding the script.

 

 

Well, i tried GetSelf and it didnt work. Who knows.... Thanks guys for helping! xD

Link to comment
Share on other sites

 

 

I guess that will have to do. It would still be nice to know if there is a way to get the base id of a object the script is attached to.

Em...it's GetBaseObject. But why do you want to do this?

 

 

But that seems to be saying it is for lvled items (lvled actors ?)

Not just any ref object made from a base ID.

 

And I am still confused what is the difference between GBO / GBF ? that ya'll were talking about in the other thread.

 

 

Oh wait I get it now ... GBO returns the Lvled Base-ID And GBF goes into the list within the Lvled Base-ID and gets the Base-ID that was picked by the lvled object. Is that right ?

Link to comment
Share on other sites

 

 

Sorry EPDGaffney xD

 

I guess that will have to do. It would still be nice to know if there is a way to get the base id of a object the script is attached to.

 

Are you not understanding what you are saying ?

 

If a base id has a script attatched ... that means the base ID holds the script and is internal. Therefore GetSelf returns what ?

 

Ya maybe it is returning the Ref ID ... but what would you be needing the base ID for anyways ? Cuz sheeze and rice ... it is holding the script.

 

 

Well, i tried GetSelf and it didnt work. Who knows.... Thanks guys for helping! xD

 

 

Sorry for derailing you ... but don't give up yet. We just need more clarification of the actual workings you are trying to accomplish. Yes GetSelf does only return the ref-id (sorry my bad :pinch: )

 

The point is ... this script is already attatched to the base-id you want to get. So what really is the point of trying to find out what that is ? Or are you trying to attach a script at run time to a base-id ???

 

Maybe if you could explain it frame per frame (so to speak) what the player will see in your vision of how it should be ... and never mind the scripting technicalities.

Link to comment
Share on other sites

Yes, that's what GBF does.

 

GetSelf returns a reference that you can store in a reference variable, referring to the specific instance of it in-game. This can be a problem with inventory objects because they are destroyed regularly.

 

GetBaseObject will return the base form of the calling reference, and that can be stored in a reference variable as well. I'm assuming that's what OP wants to do, but I really don't get why.

 

Again, GetEqObj with the backpack slot should do what you want.

 

Maybe if you could explain it frame per frame (so to speak) what the player will see in your vision of how it should be ... and never mind the scripting technicalities.

Yes, please do this.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...