Jump to content

Is there a way to get an object's Editor ID in a cell?


iqoniq

Recommended Posts

I've got several widgets which are basically the same widget (master_widget). They've been named widgetA, widgetB, and so on in the cell I've put them in. Is there any way of getting the Editor ID from the cell (I've not got a problem with F4SE, as it's already being used)? They all basically alter the same thing by varying amounts, and I'd rather avoid load of tiny scripts all the saying the same thing except with 1 character changed.

 

Any help would be greatly appreciated and thanks in advance :smile: .

Link to comment
Share on other sites

The easiest way I've found to accomplish what it sounds like you are trying to do is to create a RefCollectionAlias and attach a Perk script to that. Then you simply add your objects to the RefCollectionAlias and the Perk script will run on each item. I use this particular method in several of my Fallout 4 mods.

Link to comment
Share on other sites

I guess I'm not being clear enough.

I have a widget (which is a button). I've placed several of them in an interior cell, each individually named in the cells editor ID. When activated they alter the value of a global variable. When the player goes to a terminal and selects a menu entry, the script will then produce a result depending on what the value of the variable is. Obviously, I could attach an individual script to each of them that sets the variable to the amount, but I was wondering if it could be done easily with a single script. Something I had in mind was like...

if EditorIDInCell == "widgetA"
  foo = 1
elseif EditorIDInCell == "widgetB"
  foo = 2
endif

I'm literally still cutting my teeth with scripts and how it all fits together, so I apologise if I'm missing something glaringly obvious.

Link to comment
Share on other sites

The method that I outlined previously will do what you are requesting. You would only have one script, multiple buttons in the RefCollectionAlias, and if you wanted to get extra fancy you could add in code to organize the buttons for you as they are loaded / added to the RefCollectionAlias.

 

Also, what is the overall goal here with these widgets? A puzzle? Knowing a bit more about what you are trying to accomplish can be helpful.

Link to comment
Share on other sites

The method that I outlined previously will do what you are requesting. You would only have one script, multiple buttons in the RefCollectionAlias, and if you wanted to get extra fancy you could add in code to organize the buttons for you as they are loaded / added to the RefCollectionAlias.

 

Also, what is the overall goal here with these widgets? A puzzle? Knowing a bit more about what you are trying to accomplish can be helpful.

 

Ah OK. When you mentioned perks I thought you meant it would set perks for the player. Looks like I'll have to lean how those work. Would you mind if I examined a few of your mods to see how it's done, and could you recommend one for me?

 

As for what I'm trying to accomplish...

 

The buttons set the global variable to a number between 1 and 8, which corresponds to invulnerable hostile turrets placed in the cell. The player then goes to a terminal and makes a choice of whether to disable or destroy the turret.

 

Once all the turrets have been disabled or destroyed, the script then checks to see the state of each turret to see whether it's disabled or destroyed. If the turret is destroyed it does nothing, but if the turret is disabled it will respawn with a 50% chance of being either normal (which will target the player), or "corrupted" and hostile to the boss of the level, but no longer invulnerable.

 

The turrets cover 100% of the cell when the player initially starts, so there's nowhere to hide, and there's a path that minimises the amount of damage the player takes and gives them areas they can recover, depending on which order the buttons are selected in. I'm just trying to avoid a situation where the player can run and gun, but needs to figure out which button corresponds to which turret, work out a path, and then adapt depending on the respawn state of the turrets.

Link to comment
Share on other sites

None of my mods really involve such a complicated Terminal system. You will need to work out most of this on your own, unfortunately. This isn't to say that your idea isn't feasible - it certainly is - but I don't have the time right now to provide much more direct assistance.

Link to comment
Share on other sites

That's cool Reneer, thanks for the help anyway. I've got it working anyway using a load of small scripts, I was just wondering if there was a more elegant way.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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