Optimizing attack key

Post Reply
zakman
Posts: 11
Joined: Sun Jul 08, 2012 4:11 am

Optimizing attack key

Post by zakman »

Question about revamping a small part of my system. (Using Mudlet 3.0.0-delta and svof 22).

I am participating in the Achaea “Tide” invasion event, and am helping out by killing the Tide creatures, of which there are four – shadow, ogre, goblin, beetle.

I currently have F1 set to do the following when pressed:
send("thrust beetle",false)
send("thrust goblin",false)
send("thrust ogre",false)
send("thrust shadow",false)

This spams my attack (trident thrust) and hits whichever of the entities that’s currently in the room with me. Crude, but effective.

I’d like to make it a little more intelligent so that, on my initial attack, it picks up on my target and from then on just sends a single attack command until the target is dead. Would also like some error checking in there so that if none of the attacks connect, it reverts to the spam attack until it finds my target again.

What’s the best way to approach this? I am thinking of several ways it could be done, using variables and perhaps separate trigger classes for each of the creature types, but not quite sure how to implement it.

Any advice would be appreciated.

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Optimizing attack key

Post by Jor'Mox »

I would just make a trigger to capture the target name when you land the hit, and store that in a variable. And a second trigger to detect either something dying, or trying to use the attack and failing due to the target being absent.

Basically, your attack key needs an if statement checking to see if a target variable isn't nil ( if target_var then ), in which case it just attacks that target. Else it spams all four attacks, plus enables a trigger to capture hitting the target.

Your target capture trigger then stores the target it finds in your target variable, and enables a second trigger that detects the target being dead or missing, which will set the target variable to nil.

Also, each of the triggers needs to turn itself off when it fires, so you don't keep them running when you don't want them to be.

zakman
Posts: 11
Joined: Sun Jul 08, 2012 4:11 am

Re: Optimizing attack key

Post by zakman »

Thanks. I did end up doing something fairly similar to this. Set up triggers based on the appear/dead messages, and set variables from there. Didn't go so far as to implement detection for missing/wrong targets, but got something that worked well enough.

Post Reply