Jump to content

Initiating Settlement Attacks?


FiftyTifty

Recommended Posts

From what I've been able to gather by looking at the WorkshopxxxxAttack quest scripts, the quests wait for a Story Manager script event (sent by the SendStoryEvent function), and check the location to see if it has any keywords that prohibit a specific attack type (e.g, raiders, gunners).

 

But, err, it doesn't seem to be that simple. I made a wee activator, and attached the following script to it:

 

 

Scriptname FiftyTiftyWorkshop:AAAFyTy_RaiderAttackActivator extends ObjectReference

Keyword Property WorkshopEventAttack Auto Const

Location Property SanctuaryHillsLocation Auto Const

Event OnActivate(ObjectReference akActionRef)
    if WorkshopEventAttack.SendStoryEventAndWait(akLoc = SanctuaryHillsLocation, aiValue1 = 1)
        Debug.MessageBox("Attack started!")
    else
        Debug.MessageBox("Bah")
    Endif
EndEvent

 

Using the activator always returns "Bah", so it somehow fails to satisfy the Story Manager's script event nodes to start the attack.

 

Is there something I'm missing here? It should just work, but it ain't.

Link to comment
Share on other sites

The WorkshopParentScript seems to use another argument there;

WorkshopEventAttack.SendStoryEventAndWait(akLoc = workshopRef.myLocation, aiValue1 = attackStrength, akRef1 = workshopRef)

And if you just want to trigger random attacks on a settlement, there's a function in WorkshopScript;

function CheckForAttack(bool bForceAttack = false)
Link to comment
Share on other sites

Gave both a try, and nada. The Story Manager still fails to start an attack quest, and the workshopscript refuses to take a bool. Here's the script as it is now:

 

 

Scriptname FiftyTiftyWorkshop:AAAFyTy_RaiderAttackActivator extends ObjectReference

Keyword Property WorkshopEventAttack Auto Const

Location Property SanctuaryHillsLocation Auto Const

ObjectReference Property SanctuaryWorkshopREF Auto Const

workshopscript Property WorkshopScriptProperty Auto Const


bool bForceAttack = true

Event OnActivate(ObjectReference akActionRef)
    if WorkshopEventAttack.SendStoryEventAndWait(akLoc = SanctuaryHillsLocation, aiValue1 = 100, akRef1 = SanctuaryWorkshopREF)
        Debug.MessageBox("Attack started!")
    else
        Debug.MessageBox("Bah")
    Endif

    workshopscript.CheckForAttack(bForceAttack)
EndEvent

 

And it returns this error:

 

 


Starting 1 compile threads for 1 files...
Compiling "FiftyTiftyWorkshop:AAAFyTy_RaiderAttackActivator"...
C:\Users\CJWin7Main\AppData\Local\Temp\PapyrusTemp\FiftyTiftyWorkshop\AAAFyTy_RaiderAttackActivator.psc(21,16): cannot call the member function CheckForAttack alone or on a type, must call it on a variable
No output generated for FiftyTiftyWorkshop:AAAFyTy_RaiderAttackActivator, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on FiftyTiftyWorkshop:AAAFyTy_RaiderAttackActivator

Link to comment
Share on other sites

The way you have it set up there you need to call the function on the property(variable) WorkshopScriptProperty, not the type WorkshopScript

 

Also is the WorkshopScript property pointed at a workshop or the script itself? Because that "CheckForAttack" function needs to be called on the individual "WorkshopScript" of a workshop reference.

 

I'm assuming that this is to be built in a settlement?

 

If so, instead of extending "ObjectReference", you could extend "WorkshopObjectScript" and you should be able to get the local workshop with;

WorkshopScript workshopRef = WorkshopParent.GetWorkshop(workshopID)
Link to comment
Share on other sites

The main purpose of this, is to figure out how to start settlement attacks manually, which I would then create an on-startup quest to perform every two or three in-game days. I figured that using an activator to experiment with the script commands, would be the best way to test all this.

 

Main goal is to have Sanctuary Hills be the settlement under near constant attack.

 

 

The workshopscript property was pointing directly to the script, and SanctuaryWorkshopREF was pointing to the workshop bench in Sanctuary Hills.

 

Good catch, so I should have been using WorkshopScriptProperty.CheckForAttack(bForceAttack) instead?

 

I'll go an' fire up the CK right now, make a couple of those changes.

 

 

Edit: Yup, that did it. It's surprisingly simple to make an attack occur, once ya figure out how. Next step is to set the "strength" of the attack, like you're supposed to with SendStoryEvent.

 

To start an attack:

 

 

Right-click your script -> Edit Properties -> Add Property

 

In the "Type" field, type in "workshopscript"

 

Give it any name. We'll use "WorkshopScriptProperty"

 

Click "Edit Value", type in the cell with the workshop bench.

 

For Sanctuary Hills, type in "SanctuaryExt (-20, 21)"

 

The only reference available will be the workshop bench ref. Select that

 

In the script, add the line:

 

WorkshopScriptProperty.CheckForAttack(true)

 

Et voila. You'll have to chuck it in an event or a function of course, but that's general Papyrus guff.

Edited by FiftyTifty
Link to comment
Share on other sites

  • Recently Browsing   0 members

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