Jump to content

[LE] Scripting questions


ChewGun

Recommended Posts

Hello.

1) Is there a way to reliably check whether the player has/was moved? I was comparing coordinates from the current and previous script update, but it works only in interiors (probably the script lag is too much while on the overmap).

 

2) Is it possible to replace default activation for a door in a perk, but still allow player through if condition X is met?

  • Can I get the place where this door leads too (if thats a loading door) through a script and teleport there (not like when using coc command, but like actually going through that door)?
  • Can I open/close doors (any doors, not just some custom door scripted for that in my mod) through a script?

3) Is it possible to intercept key pressing (jump, for example) and execute some scripted actions instead of default one (let's say the character is drunk and "ragdolls" - collapses on the ground instead of jumping)?

Edited by ChewGun
Link to comment
Share on other sites

I think the conditional function GetMovementSpeed might do what you need: Set up an ability conditioned to trigger when it's above 0, and you can then process it being on, or off, with script logic

 

You can override default activations through perks, and/or filter out the activation at all. This should work for doors, too.

 

Key interception is, as far as I know, not possible. By the time you've registered the keypress with SKSE, the game engine has processed it already. It might be possible to screw around with the controls and pre-emptively unmap the jump function, and replace it with a listener for doing your ragdoll effect, but I don't think you can stop the player from mapping it back.

 

If anyone *does* have a way to do it I'd be interested.

Edited by foamyesque
Link to comment
Share on other sites

Scanning keys...

 

You can use the OnKeydown or IsKeyPressed events, but I think you have to know the exact key.

(so in other words, if they mapped jump to something else, it might not work).

 

https://www.creationkit.com/index.php?title=OnKeyDown_-_Form

 

https://www.creationkit.com/index.php?title=IsKeyPressed_-_Input

 

Not sure if that is what you are looking for.

 

 

Link to comment
Share on other sites

Yes Bethesda wrote that script ages ago, it used verbatim, in EFF, Amazing Follower Tweaks and countless other mods, and by me. It part of Serana AI, so it is in Dawnguard. Just copied it verbatim like we all do...... and use it to your heart content.

 

It been a while so and it may be easier to copy it from EFF or AFT than find it Dawnguard, rest assured, it safe to copy verbatim from those mods since they can't claim the IP. Since exactly where it is in Dawnguard escape me at the moment.

 

 

Edit

 

it what make Serana move, when player stands still :smile:

 

Edit2

 

funny note, both those mods and me, even retain the original comments by the original Bethesda author........

 

:D

Link to comment
Share on other sites

For 2 & 3 yeah, it code mate, think it write it, execute correctly it works, but for a Jump, why not just register for player action or animation event, and forget about the keys.....

 

Edit

 

I can see a few problems with this that I am not going to go into, but think of this, Player is drinking, Player is drunk, FNIS AA to solve those problems, then Player is sober to restore it back.

Link to comment
Share on other sites

1) You can use one of the following two:




2) If i understand correctly, you mean "Not been able to Activate it unless the conditions are meet", if so, then another way (except foamyesque proposal) is to:

Example:

Event OnCellAttach()

Self.SetDestroyed(True)

endEvent


Event Some Event()....

If Some Condition....

Self.SetDestroyed(False)

EndIf

EndEvent


setDestroyed() will flag the object as destroyed, objects with this flag cannot be activated and no "Activation Text" will show when near it, but they still appear in game as normal.

Reverting the setDestroyed() to "FALSE" will make the object activatable again and "Activation TEXT" will show up again when near it.


This needs to be attach to the object/activator/door, or the function can be call from another Activator if the corresponding Properties are filled (pointing to the door/activator).
Link to comment
Share on other sites

@maxarturo: I believe the LocationChange event only fires when the player actually changes Location, not, say, simply moves around within a cell (or, outdoors, set of cells, e.g. Whiterun). Am I mistaken? There's also ways to check if the player has changed cells. But neither one of those gets if the player is just, you know, walking around.

Edited by foamyesque
Link to comment
Share on other sites

foamyesque i didn't understand that he wants to track the player's position between cells "simply moves around within a cell", i thought that he wanted to track the player's location from one to an other, my bad !.

Link to comment
Share on other sites

foamyesque i didn't understand that he wants to track the player's position between cells "simply moves around within a cell", i thought that he wanted to track the player's location from one to an other, my bad !.

 

Could be either, really. OP'll need to clarify. The position check described looks like it's after *any* position shift, though.

Link to comment
Share on other sites

 

foamyesque i didn't understand that he wants to track the player's position between cells "simply moves around within a cell", i thought that he wanted to track the player's location from one to an other, my bad !.

 

Could be either, really. OP'll need to clarify. The position check described looks like it's after *any* position shift, though.

 

 

I agree... he needs to clarify.
There is also "IsPlayerMovingIntoNewSpace".
In the notes dictates that "Only condition checks that run even while loading zones will be able to make use of this condition".
But, i haven't test this to see if it works while moving from an exterior cell to another exterior cell.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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