Jump to content

Recommended Posts

Posted

I'm trying to make a new ammo type for my Syringer Pistol mod that pacifies hostile NPCs and creatures for 30 seconds, but I'm having some trouble actually implementing it.

 

I first tried nesting a StopCombat command inside some If/EndIf blocks like so:

if (Timer < 30)
    if (Victim.IsInCombat == 1)
        StopCombat
    endif
endif

But that didn't work at all. Next, I tried making a new faction that is allied with the player, and then using the AddToFaction function to temporarily make them allies, like so:

Victim.AddToFaction PacifiedFaction
set Timer to (Timer + GetSecondsPassed)
if (Timer >= 30)
    Victim.RemoveFromFaction PacifiedFaction
endif

While this did technically work, I ran into another issue - namely that if I attacked another NPC within those 30 seconds, that second NPC would get added to the faction as well and the script would lose the reference variable of the first NPC, which means the first NPC would remain in the faction indefinitely and never become hostile again.

 

Does anyone have any ideas? Ideally, an Actor Effect would be my preferred solution, since those can run on timers that aren't reliant on scripts. I tried using the Damage Aggression effect, but it didn't seem to do anything. Maybe I need to make the Magnitude a negative number, perhaps? Or alternatively, is there a function that will remove every ref from a faction? Any help would be appreciated!

Posted

You could try changing the aggression.

 

 

int iDefaultAggression
int iTempAggression

let iDefaultAggression := Victim.GetAV Aggression
let iTempAggression := 0

Victim.SetAV Aggression iTempAggression

if (Timer >= 30)
    Victim.SetAV Aggression iOldAggression
endif
Posted (edited)

Ooh, I'll try that and report back. Thanks!

 

EDIT: Hmm, no joy. Even with the Aggression set to 0, as soon as they see me, they attack, even if I shot them with 3 darts. I also tried creating a new Base Effect with a Value Modifier to damage their Aggression, but it does nothing. I suspect the Aggression AV doesn't work like the others, which can be damaged. As far as I've seen, the only way to change the NPC's aggression is the drop down menu in the GECK.

Edited by user826
Posted (edited)

Try setting their aggression to 0, then calling ResetAI.

int iDefaultAggression
int iTempAggression

let iDefaultAggression := Victim.GetAV Aggression
let iTempAggression := 0

Victim.SetAV Aggression iTempAggression
Victim.StopCombat
Victim.ResetAI

if (Timer >= 30)
    Victim.SetAV Aggression iOldAggression
    Victim.ResetAI
endif
Edited by FiftyTifty
Posted

I think I cracked it a different way. I created a new Base Effect (Self, Touch, Target, No Magnitude) using the following script:

scn aaaSCPTStopCombatEffect

begin ScriptEffectStart
    StopCombat
end

begin ScriptEffectUpdate
    StopCombat
end

begin ScriptEffectFinish
    StopCombat
end

I then made a new Actor Effect with the new "Stop Combat" base effect, setting the Duration for 30 seconds. It seems to work! NPCs hit with the dart still run around with their weapons drawn, but they don't attack. I'd call that a win. Thanks for your help and input all the same, though!

Posted

An Actor determines if they will attack using both Aggression AND Confidence as well as Faction relationships, based upon the resulting "Threat Ratio" at the time. Lower their Confidence as well to make them "more passive". Note that "Stop Combat" does nothing to affect the "Threat Ratio" and an Actor may resume fighting shortly thereafter.

 

-Dubious-

Posted

I didn't want to mess with the Confidence AV because I don't want them to flee, just to not attack for 30 seconds. I fully intended for them to become hostile again as soon as the Stop Combat effect wears off.

Posted

It's a matrix of ranges for both stats. Don't drop either to zero; just "damage"/reduce them until you get the effect you want. You can also preserve the initial values (but I doubt that is necessary if you use the "DamageAV" function) before you start the timer, and RestoreAV after the timer expires. But it's just a suggestion based upon the evidence that over-confidence can override some aggression settings.

 

-Dubious-

Posted

I'll certainly keep this in mind for next time. It sounds like a much more elegant solution than mine, and maybe I can adapt it for something else later on. Thanks for the tip!

  • Recently Browsing   0 members

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