Jump to content

Need some script help with intimidation


gooboo

Recommended Posts

Hello everyone. I'm trying to make a simple adjustment to the way the intimidation perk works in Fallout 4.

 

Normally, when you put your weapon away after intimidating an npc they go back to being hostile, but I'd like for them to just turn neutral instead. It's important for a particular kind of play through I'm doing with a character. I can make them neutral with the console command, (I type in "setav 000002cb -1") but that isn't as immersive as having it done automatically through something like a script.

 

For those who don't already know in the "HoldupEffectScript" file there's a section that makes it so when you holster your weapon after intimidating an npc, the holdup "spell" dispels. The npc goes back to the way it was before, which is usually hostile if it's something like a raider or gunner. I still want the spell to dispel when I holster my weapon, but instead of having the npc go back to being hostile I want it to be neutral instead. I thought that by editing part of the "HoldupDispelEffectScript" file I could make the npc turn neutral when holstering my weapon and dispelling the effect.

 

I tried editing the "HoldupDispelEffectScript" script in the CK, but I have very little programming skills so I don't really know exactly what to do. Here's what it looks like by default-

 

Scriptname holdupDispelEffectScript extends ActiveMagicEffect

actorValue property HoldupImmuneAV auto mandatory
GlobalVariable property HoldupPacifyTimer auto mandatory

Event OnEffectStart(Actor akTarget, Actor akCaster)
if akTarget.getValue(HoldupImmuneAV) == 1
StartTimer(HoldupPacifyTimer.getValue(), 1)
elseif akTarget.getValue(HoldupImmuneAV) == 0
self.Dispel()
endif
EndEvent

Event OnTimer(int aiTimerId)
if aiTimerId == 1
self.Dispel()
endif
EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
if akTarget.getValue(HoldupImmuneAV) == 1
akTarget.SetValue(HoldupImmuneAV, 0)
akTarget.getCrimeFaction().setPlayerEnemy(false)
endif
Endevent

I thought that by adding a line in the last paragraph I could make the npc neutral. I added a line to the last paragraph that looked like this-

Event OnEffectFinish(Actor akTarget, Actor akCaster)
if akTarget.getValue(HoldupImmuneAV) == 1
akTarget.SetValue(HoldupImmuneAV, 0)
akTarget.getCrimeFaction().setPlayerEnemy(false)
akTarget.setav 000002cb -1
endif
Endevent

That's probably not the right way to do it, but I thought I'd give it a try. When I try to compile the script in the CK it fails. Like I said I'm really not that knowledgeable in programming, can someone help me out here? It seems like this should be a relatively simple thing to do, but I have no idea where to start. Any help would be greatly appreciated.

 

Link to comment
Share on other sites

As above, look like you are trying to use console format commands as papyrus script functions.

 

They may do the same things (and sometimes have the same names) but the console commands and script function formats are very different and you need to spend time googling creationkit.com (its own internal search sucks quite hard).

 

I have been through that curve myself; doing non logic stuff in console bat files or macros looks sooooooo easy compared to papyrus script.

Link to comment
Share on other sites

From what it looks like you just want to set the actor value of AttackConditionAlt2 to be equal to negative one ("-1")?

 

Your code is close but as Werr92 said improperly formatted. Like SKK50 said, it does look like you were using console format. Don't be fooled by that thinking that anything you can do on the console can be done in papyrus. Or the other way around. They are 2 very separate things.

 

That being said, the papyrus equivalent would be to use the target like you did but call a method (or function depending on your preferred parlance) with the proper arguments. If you want to set it's direct value you would use SetValue() if you want to add or subtract then you would use ModValue(). You would add a property to the script either directly in the file or using the CK interface so you can also assign it. If you choose to add directly in the script code, don't forget to go back into CK and assign the property to the actorvalue form. If you use the same property name in the script as the CK editor ID you can just use the autofill button to do that in CK.

ActorValue Property AttackConditionAlt2 Auto Mandatory
 
; somewhere else in script inside a function or event
akTarget.SetValue(AttackConditionAlt2, -1) ; sets AV to be equal to -1
; or 
akTarget.ModValue(AttackConditionAlt2, -1) ; reduces current AV by 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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