Jump to content

Strange Problem With a Custom Trigger Zone


The_Vyper

Recommended Posts

I'm trying to script a trigger zone to cause a linked reference to fire at any actor who crosses its threshold, and continues to fire at them periodically while they remain withing the trigger zone's boundary. The script I'm using is:

scn AAAATestTrigZoneDingus01Script
 
Short Triggered
 
Ref Monkey
 
Ref Blastar
 
Float Timer
 
Begin OnTriggerActor
 
 If Triggered == 0
   Set Triggered to 1
   Set Blastar to GetParentRef
   Set Monkey to GetActionRef
   Set Timer to 1
 EndIf
 
End
 
Begin GameMode
 
  If Triggered == 1
    If Timer <= 0
      Blastar.Cast MajesticDmgHealth10 Monkey
      Set Triggered to 0
    Else
      Set Timer to Timer - GetSecondsPassed
    EndIf
  EndIf
 
End
The problem is that the reference only fires at the triggering actor once, then fires straight north until the actor leaves the trigger zone boundary. If the actor then re-enters the trigger zone, the reference fires on them once more then starts firing north again. Also, if I increase the Timer in the OnTriggerActor block, the reference refuses to fire at all.
Any ideas on how to fix this so the reference consistently fires on the triggering actor (and does so once every 4 to 8 seconds instead of once per second)?
Link to comment
Share on other sites

Interesting. Did you already try debugging when exactly this OnTriggerActor block actually triggers? Its description reads at least some mis-understandable and troublesome to me.

 

Also have you tried OnTrigger instead? The examples look to be more in line with what you're trying to do here at least.

 

For the caster to shoot straight north something must change the target its aiming at, maybe setting it to 0 even. This can only happen when the OnTriggerActor block is run, and then only when the triggering actor is anything but. I'm really not at ease with this "will be run once when an actor triggers" part of the description, opposite to how OnTrigger triggers that is, and I can very well imagine it to do some weird stuff all the other time, potentially causing the issue here. So a debug of this triggering and the obtained references each time would be in order.

 

I fail to see any reason for why a timer value > 1 should not work just as well though. But maybe a debug will shed some light on that circumstance also.

Link to comment
Share on other sites

The problem with using OnTrigger instead of OnTriggerActor is that OnTrigger runs when any havoked object hits the trigger zone. I need this to run only when an actor triggers it, and I need the script to be as generic as possible so I can place multiple instances of this setup in game without needing to script each one individually.


A full breakdown of what I'm trying to accomplish is:

1. Actor enters trigger zone (creature, NPC, or Player)

2.Timer starts counting down.

3. Timer reaches 0, caster fires at the triggering actor.

4. Repeat 2-3 for as long as the actor is within the trigger zone.

5. Actor exits trigger zone, caster stops shooting.

6. Actor re-enters trigger zone (or a new actor does).

7. Repeat 2-5.


What's actually happening:

1. Actor enters trigger zone (creature, NPC, or Player)

2.Timer starts counting down.

3. Timer reaches 0, caster fires at the triggering actor.

4. Timer starts counting down again.

5. Timer reaches 0, caster fires north. (maybe it has a problem with Skyrim?)

6. Repeat 4-5 for as long as the actor is within the trigger zone.

7. Actor exits trigger zone, caster stops shooting.

8. Actor re-enters trigger zone (or a new actor does).

9. Repeat 2-7.


I'm wondering if the Triggered short might be the part of the problem. Should I eliminate that and just go with the timer?


This may be unrelated, but the "casting reference fires north" issue is one I've run into before when trying to script an activator to fire at multiple persistent references in sequence. If the target references are static objects (such as XMarkers), the shooting activator will only fire north, although it will fire at the appropriate intervals. If the target references are activators (enabled or disabled), the caster will fire in the correct directions at the correct intervals.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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