Jump to content

Any way to force NPC exit current furniture


kitcat81

Recommended Posts

  • 2 weeks later...

Haven't tried in Fallout 4 yet, but in Skyrim if you activated most furniture a second time, it would make your character exit. No idea if that'll work in FO4 but may be worth a try?

Link to comment
Share on other sites

Haven't tried in Fallout 4 yet, but in Skyrim if you activated most furniture a second time, it would make your character exit. No idea if that'll work in FO4 but may be worth a try?

Thank you for the idea, I tried to activate it from the script, but for some reason it did not work the way I want, the npc did not perform exiting animation. It`s possible that I`ve missed something, was really tired when doing this. I will test it once more when I have a bit more time.

Link to comment
Share on other sites

Well, actually, the way I made it work on some furniture (not all - and no real logic that I could think of about why it'd work on some and not others), was to count the number of activations inside the same script, using "Int Count" as a variable. You may also need to block normal activation first (only if it's a custom activator of course) and possibly add a condition to make sure your furniture is already in use before activating a second time.

Link to comment
Share on other sites

Well, actually, the way I made it work on some furniture (not all - and no real logic that I could think of about why it'd work on some and not others), was to count the number of activations inside the same script, using "Int Count" as a variable. You may also need to block normal activation first (only if it's a custom activator of course) and possibly add a condition to make sure your furniture is already in use before activating a second time.

I had something like this (it was just for a real time experiment in game , so no conditions or anything):

Event OnActivate(ObjectReference akActionRef)
    debug.notification("activated")
    utility.Wait(5)
    Self.Activate(akActionRef)
EndEvent

No errors but also nothing happens. What I have is not the activator form type, it`s furniture form type (vanilla object) and by default the script for this type extends ObjectReference. OnActivate fires for it when NPC enter this furnirure. It seems that it does not fire when they exit it. Can`t be sure but my notification only popped up when they entered. FO4 wiki says that furniture extends activator script, but maybe it was just copied from the same Skyrim wiki page. I have not seen any vanilla furniture with "activator scripts".

Edited by kitcat81
Link to comment
Share on other sites

I also want to do this. If there were some way to target the furniture with damage (like mines in Skyrim) they could use destruction data to explode/disable/disappear and hopefully end the animation when it goes.

 

I tried this script:

 

scriptName MineScript extends objectReference
LeveledItem Property Ore Auto
{what you get from this Ore Vein}
LeveledItem Property Goodies auto
{Optional: goodes that may be mined along with ore}
event onActivate(objectReference akActivator)
(game.getPlayer()).addItem(Ore, 1)
Utility.Wait(2)
(game.getPlayer()).addItem(Ore, 1)
Utility.Wait(2)
(game.getPlayer()).addItem(Goodies, 1)
Utility.Wait(1)
akActivator.DamageObject(50.0)
endevent
The furniture worked, The PC played the animation, I got all the ore/goodies, but at the end, the akActivator turned out to be the PC. The script hurt me. If you could point the script to the furniture, you could damage it and use destruction info to end the animation.
I just don't know how.
Link to comment
Share on other sites

The thing is that it`s workshop furniture. It`s not supposed to be danaged..At least I don`t want it to be able to be broken

 

 

I also want to do this. If there were some way to target the furniture with damage (like mines in Skyrim) they could use destruction data to explode/disable/disappear and hopefully end the animation when it goes.

 

I tried this script:

 

scriptName MineScript extends objectReference
LeveledItem Property Ore Auto
{what you get from this Ore Vein}
LeveledItem Property Goodies auto
{Optional: goodes that may be mined along with ore}
event onActivate(objectReference akActivator)
(game.getPlayer()).addItem(Ore, 1)
Utility.Wait(2)
(game.getPlayer()).addItem(Ore, 1)
Utility.Wait(2)
(game.getPlayer()).addItem(Goodies, 1)
Utility.Wait(1)
akActivator.DamageObject(50.0)
endevent
The furniture worked, The PC played the animation, I got all the ore/goodies, but at the end, the akActivator turned out to be the PC. The script hurt me. If you could point the script to the furniture, you could damage it and use destruction info to end the animation.
I just don't know how.

 

I have not created objects that can be damaged. This is a workshop craftable object that has no health. But for your script you need to replace "akActivator" with "Self" to damage the object .

 

I was thinking of using "SendAnimationEvent". But the wiki page has confusing info about it... There are 2 pages: PlayAnimation and SendAnimationEvent. Both pages warn about something that can mess up the npc..but it`s not clear whether this warning goes to "PlayAnimation" or "SendAnimationEvent".

 

This is what is says :

"PlayAnimation cannot be called on actors. For actors, use SendAnimationEvent. This bypasses the check on ObjectReference that prevents sending events to actors. If you use it to send an event to actors, you may get the actor stuck in the animation (such as the bleed out animation). You can un-stick them by using PlayIdle(IdleStop_Loose)."

 

So that part "If you use it to send ...." is confusing me...I don`t understand what function was mean by "it".

Edited by kitcat81
Link to comment
Share on other sites

I have tested it a little bit more...no..OnActivate Does not fire on exit furniture and the activate function does not make npc exit. May be it worked different in Skyrim..It seems there were more different function there. I played it, but never tried to mod it. It`s all possible to do with packages and aliases, to make npc perform different tasks, but I just was hoping for some simple way. Anyway, great thanks everyone for your input, was useful to know more about functions. Maybe I will test animationevent some time later to see what it does.

Link to comment
Share on other sites

I remember something about thinking of the furniture as if it was a menu, and writing the script with that in mind. "Menuopen", close, etc....or whatever the calls were for menu entry and exit.

 

Sorry, that's about all I can remember (if I'm remembering correctly at all or even close, heh). Maybe it'll give you a thought, though.

Link to comment
Share on other sites

That really helped me. Thanks!

Here is my final script. It ends the animation, but kinda quickly. It's not 100% smooth, but it works and that is enough for me.

 

scriptName aaaaMineScript extends objectReference
LeveledItem Property Ore Auto
{what you get from this Ore Vein}
LeveledItem Property Goodies auto
{Optional: goodes that may be mined along with ore}
Idle Property IdleStop auto
event onActivate(objectReference akActivator)
(game.getPlayer()).addItem(Ore, 1)
Utility.Wait(2)
(game.getPlayer()).addItem(Ore, 1)
Utility.Wait(2)
(game.getPlayer()).addItem(Goodies, 1)
Utility.Wait(2)
(game.getPlayer()).PlayIdle(IdleStop)
Self.DamageObject(50.0)
endevent
The furniture plays the animation on activate, it pays out goodies, the animation stops, and finally the ore view transforms into an inert object that respawns when the cell respawns.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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