Jump to content
ag12

[FO4 CK] General Help Thread

Recommended Posts

GetCurrentGameTime is a function that returns a float that measures game time since you began playing. You could periodically check that, maybe every time you wake up etc? But why not use the in built timer functions. That's what they're there for. As someone who makes fallout and skyrim mods, I would kill for the timer functionality in skyrim.

Link to post

OK thanks. It's because of my experience with Skyrim's Papyrus spamming mods I was reluctant to, but if timergametime is more efficient than the former method that will be fine then I suppose.

 

I have another question, how do I use globalvariables with ints? I'm trying to multiply one with the other but the compiler shits itself no matter what method listed on the (not very helpful for beginners at all) CK wiki that I use to try to convert the global to an int.

 

Also I'm trying to compile a modified version of the AN2 menstrual cycle expansion script, and I get these errors:

 

"OnItemEquipped is not an event on scriptobject or one if its parents"

 

Also the same for other functions like OnDeath etc. In the original script it says: Self.RegisterForRemoteEvent(PlayerREF as ScriptObject, "OnItemEquipped") etc. But I've been Googling like mad and I can't figure out what that means and how to attach the script objects to my script.

 

Link to post

No timers in Fallout will automatically repeat like updates could in Skyrim. You can of course be specific and force them to repeat but that's your choice. You can also have multiple timers acting on a specific script which I don't think you could have in Skyrim.

 

Globalvariables are floats by default. When you use getvalue on a global it will return a float. There is a getvalueint function on the global script which automatically casts the value to an int. If you're doing arithmetic with values in your mod, my experience is that you should be using all floats to do this. You can very easily convert ints to floats for this (and back again for message processing etc). Keep in mind there is also a math (maths!!!) script with super helpful functions like floor, ceiling, abs.

 

"OnItemEquipped is not an event on scriptobject or one if its parents"

 

It's as it says. ScriptObject is a top level script, it doesn't understand OnItemEquipped. That's an Actor script event. You'd have to use it on a script that extends Actor or inherits from the Actor script.

Link to post
9 hours ago, RealBarenziah said:

"OnItemEquipped is not an event on scriptobject or one if its parents"

 

Also the same for other functions like OnDeath etc. In the original script it says: Self.RegisterForRemoteEvent(PlayerREF as ScriptObject, "OnItemEquipped") etc. But I've been Googling like mad and I can't figure out what that means and how to attach the script objects to my script.

Like Carabosse said, you can only register for events that an object can actually generate.  ScriptObjects don't generate OnItemEquipped so you get that error.

 

Because of that, Self.RegisterForRemoteEvent(PlayerREF as ScriptObject, "OnItemEquipped") doesn't make sense.  However, Self.RegisterForRemoteEvent(PlayerREF as Actor, "OnItemEquipped") should work.

Link to post

I am currently trying to reverse-engineer and study ignotum_virum's Just Business mod.

In his JBSlaveQuestScript at line 600, he uses the following function:

ActorSourceData Function GetSourceActorData(Actor akActor)

                ActorSourceData newData = new ActorSourceData

                Form sourceActorRace = akActor.GetRace() as Form

                If JBCompatibilityQuest.JBRaceHumanGhoulList.HasForm(sourceActorRace)

                               ;Debug.Notification("Race - Human or Ghoul")

                               newData.sourceLeveledActor = JBLCharSlaveHumanGhoul

                               newData.sourceActorBase = JBSlaveHumanGhoul
                ...
                
                return newData
                
EndFunction
            

When I try to use a variable of type “ActorSourceData”, the CK gives me the following compilation error:

unknown type actorsourcedata

Since this Data type is not explicitly defined in his mod (by himself), he must have used it from an external source.

Does anyone know how to “teach” the CK the ActorSourceData variable type? Is this a type introduced by F4SE? If so, then my follow up question would be how to use variable types introduced by F4SE.

(Sorry if this is a stupid question, I am new to papyrus scripting)

 

 

Link to post
28 minutes ago, HR_Sinop said:

Since this Data type is not explicitly defined in his mod (by himself), he must have used it from an external source.

It is a struct defined at line 120 in JBSlaveQuestScript.

 

To use one of these in your own scripts you can declare it as a JB:JBSlaveQuestScript:ActorSourceData

 

e.g.

 

JB:JBSlaveQuestScript Property JBScript Auto Const

JB:JBSlaveQuestScript:ActorSourceData myActorSourceData

myActorSourceData = JBScript.GetSourceActorData(SomeActor)

Link to post

I want to extend the WorkshopScript to add some specific/custom variables and functions to it (e.g. storing the number of specific NPCs)

 

I have a file MyWorkshopScript :

 

Spoiler

Scriptname MyWorkshopScript extends WorkshopScript

bool myWorkshopBool = false

 

When i try to convert a "normal" WorkshopScript Object to a MyWorkshopScript  via

 

workshopRef as MyWorkshopScript

 

the line returns None

 

This should work, right? Have I forgotten a step in the conversion process?

Link to post
39 minutes ago, HR_Sinop said:

This should work, right? Have I forgotten a step in the conversion process?

You are trying to cast in the wrong direction.  That will not work.

 

You can cast an object as a script that is attached to it (MyWorkshopRef as WorkshopScript) and you can cast an object as any of the script's ancestors (myWorkshopRef as ObjectReference).  But you can't cast an object as a descendant of a script that is attached to it (MyWorkshopRef as MyWorkshopScript).  If you try, it will return None because the cast is not allowed.

 

You would need to attach MyWorkshopScript to the workshop object before you can do what you are attempting.

Link to post

Thanks, makes perfect sense in hindsight. I had a flaw in my logic.

 

I have a question with a completely different topic: I have a constructible object the player can build in workshop mode (similary to a chair or table)

Is there an easy way in the CK to:

  • Allow the player to have at most one of this object built in the settlement (i.e. The player cannot build this object if its already in this settlement)
  • Prohibit the player from scrapping this object once it was built?

Can this be done e.g. via keywords attached to the object (which ones?) or do I have to listen to Events that are fired every time the player constructs/scraps an object and check if the object was my special object?

Link to post

maybe someone knows ...

How can I make a portable backup of the built Vault 88 for further use... json or any other form?

 

 

------

Tehát: Hogyan csinálhatok további hasznosításra az épített 88-as pincéről hordozható mentést ... json vagy más formában?

 

694408820_Fallout42020-10-0815-50-47-11.jpg.d78f4c3edaacecfbd6000ec5a247cd21.jpg

Link to post
3 hours ago, far_kas said:

If it works here but is empty in the game ...
There is nothing... or crash.
Then what's the problem?

 

0001.JPG.22f1f7d1c94494e11bd3ce51ea904f76.JPG

I dont think that this is counted as "works here" because it dont have any morphs displayed

You can try reinstall mod that have this outfit

Link to post
10 hours ago, Indarello said:

https://www.nexusmods.com/fallout4/mods/42571

BodyGen.SetSkinOverride(akActor, "Your id of textures in F4SE\Plugins\F4EE\Skin\youresp.esp\skin.json")

example skin 

https://www.nexusmods.com/fallout4/mods/45697

Maybe there is another way, I dont know

Thanks man. I'll give that a try... Though if that works why hasn't anybody done that for cum yet? I guess cause it'd require everybody to use the same face textures.

Link to post

I want to add a keyword to an Armor Form without altering the Form in the CK, ideally during runtime.

I stumbled upon the setKeywords Function from the F4SE

However, the way I am using the Function does not result in the Armor getting the keyword. Interestingly, the Function GetGoldValue (which also requires the Owner Struct as a parameter) returns the value specified in the CK (i.e works as it should)

My code:

Spoiler

 

Keyword Property kw1 Auto Const

Keyword Property kw2 Auto Const

....

Armor myArmor=(Game.GetFormFromFile(0x00123456, "someplugin.esp") as Armor)

 

 

    Keyword[] keywordsToSet= new Keyword[0]

    keywordsToSet= keywordsToSet.add(kw1)

    keywordsToSet= keywordsToSet.add(kw2)

 

 

; Create the owner struct

    InstanceData:Owner ownerInstance =  new InstanceData:Owner

    ownerInstance.owner= myArmor ; set the owner field of the owner struct to myArmor

InstanceData.setKeywords(ownerInstance, keywordsToSet)

myArmor.hasKeyword(kw1) ;> returns false

InstanceData.GetGoldValue(ownerInstance) ;> returns the amount of gold specified in the CK

 

Am I using the Function incorrectly or is it a F4SE bug?

What would be the correct way to accomplish my goal?

Link to post

There is this: Power Armor Voiced Operating System (PAVOS)... somewhat clashed work. I wanted it to work.

You can see broken.

 

Using the original will immediately ruin the game. // Using the wrong slot. //

 

Spoiler

793801922_Fallout42020-10-1922-15-03-99.jpg.804d3318fd7bac9e3cadd34531932a84.jpg

 

However, i can't record the route of the dds because i don't know how.... otherwise it would look great. 

The original is blank and does not include dds paths.

 

3030.JPG.8764eb9f6d0871b699148d29ec5c9743.JPG

 

I randomly typed the dds path ... and because of the result, it would be worth doing.

The point:

-- there is a picture description the use of this tool?

-- or would someone describe the solution?

 

*thank you very much.

Link to post
2 hours ago, far_kas said:

There is this: Power Armor Voiced Operating System (PAVOS)... somewhat clashed work. I wanted it to work.

You can see broken.

 

Using the original will immediately ruin the game. // Using the wrong slot. //

 

  Reveal hidden contents

793801922_Fallout42020-10-1922-15-03-99.jpg.804d3318fd7bac9e3cadd34531932a84.jpg

 

However, i can't record the route of the dds because i don't know how.... otherwise it would look great. 

The original is blank and does not include dds paths.

 

3030.JPG.8764eb9f6d0871b699148d29ec5c9743.JPG

 

I randomly typed the dds path ... and because of the result, it would be worth doing.

The point:

-- there is a picture description the use of this tool?

-- or would someone describe the solution?

 

*thank you very much.

Dont type dds, use material filesand material editor

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...