Jump to content

Recommended Posts

Posted (edited)
Hi everyone !.
I'm not an experienced scripter and although i've manage to make a few scripts to work correctly this one is giving me a hard time, because it's doing the exact opposite of what it's set to do.
What i'm trying to do :
When a gate-Portcullis is activated (in this case by a DweSteamTrigger) the Portcullis will Enable a Disable Xmarker (the Xmarker will enable other objects like lights, walls etc...). At this point everything is working correctly exept that the Portcullis in which the script is attached it's disabling the Link Ref instead of Enableing it.
This is my script:
  Reveal hidden contents

This is the line i'm having problem (i think?):
  Reveal hidden contents

 

In this script i get an option in the properties of the script to choose a Key word

 

 

 

This was my first attempt:

 

  Reveal hidden contents

This is the line to enable a disabled Link Ref (but again i had the same resault):
  Reveal hidden contents

In this script i get an option in the properties of the script to select a Link Ref to be enable
Many Thanks in Advance!!.
Edited by maxarturo
Posted (edited)

I'm guessing the XMarker you are using starts disabled ... so it's just staying disabled, not that it's being switched to that.

The line Self.GetLinkedRef(LinkedRefKeyword).Enable() will never be read by its location in the if statement.

I take it you want it to be done once as in the variable name doOnce ... so this may/should work.

 

 

auto STATE waiting ; waiting to be activated
EVENT onActivate (objectReference triggerRef)
SetOpen(!isOpen)
if (doOnce)
gotostate("done")
endif
doOnce = true
Self.GetLinkedRef(LinkedRefKeyword).Enable()
endEVENT
endState
Edited by NexusComa
Posted
  On 11/18/2018 at 3:49 PM, NexusComa said:

 

I'm guessing the XMarker you are using starts disabled ... so it's just staying disabled, not that it's being switched to that.

The line Self.GetLinkedRef(LinkedRefKeyword).Enable() will never be read by its location in the if statement.

I take it you want it to be done once as in the variable name doOnce ... so this may/should work.

 

 

auto STATE waiting ; waiting to be activated
EVENT onActivate (objectReference triggerRef)
SetOpen(!isOpen)
if (doOnce)
gotostate("done")
endif
doOnce = true
Self.GetLinkedRef(LinkedRefKeyword).Enable()
endEVENT
endState

 

Thank you for replying.
I try your suggestion but didn't work, the only thing that is happening is that:
- Once i Link Ref the gate to an Enable object it disables the object. (and not the other way around)
- If i Link Ref the gate to a Desable object it does nothing.
This is my chain of events if this assist anyone in help me resolve this:
DweSteamTrigger(activates) > Portcullis-Gate(enables) > Xmarker or object (it's in desable state)
I'm useing a lot the enable-disable function in the mod i'm working on, in differents combination-Link Ref an chain of events with different kind of triggers and objects and they all work just fine, only this... is driving me nuts !!!.
Posted (edited)

Is doOnce set to false ?

 

Anyways I'm kind of lost here what you are trying to do exactly. (by that script.)

Are you trying to turn a valve that opens a gate and have a 1 time enabled on a XMarker also.

and if so does the gate need to be blocked from the player opening it directly ...

 

It looks to me like you're over coding this to death ...

Explain what you're doing in detail ... What things look like before, what things should do during and what everything should be after.

What you're going for sounds easy to do so I just need the details and I'll get you rolling. I need to know all about what you want out of the gate

especially ... the before, during and after. As in is the gate useable and will it end up useable after you leave this area.

Edited by NexusComa
Posted (edited)

maxarturo was looking for help. At first you can spare a lot of time by using Skyrim default scripts. And second use a function to test your own code.

 

default2StateActivator

  Reveal hidden contents

 

 

aXMD2StateActivatorEnableRef

  Reveal hidden contents

 

Edited by ReDragon2013
Posted (edited)

hold on firing up the kit for a few tests ... sorry had a few others things going on.

 

ok ...

 

Drop a XMarker down for use and disabled it. Take all the items in the room you are using for this and set them to the XMarker via the

[ Enable Parent ] tab and check [ pop in ] ... unless you want them to fade in ...

From the [ Script ] tab on the Portcullis Gate click the CWFortGateScript and press [ Remove ].

It should show a red - in front of the script name now (Perfect. Do not [ Edit Base ] at all).

Drop that defaultBlockFollowerActivation script on the valve.

Drop the lower script on the value and fill in the property's from the Creation Kit.
( you may want to change the name of the script )
------------------------------------
Scriptname MyValveScriptName extends ObjectReference
ObjectReference Property XMarker Auto
ObjectReference Property Gate Auto
Bool cf = true ; overclick flag
Bool gf = true ; gate info flag
Bool Property DisableFlag Auto
;
Event OnInit()
GoToState("GateControl")
EndEvent
Event OnLoad()
Gate.BlockActivation(true)
EndEvent
;-----------------------
State GateControl
Event OnActivate(ObjectReference akActionRef)
If(cf)
cf = false
Gate.BlockActivation(false)
If(gf)
gf = false
XMarker.Enable()
Gate.playAnimationandWait("open","opening")
Else
gf = true
If(DisableFlag)
XMarker.Disable()
Endif
Gate.playAnimationandWait("close","closing")
Endif
Gate.BlockActivation(true)
Utility.Wait(2.0)
cf = true
Endif
EndEvent
EndState
;
There is also a way to get rid of the "Open Gate" and "Close Gate " words that show on the screen when you point at the gate too.
If you want to know how just say so ... little complicated but it's not that bad and would be easy to add to this without changing anything done.
Ran into a little trouble here with a few things. That gate there is always a pain and so is that valve ...
And what if they just walk up and click the gate. Also I didn't know if once you enabled the room objects
you wished to disable them when you close the gate. So I put in an option to do it both ways ...
You could trim the wait time down to something like 1.1 ... I used 2.0 for a tiny totally sure buffer but the gate animation time is 1.
I added in a counter spamming the switch flag because they always do that. :smile: Set that true of false from the Creation Kit.
Fully tested, runs like a champ have fun!
Edited by NexusComa
Posted
  On 11/19/2018 at 3:47 AM, ReDragon2013 said:

maxarturo was looking for help. At first you can spare a lot of time by using Skyrim default scripts. And second use a function to test your own code.

 

default2StateActivator

  Reveal hidden contents

 

 

aXMD2StateActivatorEnableRef

  Reveal hidden contents

 

Thanks for replying.
That's how i started by using Skyrim default scripts and learned by comparing and modifying those scripts, as i mention i'm not an experienced scripter and since there aren't any tutorials out there to teach you (none that i could find), this was the only approach i could take.
I did learn something... then everything got messed up trying to make this script work.
Posted (edited)
  On 11/19/2018 at 6:31 AM, NexusComa said:

 

hold on firing up the kit for a few tests ... sorry had a few others things going on.

 

ok ...

 

Drop a XMarker down for use and disabled it. Take all the items in the room you are using for this and set them to the XMarker via the

[ Enable Parent ] tab and check [ pop in ] ... unless you want them to fade in ...

From the [ Script ] tab on the Portcullis Gate click the CWFortGateScript and press [ Remove ].

It should show a red - in front of the script name now (Perfect. Do not [ Edit Base ] at all).

Drop that defaultBlockFollowerActivation script on the valve.

Drop the lower script on the value and fill in the property's from the Creation Kit.
( you may want to change the name of the script )
------------------------------------
Scriptname MyValveScriptName extends ObjectReference
ObjectReference Property XMarker Auto
ObjectReference Property Gate Auto
Bool cf = true ; overclick flag
Bool gf = true ; gate info flag
Bool Property DisableFlag Auto
;
Event OnInit()
GoToState("GateControl")
EndEvent
Event OnLoad()
Gate.BlockActivation(true)
EndEvent
;-----------------------
State GateControl
Event OnActivate(ObjectReference akActionRef)
If(cf)
cf = false
Gate.BlockActivation(false)
If(gf)
gf = false
XMarker.Enable()
Gate.playAnimationandWait("open","opening")
Else
gf = true
If(DisableFlag)
XMarker.Disable()
Endif
Gate.playAnimationandWait("close","closing")
Endif
Gate.BlockActivation(true)
Utility.Wait(2.0)
cf = true
Endif
EndEvent
EndState
;
There is also a way to get rid of the "Open Gate" and "Close Gate " words that show on the screen when you point at the gate too.
If you want to know how just say so ... little complicated but it's not that bad and would be easy to add to this without changing anything done.
Ran into a little trouble here with a few things. That gate there is always a pain and so is that valve ...
And what if they just walk up and click the gate. Also I didn't know if once you enabled the room objects
you wished to disable them when you close the gate. So I put in an option to do it both ways ...
You could trim the wait time down to something like 1.1 ... I used 2.0 for a tiny totally sure buffer but the gate animation time is 1.
I added in a counter spamming the switch flag because they always do that. :smile: Set that true of false from the Creation Kit.
Fully tested, runs like a champ have fun!

 

Again thanks for taking the time to reply and search for a solution !!!..
But i got so frustrated trying to make this work + i lost almost 10 days trying to set up and make it work correctly, that i completely change the puzzle that this was intended to, it was so complicated to build that i had to draw schematics in order to make it work correctly, 54 different objects interacting with each other.
I had to change direction and remove from the equation the gate enableing the XMarker that it was used to activate lights & steam fx so that the player could keep truck of the Steam Triggers that had been activated. Now i've cut the puzzle by half and the player can see all Steam triggers and activators by just standing in the middle of the room, and is much more elegance and easy to built.
Althought the sequence Trigger > Portcullis > Xmarker i will need it for my last cell but in this case not for a puzzle, until that time i'm taking a break from this because as i mention i'm not an expirienced scripter and everything i've manage to learn it's completely messed up in my head right now by trying to make this work !!.
Many... Many thanks for taking the time to help me !!!.
* I might need to bother you again if i don't manage to make it work when i build my last cell.
Edited by maxarturo
Posted

I will use default build in scripts the way they are intended ... generically. If I'm doing a custom anything the main script is usually made from scratch.

I need to totally understand what is going on to feel I'm not pushing out mods with errors. Also been programming for 40 years professionally so ...

That code I gave you is rock solid, eliminates possible player error and takes care of the player just clicking on the gate bypassing the valve.

 

When I do things like you are doing I like you use XMarkers and link my room objects to it. It helps when you really start getting complicated.

 

I have a script you may like it is very generic and I use it to death for this type of stuff. It is placed on switches and has the huge advantage in that

it can be used by multiple switches to change the same XMarker no matter the state. Opens up a few options for use in that respect.

It is simplistic, easy to use and has never failed me ... it is a double logic script. XMarker state is read on the fly and the script adjusts.

 

Scriptname _MarkerEnable extends ObjectReference
;* Marker Enable/Disable * By: NexusComa * nexusmods.com
ObjectReference Property Marker Auto
;
Event OnInit()
If(Marker.IsDisabled())
GoToState("Disable")
Else
GoToState("Enable")
EndIf
EndEvent
;-----------------------
State Disable
Event OnBeginState()
Marker.Disable()
EndEvent
Event OnActivate(ObjectReference akActionRef)
If(Marker.IsDisabled())
GoToState("Enable")
Else
GoToState("Disable")
EndIf
EndEvent
EndState
;-----------------------
State Enable
Event OnBeginState()
Marker.Enable()
EndEvent
Event OnActivate(ObjectReference akActionRef)
If(Marker.IsDisabled())
GoToState("Enable")
Else
GoToState("Disable")
EndIf
EndEvent
EndState

;

  • Recently Browsing   0 members

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