Jump to content

Get object ID the script is attached to


theimmersion

Recommended Posts

A duffle bag that you can wear, drop, stash in some container.
The trick here is that itself opens a special container when "I" key is pressed.
The problem is, you can move it to that special container.
I made a workaround that removes it when dropped and readds to player but thats an ugly workaround.
Can i somehow flag the item as a quest item when its container is being opened?
BEGIN MenuMode 1008
set rBackpackCURRENT to GetSelf ; <- Returns blank and fails in game (returns code) when it gets to 'setQuestObject' ! -.-#
set rBackpackBaseCURRENT to rBackpackCURRENT.GetBaseObject
setQuestObject rBackpackBaseCURRENT 1
; USED TO RE-EVAL LIST
player.AddItem Pencil01 1 1
player.RemoveItem Pencil01 1 1
endif
END
BEGIN GameMode
setQuestObject rBackpackBaseCURRENT 0
END
And heres the meat, it will be lots more items and i need a way to not hardcode scripts to specific armor ID's but just use the armor id the script is attached to. I could not find a solution yet. Please help!
I guess i could replace the above with:
BEGIN MenuMode 1008
setQuestObject theimmersionBackpack01 1
; USED TO RE-EVAL LIST
player.AddItem Pencil01 1 1
player.RemoveItem Pencil01 1 1
endif
END
BEGIN GameMode
setQuestObject theimmersionBackpack01 0
END
But now image adding 10 backpacks, id need 10 scripts with as little edits as:
script 1 attached to

setQuestObject theimmersionBackpack01 1

script 2 attached to

setQuestObject theimmersionBackpack02 1

script 3 attached to

setQuestObject theimmersionBackpack03 1

 

Instead of this (if its possible in some way)

script 1 attached to theimmersionBackpack[01-10]

setQuestObject this 1

 

Please help!

Link to comment
Share on other sites

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

I am...really confused about what you want to do. You want your duffel bag to be a quest item. I got that. Why you want that I have no idea. If it's an inventory item, it can't actually be a container, though it can link to one and thus have the appearance of one. But what this means is that the duffel bag item itself doesn't need to be a persistent reference because the inventory it links to is still technically a separate container. That's the best understanding I could get of what you're trying to do.

Link to comment
Share on other sites

Sorry for confusion, tried to find words to condense what i want. Also was very tired because i tried to find solution to this thing all day yesterday.
I have a mod i want to update, its called duffle bag. Its simple, you wear a duffle bag on your bag but if you press I key, it opens a container (simulating its the duffle bag) so naturally, it only works when you wear it, Also, if you place the duffle bag armor down and press E on it, message pops up asking you to:

open

equip

cancel

Essentially, a container you can transport.

Now the problem im having is that you can put the duffle bag into that container (essentially put it into itself) if you get what i mean. That should not be possible. I made a script where if you place the duffle bag into itself (the container that simulates the inventory of the duffle bag), it will return it to you.

But i have issue with that. See, if it was a quest item, it would not appear in the container menu in the first place so player cant place the duffle bag into the container by default, looks much better. Of course, side effect that you cant equip/unequip/drop etc. So, i want to toggle the quest item flag from the script but i somehow need to get the base id from the item the script is attached to so i can put the script on any backpack kind of armor and it will work.

Otherwise, id need to create scripts for each armor.

 

To highlight, id be using *setQuestObjec* but i just for the life of me cant figure out how to get the damn base id from the armor the script is actually attached to which is really weird. Naturally, im asking because *GetSelf / This* failed.

So, i can create the script and hardcode the armor into that script but it would need separate scripts for each backpack armor which i dont want.

I want to change the Base ID *setQuestObject theimmersionBackpack01 1* and change it for a variable that gets the base ID from the armor it is attached to.

Like:

set VarToHoldBaseID to *someway to retrieve the base id from the armor this script is attached to*

setQuestObject VarToHoldBaseID 1

instead of:

*setQuestObject theimmersionBackpack01 1*

because now i can make 50 shades of grey duffle bag if i so please and just use the same script.

As it now stands, each armor would need its own written script.

 

Hope this explains a bit better. :smile:

 

The goal here: Make players inventory much much smaller, make a backpack mod with its own inventory that has carry weight capacity as well. Im trying to make a immersion mods.

Edited by theimmersion
Link to comment
Share on other sites

I'm still a little confused about some of the second half of your post, but if I were doing this, if I understand what you want, I would use a slightly complex script with SetNoUnequip, which is a JIP LN function. If I wanted to get the Base ID of something, I'd use GetBaseObject, which is added in NVSE but I don't see a need for it here. Without JIP LN, I would use a script on the magic container that the duffel bag opens and put

Begin OnActivate
SetQuestObject <Duffel Bag BaseID> 1
StartQuest <QuestID of Duffel Bag Reset Quest>
End

As you can see this starts a quest that I would make. This quest would have

Begin GameMode
    If MenuMode
    Else
        If <Duffel Bag BaseID>.GetQuestObject
            SetQuestObject <Duffel Bag BaseID> 0
        Else
            StopQuest <This Quest>
        EndIf
    EndIf
End

Edit: I'm on my way out the door and the script is rushed, so if it doesn't work, proofread it and see what you you can fix.

Edited by EPDGaffney
Link to comment
Share on other sites

Are you saying any armor piece can then be turned into a duffle bag by picking up this duffle bag world item.

And you are wanting to place your script on the base id of the armor you happen to be wearing ?

 

Because honestly I would just have a quest hold the scripting , or have a script base effect run it , via Actor Effect / Perk.

 

And while the player is wearing the back pack ... they are the container just like normal.

But you can put constraints on carry weight and item counts for immersion.

 

Plus if it is for immersion ... why not make the player have to take the back pack off to look in it.

Something like this on a quest script or Actor effect.

 

Begin MenuMode 1002 ; player inventory

 

If ; what ever conditions needed here.

; close the pipboy , and play animation forcing 3rd person like sitting in chair does.

; To take the back pack off and place it on ground.

 

Player.PlaceAtMe MyBackPackRef 1

; then move all the player inventory items not equipped , or filter a few others to it ?

 

endif

End

 

And the player has a perk / entry point / Activate. To filter for this specific container ... which they will get the second option to equip and run a script there.

Or it will open the container ... plus you could have a script on the container of menu mode 1008

To let the player get the repair and equip different items functionality of the pip boy.

 

Sorry that is just some rough idea ... but could get more specific if that route is within your end product vision.

Link to comment
Share on other sites

Ugh... xD

 

Ok, Please visualize.

On the floor, you see a duffle bag which is a armor (biped 7 - backpack). If you press E on it, a message asks you to take it or open it.

If you choose to open it, it opens a container (emulating its the backpack container, its in some cell for that purpose).

If you choose to take it, you just take it in your inventory.

But you can also open the backpack while you carry it by pressing I key (you just can, why is not important right now).

So, when the container opens while the duffle bag armor is in your invenotry, i want it to become a quest item or what ever to hide it from the list.

I can actually do all that like this:

 

Begin MenuMode 1

if BackpackState == 1
set BackpackState to 2
endif

END

 

 

Begin GameMode

if IsKeyPressed 23 != OpenInventoryContainerKey
set OpenInventoryContainerKey to IsKeyPressed 23
endif
; RE-EQUIP AS UNEQUIPABBLE TO PREVENT PLAYER FROM PLACING IT IN THE CONTAINER
if OpenInventoryContainerKey == 1
set BackpackState to 1
player.unequipitem theimmersionDuffleBagArmor 0 1
player.equipitem theimmersionDuffleBagArmor 1 1
theimmersionBackpackInventoryREF.OpenTeammateContainer 1
endif

 

; AFTER MENU WAS OPEN AND CLOSED, RE-EQUIP AS REGULAR (DROP-ABLE) ARMOR PIECE

if BackpackState != 0

player.unequipitem theimmersionDuffleBagArmor 0 1
player.equipitem theimmersionDuffleBagArmor 0 1
set BackpackState to 0
endif
END
I keep noting here but dont get a is or is not possible answer nor solution to the detail im pushing for:
If i was to make 10 different duffle bags, i would have to write a unique script for each duffle bag because its using the baseID name >theimmersionDuffleBagArmor< and want to avoid that. I want one script to work an all of them.
I need this:
player.equipitem theimmersionDuffleBagArmor 1 1
to
player.equipitem GetSelf 1 1
I wrote GetSelf as an example.
So again, is it possible and how to get the ref or base id or whatever i need for "player.equipitem OBJECT 1 1" to work without hardcoding the BaseID's in the script?
Edited by theimmersion
Link to comment
Share on other sites

So, is your major problem that you want to be able to put the duffel bags inside each other? In that case, the best way I know involves the SetNoUnequip command as it works on a reference, but it requires JIP LN. Are you willing to use JIP LN for your mod?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...