Jump to content

[LE] Simple Script Help


Recommended Posts

I am trying to come up with a cleaver way to reset the npc actor idle animation. I have Actors doing a workout Patrol on a small platform. On quest start Actors will take off from the platform running at full speed to the next cell.

The Issue I'm having is: depending on the timing of quest start the npc's will get stuck in idle pose and glide in pose to destination. The Patrol handles this by playing a "reset idle animation" on the next patrol idle which sits right on top of the workout idle.

-if quest start is during "reset idle" they will run normally as intended

-if it is in the "workout idle" then they will stay gliding in that idle until they change cells.

 

I was thinking a trigger box would work it would be a little dirty and I couldn't figure out how to send the animation via script. Ideal would be for the quest start to end the animation or rather send the "reset idle" to the actor so that they will run normally. Sorry for the long wind but any help would be great ive been at it for a week and its hard to find such niche info!

 

here are a couple of my test scripts i tried.

Not sure if it being an Alias matters where I link the scripts?

 

 

Scriptname StopAnimationTest2 extends ObjectReference

import debug
import utility

Actor Property Remi Auto
Idle Property StopAnimationPlease Auto
{reference that plays the animations}

;************************************

Event onTriggerEnter(objectReference akActionRef)
Debug.SendAnimationEvent(Game.GetPlayer(), "IdleStop_Loose")
endEvent

;************************************

 

I also tired this one

 

Scriptname ForceStopIdle extends ReferenceAlias

Actor Property Remi Auto
Idle Property StopAnimation Auto

Event SendAnimationEvent(ObjectReference akActionRef)
Debug.SendAnimationEvent(Remi, "IdleStop_Loose")

EndEvent

Link to comment
Share on other sites

LOL it is

Debug.SendAnimationEvent(akTarget, "IdleForceDefaultState")

so you were ever so close btw that from an activemagiceffect so tweak it for reference alias OK

 

 

Edit I did it for you, I hope that right, I got no idea about your reference alias variable name LOL, I just assumed from above

 Debug.SendAnimationEvent(Remi, "IdleForceDefaultState")

BTW your using a CK actor property in an Alias it should be just private variable to keep more localised. you should not a need a global PUBLIC property like that can access and change by other scripts

Actor akActor = Self.GetReference() As Actor 

Last bit of advice if you insist on using the CK property add the Keyword "Hidden" to make like localised private variable

Actor Property Remi  Auto Hidden

this what in coding or scripting is called encapsulation

 

Google-> In encapsulation, a class's variables are hidden from other classes and can only be accessed by the methods of the class in which they are found.

Link to comment
Share on other sites

@PeterMartyr

Did you know that the Hidden flag only hides the property from the CK properties window? The property itself is still accessible and modifiable by any script that can obtain the object and cast into the script. This includes third party scripts that use GetFormFromFile.

 

Bethesda's definition of Hidden for properties:

 

 

  • Hidden: Hides this property from the property window. Usually used for values you don't want the Creation Kit to change, but which you want other scripts to view.
Link to comment
Share on other sites

@IsharaMeradin Damn, did not know, I have not had the game install since 2017, that why I first suggested making it private variable, or even using GetReference, to get the memory pointer, but that property was overkill, the alias know who it is. HEHEHHEEHe no need to tell it. You ask who are you?

 

@IsharaMeradin, Recently I read a thread on decimal to hexadecimal in skyrim, the solution by the OP was so so so bad though it was marked has closed, I converted some Java Code to Papyrus that I had. So that other readers might get better proper coded solution, but not having the game installed I did not post since it was untested, but the logic is sound, if you have some spare time does this work correctly or does it need tweaking?

Scriptname MyScript

string Function DecimalToHexadecimal(int decimal)
    string hexDigits = "0123456789ABCDEF"
    string hexadecimal = ""
    while (decimal > 0)
        int remainder = decimal % 16
        hexadecimal = hexDigits[remainder] + hexadecimal
        decimal /= 16
    endwhile
    return hexadecimal
EndFunction

It use the fact that a string is just an array of chars in the memory, not 100% it will work with papyrus? Even thought that something that is very basic and very primitive when comes to coding. BTW if the code works anyone can use it I do not claim copyright, that solution is in the public domain, I just convert it to Papyrus, and is all Vanilla.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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