Jump to content

[FO4 CK] General Help Thread


Recommended Posts

Any ideas if you can use lists in recipes to achieve an "OR" type situation?

I'd like to have it be something like "1 Steel" OR "Bonesaw" for example in a recipe and I'm wondering if you can throw lists or would it treat everything in the list as an and?

 

Not possible. All ingredients are considered in AND mode.

You can try to create two different recipes, but probably they cannot be assigned to the same constructible.

Link to comment

Ok now I have evolved or devolved my script to this, the objects name is SuperRing, its a copy of the wedding ring:

Scriptname SuperPowerScript extends ObjectReference

	Function (MainFunction)
		float fPowerLevel
		actor akActor = SuperRing.GetActorRefOwner()
		float fActorRads = akActor.GetValue ("Rads")
		float fActorHealth = akActor.GetValue ("Health")
		if (akActor.GetEquipped(SuperRing))
			int iCurrRads = fActorRads
			int iPrevRads
			int iRadDamage = iPrevRads - iCurrRads

			if (fActorRads <= 0)
				if (fActorHealth < 100) ; Assuming 100% = 100)
					fActorHealth = fActorHealth + 1
					akActor.SetValue ("Health", fActorHealth)
					DefaultScriptFunctions.DefaultScriptTrace(self + ":Healing")
				endif
			else
				if (iRadDamage < 1)
					fActorRads = fActorRads - 1
					akActor.SetValue ("Rads", fActorRads)
				endif
			endif
			iPrevRads = iCurrRads
		endif
	EndFunction

auto state (MainBit)
	CallFunction MainFunction
EndState
And still getting these errors:

Papyrus Compiler Version 2.8.0.4 for Fallout 4

Copyright © ZeniMax Media. All rights reserved.

Starting 1 compile threads for 1 files...

Compiling "SuperPowerScript"...

C:\Users\Owner\AppData\Local\Temp\PapyrusTemp\SuperPowerScript.psc(3,10): extraneous input '(' expecting ID

C:\Users\Owner\AppData\Local\Temp\PapyrusTemp\SuperPowerScript.psc(28,11): extraneous input '(' expecting ID

C:\Users\Owner\AppData\Local\Temp\PapyrusTemp\SuperPowerScript.psc(29,14): missing FUNCTION at 'MainFunction'

C:\Users\Owner\AppData\Local\Temp\PapyrusTemp\SuperPowerScript.psc(29,26): mismatched input '\\r\\n' expecting LPAREN

C:\Users\Owner\AppData\Local\Temp\PapyrusTemp\SuperPowerScript.psc(0,0): error while attempting to read script SuperPowerScript: Object reference not set to an instance of an object.

No output generated for SuperPowerScript, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on SuperPowerScript

Link to comment

...

 

 

Scriptname SuperPowerScript extends ObjectReference
 
Function MainFunction()
  float fPowerLevel
  actor akActor = SuperRing.GetActorRefOwner()
  float fActorRads = akActor.GetValue ("Rads")
  float fActorHealth = akActor.GetValue ("Health")
  if (akActor.GetEquipped(SuperRing))
    int iCurrRads = fActorRads
    int iPrevRads
    int iRadDamage = iPrevRads - iCurrRads
 
    if (fActorRads <= 0)
      if (fActorHealth < 100) ; Assuming 100% = 100)
        fActorHealth += 1
        akActor.SetValue ("Health", fActorHealth)
        DefaultScriptFunctions.DefaultScriptTrace(self + ":Healing")
      endif
    else
      if (iRadDamage < 1)
        fActorRads = fActorRads - 1
        akActor.SetValue ("Rads", fActorRads)
      endif
    endif
    iPrevRads = iCurrRads
  endif
EndFunction
And I have no clues of what should be:

auto state (MainBit)
  CallFunction MainFunction
EndState
For sure the fixed code will never be called.
Link to comment

I have the spoliered code in my SuperRing designed to heal an actor wearing it, it compiles ok and I get the messagebox popup ok when I wear the ring, (this is a spell in an object enchanment on the ring), but instead of rActor (the player) it shows "[" and nothing afterwards. At one point I had it working but it was damaging the players health using ModValue instead of RestoreValue so I think the timer is working ok. But get the feeling I got something screwed up with setting rActor

 

I'm not seeing any of the debug traces in the Log either, do I have to enable something somewhere?

 

This line won't compile, any idea why (string)iRads and (string)iHealth are unacceptable?

 

Debug.Trace("SuperPowers: Rads: " + (string)iRads + " Health: " + (string)iHealthPerc)

 

 

 

Scriptname SuperPowers:SuperPowers extends activemagiceffect

ActorValue Property HealthAV Auto Const
ActorValue Property RadsAV Auto Const
ActorValue Property AddictionCountAV Auto const
ActorValue Property RadsRateAV Auto Const
ActorValue Property RadsHealthMaxAV Auto Const
ActorValue Property LeftAttackConditionAV Auto const
ActorValue Property LeftMobilityConditionAV Auto const
ActorValue Property PerceptionConditionAV Auto const
ActorValue Property RightAttackConditionAV Auto const
ActorValue Property RightMobilityConditionAV Auto const
ActorValue Property EnduranceConditionAV Auto const

ObjectReference rActor
float HealTimer = 5.0
int HealTimerID = 32

float HPHealRate = 5.0
float RadHealRate = 5.0

Event OnEffectStart(Actor akTarget, Actor akCaster)
	rActor = (akTarget as ObjectReference)
	RegisterForRemoteEvent(akTarget as ObjectReference, "OnUnload")
	RegisterForRemoteEvent(akTarget, "OnDeath")
	StartTimer(HealTimer,HealTimerID)
	Debug.Trace("SuperPowers: Actor: " + rActor + " Effect Event Started")
	Debug.MessageBox("SuperPowers: Effect Event Started" + rActor)
EndEvent

Event OnTimer(int aiTimerID)
	If (aiTimerID >= HealTimerID)
		int iRads = (rActor.GetValue(RadsAV) as int)
		int iHealthPerc = ((rActor.GetValuePercentage(HealthAV) * 100) as int)
		Debug.Trace("SuperPowers: Actor: " + rActor + " Timer Trigger")
;		Debug.Trace("SuperPowers: Rads:" + (string)iRads + " Health:" + (string)iHealthPerc)
		If (iRads <= 0)
			If (iHealthPerc < 100)
				rActor.RestoreValue(HealthAV, HPHealRate)
				rActor.RestoreValue(LeftAttackConditionAV, HPHealRate)
				rActor.RestoreValue(LeftMobilityConditionAV, HPHealRate)
				rActor.RestoreValue(PerceptionConditionAV, HPHealRate)
				rActor.RestoreValue(RightAttackConditionAV, HPHealRate)
				rActor.RestoreValue(RightMobilityConditionAV, HPHealRate)
				rActor.RestoreValue(EnduranceConditionAV, HPHealRate)
			EndIf
		Else
			If (iRads > 0)
				rActor.RestoreValue(RadsAV, RadHealRate)
			EndIf
		Endif
	EndIF
	StartTimer(HealTimer,HealTimerID)
EndEvent

Event ObjectReference.OnUnload(ObjectReference akSender)
	CleanUp()
EndEvent

Event Actor.OnDeath(Actor akSender, Actor akKiller)
	CleanUp()
EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
        CleanUp()
EndEvent

Function CleanUp()
	rActor =  None
	CancelTimer(HealTimerID)
	UnregisterForAllEvents()
	Dispel()
EndFunction

 

Link to comment

Change in your debug messages akTarget with akTarget.getDisplayName()

Try also to switch akTarget with akCaster (not sure in FO4 for an "enchantment" who will be who.)

 

in Skyrim GetValuePercentage() was totally broken, I doubt that it was fixed in FO4.

Link to comment

Change in your debug messages akTarget with akTarget.getDisplayName()

Try also to switch akTarget with akCaster (not sure in FO4 for an "enchantment" who will be who.)

 

in Skyrim GetValuePercentage() was totally broken, I doubt that it was fixed in FO4.

GetDisplayName() does not exist according to the wiki, is it something added by SKSE that's not in F4SE yet?
Link to comment

 

Change in your debug messages akTarget with akTarget.getDisplayName()

Try also to switch akTarget with akCaster (not sure in FO4 for an "enchantment" who will be who.)

 

in Skyrim GetValuePercentage() was totally broken, I doubt that it was fixed in FO4.

GetDisplayName() does not exist according to the wiki, is it something added by SKSE that's not in F4SE yet?

 

 

That is a possibility.

 

But .getName() should be vanilla.

Link to comment

 

 

Change in your debug messages akTarget with akTarget.getDisplayName()

Try also to switch akTarget with akCaster (not sure in FO4 for an "enchantment" who will be who.)

 

in Skyrim GetValuePercentage() was totally broken, I doubt that it was fixed in FO4.

GetDisplayName() does not exist according to the wiki, is it something added by SKSE that's not in F4SE yet?

 

 

That is a possibility.

 

But .getName() should be vanilla.

 

Ah yes that's the one, its in the Wiki and it seems to compile :)

 

There's clearly still a lot of documentation inconsistency as it seems many Skyrim commands have been changed like GetActorValue now seems to be GetValue, there's seems no mention of GetValue in the wiki I can find, yet it compiles and GetActorValue which is in the Skyrim and FO4 CK Wiki will not. But many of the FO4 wiki pages are still copies from Skyrim anyway so far, its a big job creating it.

Link to comment

 

Ah yes that's the one, its in the Wiki and it seems to compile :)

 

There's clearly still a lot of documentation inconsistency as it seems many Skyrim commands have been changed like GetActorValue now seems to be GetValue, there's seems no mention of GetValue in the wiki I can find, yet it compiles and GetActorValue which is in the Skyrim and FO4 CK Wiki will not. But many of the FO4 wiki pages are still copies from Skyrim anyway so far, its a big job creating it.

 

 

Yep.

I am well aware of that.

 

And the sad part is that is that I was able to update the CK.com pages before, but right now it is no more possible.

 

P.S. Also because the pages are mixed between Skyrim and FO4, and many SKSE extra info are being removed.

Link to comment

 

Ah yes that's the one, its in the Wiki and it seems to compile :)

 

There's clearly still a lot of documentation inconsistency as it seems many Skyrim commands have been changed like GetActorValue now seems to be GetValue, there's seems no mention of GetValue in the wiki I can find, yet it compiles and GetActorValue which is in the Skyrim and FO4 CK Wiki will not. But many of the FO4 wiki pages are still copies from Skyrim anyway so far, its a big job creating it.

 

Yep.

I am well aware of that.

 

And the sad part is that is that I was able to update the CK.com pages before, but right now it is no more possible.

 

P.S. Also because the pages are mixed between Skyrim and FO4, and many SKSE extra info are being removed.

 

Yeah as I read more of it I'm now starting to get a handle on things and getting pretty close to getting this thing working.
Link to comment

Cool, I got the basics working.

 

And now I want to adjust the healing rate according to the actors level.

 

I'm trying various combinations like this but failing to compile. I aslos can't find ActorLevel under Actor Values or other categories to set it as a property to read

 

float fActorLevel = rActor.GetLevel()

Link to comment

Cool, I got the basics working.

 

And now I want to adjust the healing rate according to the actors level.

 

I'm trying various combinations like this but failing to compile. I aslos can't find ActorLevel under Actor Values or other categories to set it as a property to read

 

float fActorLevel = rActor.GetLevel()

 

Small advice: on a "clean" installation of FO4, get all the scripts inside scripts/source (no mods, please)

Each file is the full definition of a class that can be used with all the basic papyrus functions available.

 

It is the best way to find what functions are available.

Link to comment

Small advice: on a "clean" installation of FO4, get all the scripts inside scripts/source (no mods, please)

Each file is the full definition of a class that can be used with all the basic papyrus functions available.

 

It is the best way to find what functions are available.

Yes I've been looking in there and copyied the main ones for Actors, Objects etc to a safe folder before they get corrupted in anyway. Most of theothers aren't anything readable as far as I can see.

 

Hmmm it appears in ActiveMagicEffect.psc there's no function in for getting the actors level as far as I can see, its 90% events.

 

Elsewere I found this:

int Function GetLevel() native

; Print a message if Bob is higher level then the player
if (Bob.GetLevel() > Game.GetPlayer().GetLevel())
  Debug.Trace("Bob is higher level then the player!")
endIf
So am trying this with no luck compiling:

 

float fActorLevel ;= rActor.GetLevel() native
But can't get it to compile:

Papyrus Compiler Version 2.8.0.4 for Fallout 4

Copyright © ZeniMax Media. All rights reserved.

Starting 1 compile threads for 1 files...

Compiling "SuperPowers:SuperPowers"...

C:\Users\Owner\AppData\Local\Temp\PapyrusTemp\SuperPowers\SuperPowers.psc(48,40): required (...)+ loop did not match anything at input 'native'

No output generated for SuperPowers:SuperPowers, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on SuperPowers:SuperPowers

Anyway bedtime for me maybe it will be clearer after some sleep :)

Link to comment
int Function GetLevel() native

; Print a message if Bob is higher level then the player
if (Bob.GetLevel() > Game.GetPlayer().GetLevel())
  Debug.Trace("Bob is higher level then the player!")
endIf

 

float fActorLevel ;= rActor.GetLevel() native

 

Sleep well.

 

The first script requires an object (Bob) that is an Actor.

A line like:

Actor property Bob auto

Will do the trick.

 

The second line has two problems.

1) ;= means nothing. ; is used to start comments, so everything after is ignored.

2) "native" can be used only in the definition of a function, it should NOT be used when calling a function.

Native means that the implementation is not done through papyrus code but native in C++ in the game engine (or F4SE plugins.)

Link to comment
  • 3 weeks later...

Anyone know how MUL+ADD works?

 

If the default damage of a ammo X=20 and MUL+ADD is set to 2.0 do I get 42?

 

Why is it labelled Min and a second box that seems unused labelled Max?

Why isn't there a straight MUL function that would make more sense?

 

It seems crazy, a Hunting rifle receiver has a MUL+ADD of 0.1 which to me would take damage from 100 to 10 then add 10 meaning 20?

Link to comment

Ok, now I'm getting my teeth into some interesting stuff, and the scary thing is most of it is working :)

I'm creating an AutoDoor script for the Institute doors incorporating security and time of day and passcard access for different levels and its all working pretty sweet except 3 things.

The script is in a triggerActivator enclosing the door approaches.

 

I'm getting Syntax errors when I try to check if an actor is a Courser by checking Class and also a Syntax Error when checking if an actor is wearing a SynthSlaveCollar

 

	if (akActionRef.IsEquipped(aArmorPass))
	    	orThisDoor.SetOpen(1)
	endif

	if (akActionRef.GetClass() == cClassPass)
	    	orThisDoor.SetOpen(1)
	endif
Thirdly to incorporate time control I need to find a way to convert the GetTimeString into Integer so I can compare it, I can't seem to find any functions like RightString(4,5) to grab the Hours and Minutes out of GameTimeString

So I found the GlobalVariable GameHour and am trying to compare it but apparently I can't compare a GlobalVariable float to a normal Float? :P

 

float fGameHour = gGameHour

	if ((fLockTime1 <= 0) && (fUnlockTime1 > 24)) ; Door is Public All the time
	    	orThisDoor.SetOpen(1)
	endif
	if ((fGameHour > fLockTime1) && (fGameHour < fiLockTime1)) ; DoorUnlock Time Period1
	    	orThisDoor.SetOpen(1)
	endif

 

 

Scriptname SexyInstitute:InstituteAutoDoorControl extends ObjectReference Const
{This script controls doors opening and closing them automatically and by security clearance cards.}

ObjectReference Property orThisDoor Auto Const
GlobalVariable Property gSecurityLevel Auto Const
GlobalVariable Property gGameHour Auto Const
Float Property fLockTime1 Auto Const
Float Property fLockTime2 Auto Const
Float Property fUnlockTime1 Auto Const
Float Property fUnlockTime2 Auto Const
Class Property cClassPass Auto Const
Armor Property aArmorPass Auto Const
Key Property kPassKey1 Auto Const
Key Property kPassKey2 Auto Const
Key Property kPassKey3 Auto Const
Key Property kPassKey4 Auto Const
Key Property kPassKey5 Auto Const
Key Property kPassKey6 Auto Const
Key Property kPassKey7 Auto Const
Key Property kPassKey8 Auto Const
Key Property kPasskey9 Auto Const

Function fnStartTimer(int iTime) 
	StartTimer(iTime, 1) 
EndFunction

Event OnLoad()
	fnStartTimer(5)
EndEvent

Event OnTimer(int aiTimerID)
	if (aiTimerID == 1) && (orThisDoor.GetOpenState() == 1)
		orThisDoor.SetOpen(0)
	endif
EndEvent

Event OnTriggerEnter(ObjectReference akActionRef)

float fGameHour = gGameHour

	if ((fLockTime1 <= 0) && (fUnlockTime1 > 24)) ; Door is Public All the time
	    	orThisDoor.SetOpen(1)
	endif
	if ((fGameHour > fLockTime1) && (fGameHour < fiLockTime1)) ; DoorUnlock Time Period1
	    	orThisDoor.SetOpen(1)
	endif

;	if (akActionRef.IsEquipped(aArmorPass))
;	    	orThisDoor.SetOpen(1)
;	endif

;	if (akActionRef.GetClass() == cClassPass)
;	    	orThisDoor.SetOpen(1)
;	endif

	if (kPassKey1)
		if (akActionRef.GetItemCount(kPasskey1) > 0)
	    		orThisDoor.SetOpen(1)
		endif
	endif
	if (kPassKey2)
		if (akActionRef.GetItemCount(kPasskey2) > 0)
	    		orThisDoor.SetOpen(1)
		endif
	endif
	if (kPassKey3)
		if (akActionRef.GetItemCount(kPasskey3) > 0)
	    		orThisDoor.SetOpen(1)
		endif
	endif
	if ((akActionRef.GetItemCount(kPasskey4) > 0) || (akActionRef.GetItemCount(kPasskey5) > 0) || (akActionRef.GetItemCount(kPasskey6) > 0))
	    	orThisDoor.SetOpen(1)
	endif
	if ((akActionRef.GetItemCount(kPasskey7) > 0) || (akActionRef.GetItemCount(kPasskey8) > 0) || (akActionRef.GetItemCount(kPasskey9) > 0))
	    	orThisDoor.SetOpen(1)
	endif
EndEvent

Event OnTriggerLeave(ObjectReference akActionRef)
	fnStartTimer(9)
;    	orThisDoor.SetOpen(0)
EndEvent

 

Link to comment

...

 

To handle the time just use the function

 

Utility.GetCurrentGameTime()

 

It returns a float with the number of seconds.

 

 

The error on the trigger, can be due to a miss casting.

 

Try:

 

 

Actor a = akActionRef as Actor
if a
  if (a.IsEquipped(aArmorPass))
      orThisDoor.SetOpen(1)
  endif
 
  if (a.GetClass() == cClassPass)
      orThisDoor.SetOpen(1)
  endif
endIf
Link to comment

 

...

 

To handle the time just use the function

 

Utility.GetCurrentGameTime()

 

It returns a float with the number of seconds.

 

 

The error on the trigger, can be due to a miss casting.

 

Try:

 

 

Actor a = akActionRef as Actor
if a
  if (a.IsEquipped(aArmorPass))
      orThisDoor.SetOpen(1)
  endif
 
  if (a.GetClass() == cClassPass)
      orThisDoor.SetOpen(1)
  endif
endIf

 

Cool that fixed it, had to do similar thing with baseActor for class too :)

Link to comment

:( So!  Load in a vanilla cell, look at an objects properties of if you just want to copy it! Well stuff me, the object is then marked as changed , that cell and the object is then saved in your mod. Is there any way to prevent this?

Link to comment

:( So!  Load in a vanilla cell, look at an objects properties of if you just want to copy it! Well stuff me, the object is then marked as changed , that cell and the object is then saved in your mod. Is there any way to prevent this?

 

No.

But you can then open your mod with FO4Edit and remove all the items that are "altered by mistake".

Link to comment

 

:( So!  Load in a vanilla cell, look at an objects properties of if you just want to copy it! Well stuff me, the object is then marked as changed , that cell and the object is then saved in your mod. Is there any way to prevent this?

 

No.

But you can then open your mod with FO4Edit and remove all the items that are "altered by mistake".

 

Yeah I recommend cleaning your mod at the end of every session because you'd be supprised at the number od dirty edits created so easily duplicating the wrong activators etc.

 

Anyone know a way to highlight Activators or make then less invisible, cause being 70% blind they are practically invisible to me.

Link to comment

 

:( So!  Load in a vanilla cell, look at an objects properties of if you just want to copy it! Well stuff me, the object is then marked as changed , that cell and the object is then saved in your mod. Is there any way to prevent this?

 

No.

But you can then open your mod with FO4Edit and remove all the items that are "altered by mistake".

 

 

Yes that is what I have been doing - pain in the butt! Is there a way to quickly uncheck all mods in FO4Edit load?

 

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