Jump to content

How to activate turrets with a triggerbox?


Recommended Posts

So I have some custom interior cell and I want it to have automated turret defenses.

 

I want to use the bubble-shaped wallmount turrets that are also used in the Weston Water Treatment plant (or elsewhere). Sadly, I can not find any tutorials that explain how this is done, nor can I find turrets in a vanilla location that have this behavior - actually, turrets are used extremely inconsistently in the base game and it's actually hard to find 2 turrets that are set up exactly the same way; even if there's two turrets of the same type in the same cell. If someone has a tutorial ready that would help immensely.

 

What I've tried:

 

I have a turret "LvlTurretBubble", belonging to a NONE faction and having the TurretStartInactive script attached. I have a DefaultTrigger box to step into. That DefaultTrigger has a link to the turret (using the ActorTypeTurret keyword, which is also used in the DefaultActivateLinkedRefOnActivate script attached to the box). The Triggerbox also has 2 scripts attached: DefaultActivateSelf and DefaultActivateLinkedRefOnActivate (though I don't actually know if I need them, they sounded correct...).

 

Now with this setup in place, if I walk into the Triggerbox, nothing happens.

Link to comment
Share on other sites

I figure that they are actors, and just wait for you to get in their detection range and let the bullets fly. From the sounds of it, you want detection range to not matter. Have the player cross a trigger, Turrets auto detect you from anywhere in the area and bullets fly. My first thought, if I were to attempt this would be to setup a big huge trigger around the area, and if the player gets in it, call Turret.StartCombat, etc. No idea if that'll work obviously.

Link to comment
Share on other sites

Those turret actors perception is zero by default, may be causing a detection issue. Try on trigger enter turretactor.SetValue(pPerception, 10) along with StartCombat()



Also the turrets may not actually be hostile to player do debug.trace on turretactor.IsHostileToActor(PlayerREF) if not, either turretactor.SetPlayerEnemy () or turretactor.AddToFaction(pPlayerEnemy)
Link to comment
Share on other sites

It was actually the consciousness state of the Turret. The Triggerbox did not set it to false - TurretInactiveScript does a simple onLoad -> Turret.SetUnconscious(true) and I had to create a simple script attached to the Triggerbox to set it back to conscious.

 

If anyone comes across this later - use TurretInactiveScript on the turret, then on your Triggerbox attach a new ObjectReference script with this code:

ScriptName MyTurretWakeupScript extends ObjectReference

Event OnTriggerEnter (ObjectReference akActionRef)

Actor myTurret = self.GetLinkedRef(None) as Actor
myTurret.setUnconscious(false)

EndEvent

This will work at least for one turret per triggerbox but I'll probably expand it later to work on a number of actors.

Edited by payl0ad
Link to comment
Share on other sites

  • Recently Browsing   0 members

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