Jump to content

Get object ID the script is attached to


theimmersion

Recommended Posts

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

Because it's all one page. I usually either search the page on the string "TIP: Level Lists", or jump down to the "Refs: Scripting" section and click on the internal "Tip:" link there. Hmm. Let me see if the forum will permit that internal link. Yes it apparently does if I post it as an external link form.

 

Learn some new. I'll do that in future.

 

-Dubious-

Link to comment
Share on other sites

So I guess you knew that Tunnel snakes Rule ? Sorry to drag up oldy moldy stuff then .

 

Your post tip , with my addition suggestion.

 

  • GetBaseObject Returns the base object id of the calling reference ... if called on references spawned by one. Will return the leveled character/creature form-ID found in the Lvled section below Creature / NPC of the object tree. Which will not be an actual NPC , but merely an object that holds a list of other Base actors.
  • GetBaseForm (A function added by NVSE) Returns the actual base form of a leveled calling reference. Meaning it goes within the list of the lvled object , and finds the Base-ID it picked at random. Hence this would have to be called in scripting , after the Lvled item ref loads .

~~~~~~~~~~~~~~~~

 

Just my 2cp on it ... and still could probably be explained better :laugh:

 

Add edit : yes definitely adding a link to the actual page was most helpful

Link to comment
Share on other sites

I think those are good clarifications, and added them. But for "GetBaseForm", by my reading it returns the "Base-ID" template FormID common to all the instanced objects of the one randomly selected from the list rather than a "reference" FormID of the random object spawned. This is one of those instances where the precise distinctions between "Base-ID" (the template), "Ref-ID" (the instance reference), and the more general abstract "Form-ID" need to be kept in mind and made clear.


BTW: I decided there are now so many TIPS (30) in the Scripting section they needed their own headers so they would appear in the ToC. It will make it easier to edit them as well.


And it is not my intention to hijack this thread. Just it's spawned useful info for scripters.


-Dubious-
Link to comment
Share on other sites

Ok, to laying it all out.

 

I want to make it so that you have only 50 carry weight. Picking up a backpack would have its own inventory and thus its carry weight of about 100 (balancing later to come)?

The backpack cant be just in your inventory, its always equipped if you pick it up until you drop it. If you pick another backpack variation, the first one should be dropped. I want to expand that on Power Armors as well, you cant just have them in your inventory, you either wear them, or carry them via (z grab).

Which i also want to make the z grab a bit more stronger and make it so it sticks when you change cells.

Because your magic pockets cant hold a freakin' PA. xD

The issue im seeing tho is that backpacks would have to be persistent refs and manually placed if they are to have inventory each and also have somehow to disable the ability to sell it to vendors because of that. But you should be able to store it into a larger crate tho. Now id need to find a way to recognize its a crate for the backpack to fit. Want to make a brahmin follower as well that you could bring with you on your travels and carry your stuff.
Want to make small stals with NPC renting or selling brahmin for that purpouse. Similar to Skyrim and horses, in front of major holds.
But i digress...

... first is to try and hinder player carrying 10+ guns/clothing/armors/etc

Which means backpacks. :smile:
So, anyone up for a larger project mod? Perhaps should actually start a new topic for that mod im trying to make with a list of things need to be done and what is done etc... ? I callded it Fallout Restarted (yeah, just cant find a good name) xD

Edited by theimmersion
Link to comment
Share on other sites

Yes, GBF will return a Base ID, not a Ref ID, which can be confusing as both types can be let/set to a ref variable.

 

----------------------------------------------------------------------------------------------------------------------------------

So, for what you want to do, here are some general steps:

1. The player carry weight is something you probably have already done.

 

2. The backpack carry weight can be done by linking them to another actor's inventory (put said actor in a special hidden cell and give them no AI) and using

https://geckwiki.com/index.php/OpenTeammateContainer

 

3. You can use a perk with an Entry Point for Activate, or you can just make all the in-world backpacks activators and script a message box. If you make them takable inventory items, you can do an OnAdd block that equips the item, whereas with an Activator, you'd add the inventory version (a separate form ID entirely) to the player and then script it to be equipped after adding it (in that same block, not using OnAdd), setting the NoUnequip flag. Whatever the case, the other button should be the OpenTeammateContainer button. Also, unless you need loads of conditionalised buttons, this is the best way to script message boxes:

https://geckwiki.com/index.php/MessageBoxExAlt

 

So far, all of this can be done on each duffel bag's base object.

 

4. You could use the hotkey with IsKeyPressed, but I'd rather use IsControlPressed or much better,

https://geckwiki.com/index.php/SetOnControlDownEventHandler

and then explain in the description which hotkey you're setting it to use. This makes it easier to avoid conflicts, at least in my view. Unfortunately, the player can't change the hotkeys, so it's not perfect. If you want it to be the I key, then I'd still prefer an event handler:

https://geckwiki.com/index.php/SetOnKeyDownEventHandler

 

Note that event handlers must be set every time the game is launched. Do this with a quest that runs in MenuMode 4 and uses If GetGameRestarted.

 

5. What I think you are having trouble with is replacing theimmersionDuffleBagArmor from your example scripts with a more general thing, because what you never did was offer your complete script, formatted and indented in a code text box with an explanation of where it's used and I now suspect you were using a quest script. What you need to do is in that script, or any quest script, have a ref variable called rBackpack or rDuffelBag or whatever you want (but for our sake, please prefix it with a lowercase r). Then, when you want to do these operations on it, let/set that variable to GetEqObj 7:

let rDuffelBag := GetEqObj 7

You can do a safety check by keeping all your duffel bag base IDs in a form list and then you can check If rDuffelBag.IsInList:

https://geckwiki.com/index.php/IsInList

 

6. You can set the NoUnequip flag any time you like via

https://geckwiki.com/index.php/SetNoUnequip

and check it with

https://geckwiki.com/index.php/GetNoUnequip

 

7. A simple way to handle forcing the player to be unable to hold the duffel bag without equipping it would be to use an OnUnequip block with one of these:

https://geckwiki.com/index.php/Drop

https://geckwiki.com/index.php/DropAlt

https://geckwiki.com/index.php/DropMe

Of course, you can add conditions in there if you like.

 

8. To switch duffel bags, you can include a check in the button that equips a duffel bag:

If player.GetEqObj 7
    Let rBackPack := player.GetEqObj 7
    If rBackPack.IsInList <Form List You've Made For Duffel Bags>
        player.DropAlt rBackPack 1
    EndIf
EndIf

9. All right, I need to get out of here. Ask me any questions, tell me if I forgot something, &c. &c.

Link to comment
Share on other sites

Lots of info. Ill check and see what i can do. Awesome. Thanks!

 

BTW, gotta ask, i just could not find anything on aligning mags or trigger in .nif files for weapons. I have a model where the clip is not where it supposed to be. No matter where i move it within the .nif file, it always ends up on the same but wrong location.

Also, a list of the .nif strings that activate things would be nice if it existed (or however its called). Ya know, like you name a node ##PPInvis and anything within that node will be invisible unless equipped etc... That would be amazing. Would be cool if there were some that makes something invisible while holstered.

Link to comment
Share on other sites

I would make a separate post about the .nif stuff. I've never actually worked with weapon NIFs, so you'd be waiting for someone else. Candidates that come to mind are uhMattBravo, madmongo, and pixelhate. I tend to think of pix as something of a NIF expert, and if you wanted to message him directly, you can tell him I suggested it and I apologise if he's busy.

 

I realise my post has something about setting the NoUnequip flag as soon as you equip the backpack. I don't remember why I said that. I think I had a different approach in mind when I started, I left for a bit, and then I came back with a new plan. So you may want to disregard that line if you can't discern why I said it.

Link to comment
Share on other sites

NoUnequip should be a safeguard the player doesnt place the armor into the container its connected to or doesnt sell it to a vendor and similar things. xD Ill try and work it out. Ill post my results.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...