Jump to content

[FO4 CK] General Help Thread


Recommended Posts

Hi.

 

I  have a problem with sending a random settler/npc to a sepcific location.

I want to create a workstation, where the settler walk back and forth between two points (two containers, imitating transporting items)

 

When I place the marker where the container is, the assigned settler start to walking there, but after a second, he change his mind, and go back to the station. If I send the "pathtoreference" command multiple times, he walk longer, but eventually he go back to mind his own business. This behaviour is independent from being assigned or not. He behave similarly, if he is unemployed.

If I set the marker to the player position, he walk towards me untill I move, (or he arrive), then he go back again.

 

The  script looks like this:

ObjectReference Property carriercontainer Auto
ObjectReference Property PatrolMarker Auto
IdleMarker Property PatrolIdleMarker Auto


function gothere()
	Workeractor.SetAvoidPlayer(false)
	carriercontainer.SetPosition(-80742.25,85833,7648.835);
	PatrolMarker =carriercontainer.PlaceAtme(PatrolIdleMarker, 1)
	bool result = Workeractor.PathToReference(PatrolMarker, 1)
	if !result
		debug.notification("I can't go there")
	endif
endfunction

 

The settler can be any (human) npc, and multiple npc should do the same between his own points.

Anyone can tell me, how to force them, to walk to the point without any interruption?

 

Edited by innocentinner
Link to comment
2 hours ago, innocentinner said:

Hi.

 

I  have a problem with sending a random settler/npc to a sepcific location.

I want to create a workstation, where the settler walk back and forth between two points (two containers, imitating transporting items)

 

When I place the marker where the container is, the assigned settler start to walking there, but after a second, he change his mind, and go back to the station. If I send the "pathtoreference" command multiple times, he walk longer, but eventually he go back to mind his own business. This behaviour is independent from being assigned or not. He behave similarly, if he is unemployed.

If I set the marker to the player position, he walk towards me untill I move, (or he arrive), then he go back again.

 

The  script looks like this:

ObjectReference Property carriercontainer Auto
ObjectReference Property PatrolMarker Auto
IdleMarker Property PatrolIdleMarker Auto


function gothere()
	Workeractor.SetAvoidPlayer(false)
	carriercontainer.SetPosition(-80742.25,85833,7648.835);
	PatrolMarker =carriercontainer.PlaceAtme(PatrolIdleMarker, 1)
	bool result = Workeractor.PathToReference(PatrolMarker, 1)
	if !result
		debug.notification("I can't go there")
	endif
endfunction

 

The settler can be any (human) npc, and multiple npc should do the same between his own points.

Anyone can tell me, how to force them, to walk to the point without any interruption?

 

In my experience, the PathToReference function is quite prone to interruptions. I use it only when I want the NPC to walk briefly to a nearby point. For everything else use packages. 

Link to comment
1 hour ago, JB. said:

In my experience, the PathToReference function is quite prone to interruptions. I use it only when I want the NPC to walk briefly to a nearby point. For everything else use packages. 

I really hoped, I can send them "direcly" without messing with the npc-s packages and AIs and quests.

I read about packages before, and how they works with (only) quests, but not much direct info about how to handle, create and "dismiss" them, or whatever those things works for Fallout.

(I really hoped I can send an npc like "gothere.please(here)" :D )

Can you give me some source or tutorial (for dummies), where I can start to learn, how to set up a packages and aliases and other stuffs for an npc. I am good at scripting, but I barely created any quests, those are wery extensive and scary things, and not much tutorial for Fallout, only for Skyrim.

Edit:

The only thing I know about quests, how to make fetchquests, or similar easy things.

 

Edited by innocentinner
Link to comment
55 minutes ago, innocentinner said:

I really hoped, I can send them "direcly" without messing with the npc-s packages and AIs and quests.

I read about packages before, and how they works with (only) quests, but not much direct info about how to handle, create and "dismiss" them, or whatever those things works for Fallout.

(I really hoped I can send an npc like "gothere.please(here)" :D )

Can you give me some source or tutorial (for dummies), where I can start to learn, how to set up a packages and aliases and other stuffs for an npc. I am good at scripting, but I barely created any quests, those are wery extensive and scary things, and not much tutorial for Fallout, only for Skyrim.

Edit:

The only thing I know about quests, how to make fetchquests, or similar easy things.

 

 

Check out documentation and tutorials about "travel packages." You should be able to create packages like "go to the workbench" and "go to the container" with relatively high priorities and then add and remove them from those generic npcs with scripts or by using quest aliases. I haven't needed to do that (I've only added custom travel packages to unique NPCs so far, so have the luxury of simply adding conditions to them), but I get the impression that's how it's generally done.

Link to comment
3 hours ago, JB. said:

In my experience, the PathToReference function is quite prone to interruptions. I use it only when I want the NPC to walk briefly to a nearby point. For everything else use packages. 

In my experience this function is the worst. I tried using it in a mod. If the actor did not successfully path to the reference the game never stopped trying. 8 hours of playtime later I checked my Papyrus logs. Every time I loaded a game it would reattempt PathToRef. Then error out. At that point there was no hope of it ever completing. But the game engine did not care. It kept reattempting. Had to use the save cleaner to terminate the relevant threads.

 

Packages are where its at.

Edited by kaxat
Link to comment
On 10/11/2022 at 1:23 AM, vaultbait said:

 

Check out documentation and tutorials about "travel packages." You should be able to create packages like "go to the workbench" and "go to the container" with relatively high priorities and then add and remove them from those generic npcs with scripts or by using quest aliases. I haven't needed to do that (I've only added custom travel packages to unique NPCs so far, so have the luxury of simply adding conditions to them), but I get the impression that's how it's generally done.

Thanks for the ansvers. I still didn't find any concrete example about packages, but at least I know what to experiment with.

 

One more small question:

 

I want the npc, to wait a little bit, before they go to the next point, then a longer period of time(like one ingame hour) after they finished his tour. How stressful the "StartTimerGameTime" command is for papyrus script? Is it noticable, if I call hundred of them(in extreem case of course)?

Edited by innocentinner
Link to comment
16 hours ago, innocentinner said:

How stressful the "StartTimerGameTime" command is for papyrus script? Is it noticable, if I call hundred of them(in extreem case of course)?

 

It's all relative. Using StartTimerGameTime() is more resource-conscious than Utility.Wait() in most cases, but if you can accomplish what you need without scripting (for example with patrol packages between linked references), that's still preferable.

Link to comment
1 hour ago, vaultbait said:

 

It's all relative. Using StartTimerGameTime() is more resource-conscious than Utility.Wait() in most cases, but if you can accomplish what you need without scripting (for example with patrol packages between linked references), that's still preferable.

If I can't achieve the walking by packages, I will  simply teleport them, then let them walk back, half the illusion will still be there.

Please correct me if I'm wrong, butThe Utility.Wait() feels too "forced"for me, and halting hundred of threads for like 3 minutes dosen't sounds healthy.

The StartTimerGameTime() only will be created, when the settler activate the furniture again (walking back to the furniture)

The situation where I create hundred of timer, when I use hundred of furniture across the map, with their own personal id for the timerevent. (this furniture is a part of a bigger system but not dependent, more like other furnitures are dependent on it's result)

Edited by innocentinner
Link to comment
2 hours ago, innocentinner said:

If I can't achieve the walking by packages, I will  simply teleport them, then let them walk back, half the illusion will still be there.

Please correct me if I'm wrong, butThe Utility.Wait() feels too "forced"for me, and halting hundred of threads for like 3 minutes dosen't sounds healthy.

 

Yes, well, it's not so bad as all that. It doesn't pause other threads, it yields leaving the script resident and the scripting engine returns to it when the wait expires. But what I've read suggests using timers and events is still much better since the engine only needs to keep track of the event listeners that way.

 

2 hours ago, innocentinner said:

The StartTimerGameTime() only will be created, when the settler activate the furniture again (walking back to the furniture)

The situation where I create hundred of timer, when I use hundred of furniture across the map, with their own personal id for the timerevent. (this furniture is a part of a bigger system but not dependent, more like other furnitures are dependent on it's result)

 

If possible, I would suggest avoiding firing events for furniture which isn't in the same cell as the player or a loaded adjacent cell (in case you're near a cell boundary). Instead, "fake" off-camera use if necessary. Running background tasks on references which are in other parts of the map can lead to a lot of unnecessary inefficiency.

Link to comment
54 minutes ago, vaultbait said:

 

Yes, well, it's not so bad as all that. It doesn't pause other threads, it yields leaving the script resident and the scripting engine returns to it when the wait expires. But what I've read suggests using timers and events is still much better since the engine only needs to keep track of the event listeners that way.

 

 

If possible, I would suggest avoiding firing events for furniture which isn't in the same cell as the player or a loaded adjacent cell (in case you're near a cell boundary). Instead, "fake" off-camera use if necessary. Running background tasks on references which are in other parts of the map can lead to a lot of unnecessary inefficiency.

I see. Thanks for the usefull infos.

Look like I have to manage them globally and in group afterall . Then the walking animation will be totally aestetic. More soo, I found an another problem with my aproach: fast traveling can break it's cycle, after longer traveling it can miss multiple cycle without no easy solution to avoid(I can manage it but not worth the effort).

This way, I can avoid calling too much timeevents, and  it will be much more efficient.

I just hoped, I can make it  more realistic in an "easy way", like all the furnitures had their own cycle and dependent on the distances of the containers.

Maybe I will calulate the distances of all the containers in the global script for each carrier furniture, so the transport time still stay realistic.

Thanks again.

Edited by innocentinner
Link to comment

Problem with weapon mods

 

What I want to do is to pick up a weapon lying down somewhere on the ground in the world and equip it immediately , so that there is no need to

open inventory search the weapon and equip it.

 

I have written a papyrus script assigned to a referencealias and that uses the Event OnContainerChanged to detect when the weapon is picked up.

 

This is a part of the script used in the script  (wr = 'weaponreference') :

              
                  ; wr.equip (player)               ; does not exist like in older games
                  
                  ObjectMod[] oms = wr.GetAllMods()
                  debug.trace ("f4b attached mods " + oms)
                  
                  weapon w = wr.getbaseobject () as weapon
                  if w
                 
                     player.equipItem (w)
                  endif

 

Basically it work fine as long as the weapon does not have any weapon mods attached.

Unfortunatelly I do not find a function where it is possible to equip a weapon used in an obectreference directly,

only it seems  to be possible to equip baseforms ?

 

With weapon mods attached the baseform is shown. After unequipping and reequipping the weapon using pipboy the

weapon WITH weapon mods attached is shown again.

 

Any idea is welcome

 

 

 

 

 

 

 

Link to comment
39 minutes ago, Kanlaon said:

Basically it work fine as long as the weapon does not have any weapon mods attached.

Unfortunatelly I do not find a function where it is possible to equip a weapon used in an obectreference directly,

only it seems  to be possible to equip baseforms ?

 

A workaround is to put the reference into inventory first, since EquipItem() will equip a reference from the actor's inventory if there is one. The down side to this approach is that if the actor already has another reference in their inventory which is based on the same form, the call will equip the first one it finds which may or may not be the one you added. A lot of mods which handle weapon and armor pickup do it that way, and all exhibit the same unfortunate drawback. I'm not aware of other options, but maybe someone else here is.

Link to comment
15 hours ago, vaultbait said:

 

A workaround is to put the reference into inventory first, since EquipItem() will equip a reference from the actor's inventory if there is one. The down side to this approach is that if the actor already has another reference in their inventory which is based on the same form, the call will equip the first one it finds which may or may not be the one you added. A lot of mods which handle weapon and armor pickup do it that way, and all exhibit the same unfortunate drawback. I'm not aware of other options, but maybe someone else here is.

 

What you say matches  to my watching.

Anyway the small part of  the script is part of the oncontainerchanged event so maybe it needs only a small delay using Utility.wait.

Or move this script into an ontimer event to be sure oncontainerchanged definetely is finished and the item is in inventory.

 

Something similar happened in my oblivion mod where I use the default activation for the weapon to pick it up. The script also must wait

sometime before it is possible to equip the pickedup bow or staff.

 

THANKS :)

Link to comment

 

Hi.

 

New weird question:

Anyone know where to found the scrap list for weapons and armors?

I know we can scrap weapons/armors in the weapon/armor workbench, and it give specific amount of misc material(depend on perk), but those list not show up on the weapon edit window neither anywhere else, where I searched with the weapon's name.

Is it on a seeparate list? Is it possible to reach it via script somehow?

Edited by innocentinner
Link to comment
2 hours ago, truman1990 said:

On Quest - Scene: Is there a way to reset speech check after positive and negative result of said check (repeat said check as if it was not performed)

 

Repeating my answer from the original thread, https://www.creationkit.com/fallout4/index.php?title=ResetSpeechChallenges_-_Quest is one approach, but maybe others know of additional/better solutions.

Link to comment
3 hours ago, truman1990 said:

Should I add this after Player speech challenge or after responding topic of NPC? Do you know how to add that script to the end of conversation?

 

I haven't looked at how the quest is set up, but adding it to the quest init or to a fragment for the first stage of the quest should work, assuming the quest gets restarted for each captive. Resetting it after the topic probably makes it possible to keep retrying the speech challenge for the same captive over and over until it succeeds.

Link to comment

Hi again, now I have a question about overlays:

I want to copy the overlays of a settler,  and add it to an another. Here is the code, I came up with:

 

Overlays:Entry[] overlaylist
GlobalVariable Property Innoc_BOBtattomode Auto


Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
	if akNewContainer == none
		return
	elseif akNewContainer != Game.GetPlayer() 
		if Innoc_BOBtattomod
			copyoverlay(ObjectReference akNewContainer)
		else
			applyoverlay(ObjectReference akNewContainer)
		endif
	endif
endEvent

function copyoverlay(ObjectReference targetnpc)
		Bool isFemale = (targetnpc as Actor).GetLeveledActorBase().GetSex() as Bool
		overlaylist = Overlays.GetAll((targetnpc as Actor), isFemale)
endfunction

function applyoverlay(ObjectReference targetnpc)
	Bool isFemale = (targetnpc as Actor).GetLeveledActorBase().GetSex() as Bool
	int i=0
	While i < overlaylist.Length
		Overlays.Add(targetnpc, isFemale, overlaylist[i])
		 i = i + 1
	EndWhile
endfunction

But when I want to compile, the papyrus script didn't find the "Overlays" object.

I looked around and  several mods use this namespace, and it works for me ingame.

Anyone know where to find this "Overlays function"

Is this a f4se plugin I need to install? 

Edited by innocentinner
Link to comment
31 minutes ago, innocentinner said:

But when I want to compile, the papyrus script didn't find the "Overlays" object.

I looked around and  several mods use this namespace, and it works for me ingame.

Anyone know where to find this "Overlays function"

Is this a f4se plugin I need to install? 

 

That's from the LooksMenu mod. Its script sources are packed into the LooksMenu - Main.ba2 archive. I think I remember reading that the CK can find sources in BA2 archives, but worst case you could unpack them with BAE and stick them into the User folder yourself instead.

Edited by vaultbait
Link to comment
29 minutes ago, vaultbait said:

 

That's from the LooksMenu mod. Its script sources are packed into the LooksMenu - Main.ba2 archive. I think I remember reading that the CK can find sources in BA2 archives, but worst case you could unpack them with BAE and stick them into the User folder yourself instead.

You are aweome, thank you.

Edited by innocentinner
Link to comment

Ok, I could not solve the problem with the equipitem function for a weapon when the weapon has some mods attached.

So i disabled this feature for now.

 

Anyway had somebody experience with perk entry's ?

I do not know if my game is messed up with a mod that i does not have identified yet or if I am making a mistake in general.

 

So this is the perk:

 

image.png.2feac897bba86d99502219b9ba8e5313.png

 

and the entries that are making problems are "Sleep" and "Get up test" which are available for the player at the same time.

 

image.png.f5c4b91aa2fed33f47f9078dc8eae907.png

 

When pressing the sleep button, the player simply stands up (standing up is the default activation). the function is not executed.

 

image.png.0855e4af74b85601b17b33a0b5c5e6b0.png

 

When pressing the "Get up test" button the Messagebox is shown, but while the messagebox still is shown on the screen  !!!! the player already stands up.

 

If i disable the "Get up test" perk entry using a condition set to false the remaining "sleep" button works fine and executes the script containing in the fragment.

 

I have no more idea's.

 

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
×
×
  • 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