Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Nexus Question and Auto-Targeting - Multiple Attackers Issue

RyseRyse Member Posts: 35 ✭✭
I have a trigger set in a few areas that's designed to prevent me from getting attacked by aggro mobs whilst standing there without attacking back. I've captured the creature names, set a trigger on their name to "Set Target to [Creature Name]", then "Attack Target". 

The idea here is if I get lost in all the text or get distracted, an attacking creature (a rabid badger) will walk in, attack me, and I'll "Set Target Rabid Badger", then "queue eqbal kill Target". My auto-basher will then kick in and I'll attack back.

The issue is some areas have a bunch of differently named aggressive dudes, and my "Auto-Targeter" occasionally goes crazy and switches targets multiple times. This not only spams "Set Target to [Creature]" a bunch, but also prevents me from focusing fire.

To prevent this, I created a variable "Set_Tar", with "Set_Tar = 0" means "I have no target, feel free to Set Target", and "Set_Tar = 1" means "I have a target, don't set a new target". It doesn't seem to be working reliably, though, so here is how I have it set up. I primarily use the Nexus UI for scripting.

The following actions change "Set_Tar" to 0:
-Room is Changed
-Text contains "you have slain" displays

The following actions change "Set_Tar" to 1:
-Text contains "Your target is now"

...

I then have the trigger "If [creature name] text is seen", do the following:
-Kill Target
-If Set_Tar is 1, STOP. Otherwise, Keep Going
-If Current Target = [Creature Name], STOP. 
-Set Target to [Creature Name]
-Queue eqbal kill Target

...

Theoretically, it should stop setting target once a target is set, allowing me to focus until the current target is dead. However, I still receive a ton of "Set Target" spam. I think it's because I'm triggering off of "[creature name]" is seen, which queues a bunch of Set Target actions, which don't actually modify the Set_Tar variable until the Set Target text is shown.

Do you guys have any ideas on how I can prevent this? Am I overthinking it, and there's a simpler way to do this? Should I change the "Set Target to" action to something with a delay so it won't read a bunch of aggro mobs?

What do you think?

Comments

  • RyseRyse Member Posts: 35 ✭✭
    I’m gonna do that Toms Hardware thing where I answer my own question just in case a newbie in the future has the same issue. 

    I found that if I change the Set_tar variable in the same trigger as “x creature is seen”, then it helps minimize target spamming. I originally thought “wait for the target to set” before modifying the variable, but this caused dozens of set targets commands to spam as mobs attacked separately. So these commands were lined up before the appropriate “is targeted” text could modify the variable and halt the resultant command spam. 

    So in practice, a reflex that checks a variable first SHOULD follow up with modifying that variable if duplicate spam is a concern.  
Sign In or Register to comment.