Jump to content

Scripting Noob in Need of Help from The Pros


Recommended Posts

Create an new empty form list record

Open the form list

Go to your home in the Render window

Drag each object reference entry in the Cell View that corresponds with a railing piece that needs to be removed

Drop them into the form list.

 

Place an xMarker under the ground near the pool

Make sure the xMarker is set to be enabled

Add a script to the xMarker which would be similar to the following

 

Needs tested for compilation and function

ScriptName DisableEnableListScript Extends ObjectReference
 
FormList Property ObjectsToDisable Auto
FormList Property ObjectsToEnable Auto
 
Event OnInit()
  DisableListEntries(ObjectsToDisable)
  EnableListEntries(ObjectsToEnable)
EndEvent
 
Function DisableListEntries(FormList TheList)
  Int idx = TheList.GetSize() - 1
  While idx >= 0
    ObjectReference EntryObj = TheList.GetAt(idx) as ObjectReference
    If EntryObj
      EntryObj.Disable()
    EndIf
    idx -= 1
  EndWhile
EndFunction

Function EnableListEntries(FormList TheList)
  Int idx = TheList.GetSize() - 1
  While idx >= 0
    ObjectReference EntryObj = TheList.GetAt(idx) as ObjectReference
    If EntryObj
      EntryObj.Enable()
    EndIf
    idx -= 1
  EndWhile
EndFunction

Included a means to enable objects as well. This would be useful if you opted to create some sort of construction method for the player to do in game.

 

 

This method allows you to add the pool and it be present immediately. Recommended that they not be at the home (inside or out) when adding the pool plugin.

 

Link to comment
Share on other sites

  • Replies 44
  • Created
  • Last Reply

Top Posters In This Topic

Alright so I played around with it all night. Here is what I did and here is what happened.

 

1. Loaded pool addition mod as active plugin. Loaded the home that the pool was being added to as a plugin.

2. Created a formlist and dragged and dropped all the items from the plugin home that needed to be removed.

3. Created an xmarker with the script from above and made sure initially disabled was NOT ticked.

4. Filled properties of script, I.E. my formlist of items to be disabled.

5. Tested. Nothing happened.

6. Performed multiple tests. Final test gave my answer: I placed a random object in the in original house mod as an active file. Tested. Same. Turns out, by dragging the item from the cell view of the plugin file, the new pool mod created a new duplicate. So the script indeed was working but it was only removing the duplicate and not the actual item from the house mod.

7. Placed a button in the original house mod as an active plugin.

8. Attached this script:

 

 

Scriptname Test_Button extends ObjectReference
FormList Property ObjectsToDisable Auto
FormList Property ObjectsToEnable Auto
Event OnActivate(ObjectReference akActionRef)
DisableListEntries(ObjectsToDisable)
EnableListEntries(ObjectsToEnable)
EndEvent
Function DisableListEntries(FormList TheList)
Int idx = TheList.GetSize() - 1
While idx >= 0
ObjectReference EntryObj = TheList.GetAt(idx) as ObjectReference
If EntryObj
EntryObj.Disable()
EndIf
idx -= 1
EndWhile
EndFunction
Function EnableListEntries(FormList TheList)
Int idx = TheList.GetSize() - 1
While idx >= 0
ObjectReference EntryObj = TheList.GetAt(idx) as ObjectReference
If EntryObj
EntryObj.Enable()
EndIf
idx -= 1
EndWhile
EndFunction

9. Created formlist.
10. Filled in properties on the script.
11. Tested. Works.
How come the 1st way did what it did?
Link to comment
Share on other sites

Whenever you try to use an ESP as a parent master, the Creation Kit will duplicate the records rather than using the actual records. This is because the CK cannot use ESP files as parent masters. One must toggle the flag in the header of the plugin to trick the CK into thinking the ESP is an ESM. This can be done in Wrye Bash as well as TES5Edit. In Wrye Bash, right click on the intended parent plugin and choose "esmify". Always revert by choosing "espify" and fixing load order before testing in game.

 

If you were doing this with the Special Edition version of the Creation Kit there is a Creation Kit Fixes "mod" which solves this problem.

Link to comment
Share on other sites

Ok so thats what its for. So I use the Creation Kit Fix for SEE and it is awesome. I got more done in a day than I did in 3 weeks due to that mod. But I ran into problems with mods relying on other mods as masters....Nightmare. So I turned off the plugins as masters in that file. Ok well You helped me big because without you I would not have figured it out like I did with the buttons. I made another button that appears after depressing the 1st one that can revert everything back in case they decide they do not want the pool. :)

Link to comment
Share on other sites

  • 2 weeks later...

Ok

 

OK. I am about to give up on this lol. So I used a "button activator" on my static items. I have a wardrobe underneath the shelf of said static items. I put this script on the activator:

 

Event OnActivate(objectReference akActivator)
If akActivator == Game.GetPlayer()
Self.RemoveAllItems(akActivator)
EndIf
EndEvent

 

And then linked the activator through the linked reference tab to the wardrobe. It doesnt work.

 

The idea is, when you look at the shelf with static items, you can take all ingredients, or you can look down and access the ingredients through the wardrobe to pick and choose what you want.

 

Was I supposed to add something to the script?

 

Thank you for putting up with my ignorance.

Ok I need your help once again. So I need to have an activator that returns all ingredients to the alchemy wardrobe. I made one. I mashed up the scripts a bit trying to get it to work. But I am having difficulty. Here is the script I wrote:

 

Scriptname JLReturnIngredients extends ObjectReference
ObjectReference Property JLS_Alchemy_Wardrobe1 Auto
FormList Property JL_Ingredients_List Auto
Event OnActivate(objectReference akActivator)
If akActivator == Game.GetPlayer()
Int num = JLS_Alchemy_Wardrobe1.GetItemCount(JL_Ingredients_List)
JLS_Alchemy_Wardrobe1.RemoveItem(JL_Ingredients_List,num,true,akActivator)
EndIf
EndEvent
What did I do wrong?
Link to comment
Share on other sites

No idea what may have gone wrong. The script seems fine. Did you assign the correct data to the properties? Did you test on a new game or save that has not seen your mod?

 

 

I just checked again. All the properties were auto filled but I checked just in case and they were correct. I didn't use a save game. I coc'd into my interior. I DID link ref the trigger to JLS_Alchemy_Wardrobe1. Should I not have? I AM happy you didn't find anything wrong with my script :smile: So it IS correct for checking if the player has any items listed in the formlist and removing them to the wardrobe?

Edited by Chris20201986
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...