Jump to content

Initially Disabling Items With Scripts


Zylice

Recommended Posts

If your using an xMarker then it's a different story.

the script is simpler.

 

What's firing the xmarker to disable and enable, eg an activator or a dialogue or whatever?

 

Are you trying to start with both campfires disabled, then when the user purchases the campfire, then it appears.

After that the user can turn off and on the camfire as they please?

 

If so that should be easy enough to do.

When the player crafts the cooking station (which the campfire is part of) it enables. Before that, everything linked to the xmarker is disabled. The problem is, with the campfires being linked to the xmarker, the script doesn't work when they have been enabled by the xmarker. Yes, I want the player to light the campfire and turn it off when they like.

Link to comment
Share on other sites

The way i can see you could do it:

 

Use this script on your campfire_on and campfire_off.

Scriptname WSCampfireScript extends ObjectReference
{Allows you to turn the campfire on & off}

Event OnActivate(ObjectReference akActionRef)
    Self.GetLinkedRef().Enable()
    Self.Disable()
EndEvent

Set the Parent Enable to None on both campfire references.

Leave "Set Enable state Opposite of Parent" unchecked.

Check both campfires to be Initially Disabled.

Add a Link Ref to campfire_on pointing to campfire_off

Add a Link Ref to campfire_off pointing to campfire_on

With your xMarkerRef add a Link Ref pointing to campfire_off

(xMarkerRef would be what ever your xMarker your disabling or enabling).

 

 

Add this script to your xMarkerRef:

Scriptname WSxMarkerScript extends ObjectReference

Bool bCF

Event OnLoad()
    If bCF == True
        Self.GetLinkedRef().GetLinkedRef().Enable()
        Self.GetLinkedRef().Disable()
    Else
        Self.GetLinkedRef().Enable()
        Self.GetLinkedRef().GetLinkedRef().Disable()
    EndIf
EndEvent

Event OnUnload()
    If Self.GetLinkedRef().IsDisabled()
        bCF = True
    Else
        bCF = False
    EndIf
    Self.GetLinkedRef().Disable()
    Self.GetLinkedRef().GetLinkedRef().Disable()
EndEvent

Basically your not using any Parent with the campfires at all so you won't have the problem.

Basically the xMarkerRef will work as normal when you enable or disable it.

The user can still turn the fire on and off by activating it.

Default the campfire is off when you enable the xMarkerRef.

If you later disable the xMarkerRef and enable it again it will remember the last fire state of the campfire on or off.

 

I can post my test esp if you want, but you should be pro by now and not even need it :)

Link to comment
Share on other sites

The way i can see you could do it:

 

Use this script on your campfire_on and campfire_off.

Scriptname WSCampfireScript extends ObjectReference
{Allows you to turn the campfire on & off}

Event OnActivate(ObjectReference akActionRef)
    Self.GetLinkedRef().Enable()
    Self.Disable()
EndEvent

Set the Parent Enable to None on both campfire references.

Leave "Set Enable state Opposite of Parent" unchecked.

Check both campfires to be Initially Disabled.

Add a Link Ref to campfire_on pointing to campfire_off

Add a Link Ref to campfire_off pointing to campfire_on

With your xMarkerRef add a Link Ref pointing to campfire_off

(xMarkerRef would be what ever your xMarker your disabling or enabling).

 

 

Add this script to your xMarkerRef:

Scriptname WSxMarkerScript extends ObjectReference

Bool bCF

Event OnLoad()
    If bCF == True
        Self.GetLinkedRef().GetLinkedRef().Enable()
        Self.GetLinkedRef().Disable()
    Else
        Self.GetLinkedRef().Enable()
        Self.GetLinkedRef().GetLinkedRef().Disable()
    EndIf
EndEvent

Event OnUnload()
    If Self.GetLinkedRef().IsDisabled()
        bCF = True
    Else
        bCF = False
    EndIf
    Self.GetLinkedRef().Disable()
    Self.GetLinkedRef().GetLinkedRef().Disable()
EndEvent

Basically your not using any Parent with the campfires at all so you won't have the problem.

Basically the xMarkerRef will work as normal when you enable or disable it.

The user can still turn the fire on and off by activating it.

Default the campfire is off when you enable the xMarkerRef.

If you later disable the xMarkerRef and enable it again it will remember the last fire state of the campfire on or off.

 

I can post my test esp if you want, but you should be pro by now and not even need it :smile:

With the 'XMarkerRef' what do you mean by that? The XMarker that I'm using to enable the campfires? "(xMarkerRef would be what ever your xMarker your disabling or enabling)."

Edited by Zylice
Link to comment
Share on other sites

Yes the xMarker that your using to enable the cooking station that you wanted to add the switchable campfires to.

I added a Linked Ref to the XMarker pointing to the Campfire_Off but when I go in-game and enable the cooking station (that the campfires are linked to), both fires are enabled even though I initially disabled them like you said and the script still isn't working. :/

Link to comment
Share on other sites

You've missed something or your using a save load that is storing old scripts or object settings.

 

Follow my steps to the letter.

1. Use this script on your campfire_on and campfire_off.

Scriptname WSCampfireScript extends ObjectReference
{Allows you to turn the campfire on & off}

Event OnActivate(ObjectReference akActionRef)
    Self.GetLinkedRef().Enable()
    Self.Disable()
EndEvent

Result of step 1:

http://nsa38.casimages.com/img/2015/05/20/150520034837845099.jpg

 

 

 

2. Set the Parent Enable to None on both campfire references.

3. Leave "Set Enable state Opposite of Parent" unchecked.

4. Check both campfires to be Initially Disabled.

Result of step 2, 3 & 4:

http://nsa37.casimages.com/img/2015/05/20/150520040825188630.jpg

 

 

5. Add a Link Ref to campfire_on pointing to campfire_off

6. Add a Link Ref to campfire_off pointing to campfire_on

7. With your xMarkerRef add a Link Ref pointing to campfire_off

(xMarkerRef would be what ever your xMarker your disabling or enabling).

Result of step 5, 6 & 7:

http://nsa38.casimages.com/img/2015/05/20/150520042140571757.jpg

 

 

8. Add this script to your xMarkerRef:

Scriptname WSxMarkerScript extends ObjectReference

Bool bCF

Event OnLoad()
    If bCF == True
        Self.GetLinkedRef().GetLinkedRef().Enable()
        Self.GetLinkedRef().Disable()
    Else
        Self.GetLinkedRef().Enable()
        Self.GetLinkedRef().GetLinkedRef().Disable()
    EndIf
EndEvent

Event OnUnload()
    If Self.GetLinkedRef().IsDisabled()
        bCF = True
    Else
        bCF = False
    EndIf
    Self.GetLinkedRef().Disable()
    Self.GetLinkedRef().GetLinkedRef().Disable()
EndEvent

Result of step 8:

http://nsa37.casimages.com/img/2015/05/20/150520042653392163.jpg

 

 

 

If you have done the above then I can't see where your problem lays.

As I've tested what I typed and it works as intended for me.

 

Edit: Here's my test I did.

Same as before at Whiterun Stables opposite the carriage driver, talk to Skulvar Sable-Hilt and ask him for somewhere to cook a meal.

He'll enable the Campfire (initially not lit, activate fire to light it or put it out), Cooking Stand / Pot for you.

When your done talk to Skulvar Sable-Hilt again and tell him your done and thank him, he'll disable the cooking gear.

If you leave the fire lit and tell him to enable the cooking gear again, then the fire will will be lit when he enables it.

Same if the fire was unlit and you tell him to enable it then it will be unlit when he enables again.

 

Note: Make sure you don't have any loose scripts in your data\scripts directory eg: WSxMarkerScript.pex or WSCampfireScript.pex unless they are exactly the same as what I posted in this post.

 

If all else fails, make a brief example esp and post it and I'll take a look to see where it's going wrong.

Link to comment
Share on other sites

Your welcome, happy to be of service and glad you got it sorted :smile:

 

Off topic

Did your sort your Keyword filtering issue in your other thread?

I'm working on that at the moment. :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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