Jump to content

[FO4 CK] General Help Thread


Recommended Posts

 

Script Question:

 

I am using this in a debug message:

Debug.Notification("SynthPowers: PAHealing: " + rActorName + ": Health/PAB:" + iCurrHealthPerc + "/" + fPABatteryPerc)

 

How do I get rActorName?

 

I'm afraid to say ...

 

It's not available. Bethesda didn't include any function to get the display name in the CK. You'll have to wait for F4SE to address it.

 

The best you can get is the ObjectReference, which looks too messy for users to see and most of the time doesn't even allow you to identify which actor it is (you'll get things like workshopdog for Dogmeat and xyzasdCodworth)

 

I had the same problem too. Very annoying omission.

 

What you can do is create a Message, set it up as a notification and use text replacement. You'll need a quest with a reference set up to store text, and then use ForceRefTo to fill out the alias with your actor before you display the text. Use

<Alias=AliasName>

to get at the actual name. Where "AliasName" is the name of the alias and "Alias" is the literal string "Alias" (that always confuses me when I have to do this...)

I have't tried it in Fallout 4, but it ought to work.

Link to comment

 

What you can do is create a Message, set it up as a notification and use text replacement. You'll need a quest with a reference set up to store text, and then use ForceRefTo to fill out the alias with your actor before you display the text. Use

<Alias=AliasName>

to get at the actual name. Where "AliasName" is the name of the alias and "Alias" is the literal string "Alias" (that always confuses me when I have to do this...)

I have't tried it in Fallout 4, but it ought to work.

 

 

Hmm interesting. I'll try this when I get the chance.

 

If that works, it opens up a lot of possibilities actually, especially things like Apropos back in Skyrim.

Link to comment

Is it possible to get a list (or a boolean check) for which slot an armor takes up, given an armor form?

I figure I can probably get around the issue with HasKeyword, but that seems less than ideal.

 

Also, is it possible to programmatically switch an armor or weapon's mod? Like changing a Combat Armor Light to Combat Armor Medium?

I'm curious if there's a way to just set the iaddonindex (that's all I really need) for the base item from papyrus...

Link to comment

I'm stumped, I spent all day screwing around trying to get a quest stage set by an activator trigger script.

The script worked 6 months ago and now does not, so I've screwed something up. Three different objects give the same result:

The ("QuestStageSet=" + iQStageToSet) is working showing the correct value and the qMyQuest is set correctly but the quest just fails to respond or store the QuestStage setting its like its ignoring the Questname I'm setting or something :/

I've changed the name of the quest to see if I had a duplicate somehow, and it changes fine in properties, I'm outa ideas and after 3 days working on my mod inclined to drop it completely or for another 6 months :P

 

Scriptname Sinstitute:AuxRelaySetStageTrigger extends ObjectReference Const

{Sets the Stages for AuxRelay quest as player arrives at each activator}

Quest Property qMyQuest Auto Const
Int Property iQStageToSet Auto Const

Event OnTriggerEnter(ObjectReference akActionRef)
	Int iQuestStage = qMyQuest.GetStage()
	If (akActionRef == Game.GetPlayer())
		if (qMyQuest.IsRunning() == 0)
;			qMyQuest.Start()
		endif
		Utility.Wait(0.5)
		if (iQuestStage < iQStageToSet)
			qMyQuest.SetStage(iQStageToSet)
			Debug.Notification("QuestStageSet=" + iQStageToSet)
		endif
	endif
EndEvent
Link to comment

First off: Is this line supposed to be commented out? Because that could explain a lot :)
 

;   qMyQuest.Start()

 
Secondly, you're not trying to go backwards, are you? I did that once: tried to use a quest as a finite state machine. Trouble is if you setstage(n) and n is less than the current stage, it'll run the stage fragment, but the quest stage will remain at the later value.
 
The only other thing I'd say is you might try a loop when starting the quest rather than a single wait.

		if (qMyQuest.IsRunning() == 0)
			qMyQuest.Start()
			int n = 0
			while qMyQuest.IsRunning() == 0 && n < 10
				Utility.Wait(0.1)
				n += 1
			endwhile
		endif
Link to comment

First off: Is this line supposed to be commented out? Because that could explain a lot :)

Hmm unfortunately it wasn't so simple, I only commented it out a couple of hours a go because I thought it migh be reseting the quest, I had Quest "star game enabled" to it should be running by normal logic.

I'm not going backwards, just trying to set it to stage 1.

Tried your idea, still no luck I put a debug message in the qMyQuest.Start bit and confirmed the GetStage is 0 and it tries to start the quest every activation, so its not starting for some weird reason.

Link to comment

Quests not starting for no good reason ... the usual culprit tends to be aliases not filling in my experience.

 

Try making them all optional and see if the quest starts then. If it does, see which aliases are empty. SQV is my usual method of investigation for these cases.

Link to comment

Quests not starting for no good reason ... the usual culprit tends to be aliases not filling in my experience.

 

Try making them all optional and see if the quest starts then. If it does, see which aliases are empty. SQV is my usual method of investigation for these cases.

OMG, that was it, I had an Alias set to NONE, I deleted it and its working, my remaining threads of sanity salute you while sucking an unpeeled banana and doing something obscene with the wrong end of a latex gimped pineapple :)

You are most unholy and rightfull claimant for the title of CK Master, or at least more qualified that the rest of us :)

Link to comment

Basic question:

When an outfit has an armor rating of 20 and it has energy resistance 5 does that mean its roughly 25 resistance to energy or is it only 5? And does the same outfit having 0 Radiation resistance mean it has zero rad resistance not 20?

Link to comment

Basic question:

When an outfit has an armor rating of 20 and it has energy resistance 5 does that mean its roughly 25 resistance to energy or is it only 5? And does the same outfit having 0 Radiation resistance mean it has zero rad resistance not 20?

It means it has a physical rating of 20 and energy of just 5 with 0 rad resistance.

Link to comment

Any ideas what I'm doing wrong with this one?

Its a fragment in stage 50 of a quest script, stage 50 is activated ok by pressing an ntercom activator and it is setting the stage to 50 according to its debug messages.

It runs fine firat time and if conditions are ok sets the stage to 60 and everything is good. The "trying to sneak X in" messages come up but it doesn't seem to set the stage to 49.

flWeapons etc are formlists of weapons etc

 

 

if (aPlayerRef.GetItemCount(flWeapons) > 0) 
       Debug.Notification("Weapons Detected:" + (aPlayerRef.GetItemCount(flWeapons)))
       qMyQuest.SetStage(49)
       Debug.MessageBox("You are seriously trying to sneak Weapons in?")
elseif (aPlayerRef.GetItemCount(flArmor) > 0) 
       Debug.Notification("Armor Detected:" + (aPlayerRef.GetItemCount(flArmor)))
       qMyQuest.SetStage(49)
       Debug.MessageBox("I can see that Armor!")
elseif (aPlayerRef.GetItemCount(flAmmo) > 0) 
       Debug.Notification("Ammo Detected:" + (aPlayerRef.GetItemCount(flAmmo)))
       qMyQuest.SetStage(49)
       Debug.MessageBox("All your Ammo too!")
elseif (aPlayerRef.GetItemCount(flJunkMisc) > 0) 
       Debug.Notification("JunkMisc Detected:" + (aPlayerRef.GetItemCount(flJunkMisc)))
       qMyQuest.SetStage(49)
       Debug.MessageBox("You are trying to sneak in that Junk?")
elseif (aPlayerRef.GetItemCount(flFoodChems) > 0) 
       Debug.Notification("FoodChems Detected:" + (aPlayerRef.GetItemCount(flFoodChems)))
       qMyQuest.SetStage(49)
       Debug.MessageBox("And the Chems!")
elseif (aPlayerRef.GetItemCount(flMods) > 0) 
       Debug.Notification("Mods Detected:" + (aPlayerRef.GetItemCount(flMods)))
       qMyQuest.SetStage(49)
       Debug.MessageBox("Why would you try sneaking mod kits in?")
else
        orPlayerStuffBox.AddItem(miscCaps, (aPlayerRef.GetItemCount(miscCaps)))
        aPlayerRef.RemoveItem(miscCaps, (aPlayerRef.GetItemCount(miscCaps)))
        qMyQuest.SetStage(60)
endif

 

Link to comment

Owww... I did this with the cart scene in QAYL, trying to detect everything they try and hide and comment on it. I ended up simplifying things a lot in the end.

Did you say you set stage 50 and then set stage 49 afterwards? I think what happens in that case is the stage 49 fragment should run, but the quest stage stays at the highest numbered stage that it's been through so far.

If it was me, I'd stick another script on the quest, give it a load of bool properties, and set 'em or clear 'em depending on what the player was or wasn't trying to hide at the time.

Link to comment

Owww... I did this with the cart scene in QAYL, trying to detect everything they try and hide and comment on it. I ended up simplifying things a lot in the end.

 

Did you say you set stage 50 and then set stage 49 afterwards? I think what happens in that case is the stage 49 fragment should run, but the quest stage stays at the highest numbered stage that it's been through so far.

 

If it was me, I'd stick another script on the quest, give it a load of bool properties, and set 'em or clear 'em depending on what the player was or wasn't trying to hide at the time.

Yeah it appears you can repeat stages but not go backwards, although I thought I had it doing so before at some stage :P
Link to comment

Keywords:

 

If an outfit has the keyword kwOpenCrotch for example does that keyword attach itself to an actor wearing it so you could do ActorHasKeyword(kwOpenCrotch) or do we have to do Actor.GetEquipped().HasKeyword(OpenCrotch) etc?

Link to comment

Anyone out there using Mod Organizer 2?

 

Any advice for setting it up to use the Creation Kit? I'm finding that the task manager shows that the CK exe is running, but I never see the UI and so can't use it.

 

[edit]

 

One reboot later, it works just fine.

 

Except that now I have to edit the papyrus compiler bat file with all the new paths...

Link to comment
  • 3 weeks later...

If I have a struct variable like:

tStruct StructVar

will the is operator always return true if I compare it? Like with this example:

if StructVar is tStruct 
   DoStuff()
endIF

or will it bug out cause it's a struct and not an object that can be cast to.

I've got plans for a function that'll take either a string or a struct through a var, but I'm not totally sure if I can tell that it is actually a struct. 

Link to comment

If I have a struct variable like:

tStruct StructVar
will the is operator always return true if I compare it? Like with this example:

if StructVar is tStruct 
   DoStuff()
endIF
or will it bug out cause it's a struct and not an object that can be cast to.

 

I've got plans for a function that'll take either a string or a struct through a var, but I'm not totally sure if I can tell that it is actually a struct.

 

 

Well besides that code not being valid papyrus syntax, no. You can do something like

 

Struct tStruct
    int iVar1
   String sVar1
endStruct
 
tStruct StructVar1
tStruct StructVar2
 
; insert stuff that actually does something with StructVar1 and 2.
 
if StructVar1 == StructVar2
  DoSomething()
endif
 

If I understand how the internals of papyrus works, that would need every internal object of both structs to be identical. Though generally speaking the chances of that ever actually being true is astronomically small. What I think you want is something like this:

 

Struct tStruct
    int iVar1
   String sVar1
endStruct
 
tStruct StructVar1
String sVarToPass
 
Function init()
    ; initialize and setup StructVar1 and sVarToPass
    doSomething(StructVar1)
    doSomething(sVarToPass)
endFunction
 
Function doSomething(Var myLocalVar)
    if (myLocalVar as tStruct) ; will be true if the passed parameter is castable as the tStruct type. A string would not be.
        ; do more stuff
    else ; not a tStruct
        ; do other stuff
    endif
endFunction
This is all on the fly from memory but I'm pretty sure that's accurate.
Link to comment

 

This is all on the fly from memory but I'm pretty sure that's accurate.

Ah, thanks.  I'll use that. 

 

I really wish Papyrus had proper method overloading, it'd make this so much easier, especially if there were basic classes as well. 

Link to comment
  • 1 month later...

 

Small note to everybody: Use the NEW SITE (new.loverslab.com), or all your recent posts will just disappear.

I tried that website and it didn't work

 

 

The "new" site migration was reverted due to some issues. I don't recall all the details, just remember it was switched and then they said to come back to the "old" site and continue on.

Link to comment

Hi Guys,

 

I'm curious if there's a way to determine the attacker's weapon's damage (base, or effective, per bullet or dps, it doesn't matter at this point), from the use of Condition Functions?

 

Currently I'm attempting to Mod Incoming Weapon Damage, and Set it to X

 

post-76552-0-98255200-1499916142_thumb.png

 

If the Attacker Weapon's "Damage" value is Y

 

post-76552-0-55403400-1499916134_thumb.png

 

Any help or direction on this matter would be super useful.

 

I'm not 100% sure what ActorValue would even refer to the Weapon's Damage if I used the Function GetActorValue (is a Weapon an Actor??)

 

Thanks.

Link to comment

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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use