This script and OE data mimics the Starcraft Reaver style of unit - one that has to build things to attack. Plus a little extra, of course. Calibration can take a really long time, due to the number of variables involved, but other than that it's pretty easy to use, I think. Any suggestions on how to streamline this or make it more portable (do I use too many weird systems?) would be much appreciated.

Edit: To clarify, a "Reaver" is a unit that builds "Scarabs," which are automatically loaded into the unit. The Reaver uses the Scarabs to attack, so each time the Reaver attacks it loses a Scarab. To be able to keep attacking, the Reaver must continually be building Scarabs.

Note: There are still a number of things that are not easy to calibrate, mostly because there's far too many global thingies as is.

Note 2: Even though I'm posting the code, I recommend that you download and run the test map to see how it actually works, because a lot of what's involved relies on object data.

I think most of your global booleans can be moved below the configurable block, or at least in a sub-block in the configuration globals. That is, I can't imagine why a person would want to permit multi-building of scarabs. But I guess the option should be available. By the way, have you tested scarab multi-building?

You could replace the region events with either unit summon & death events. Or the former may be unnecessary; the enter region event would be unnecessary if the unit is created by script, because then it could be handled by the spell effect event trigger.

Some of your globals could be included in the structs, I think, as private static members.

What I meant, was just another way of registering an event, when the player wants to build new rockets. The unit at sale is just a dummy, that gets removed instantly. It would work the exact same way as now, just with 'casting unit' replaced by 'selling unit' and 'unit casts spell event' with 'unit is sold event' in the trigger.

Wow. I've always loved this idea (heck, all Starcraft -> Wc3 ideas ^_^), so it's good to see this working. No less in something that makes so much sense...

Anyway, just to clarify:

Quote:

Originally Posted by cosmicat

Edit: To clarify, a "Reaver" is a unit that builds "Scarabs," which are automatically loaded into the unit. The Reaver uses the Scarabs to attack, so each time the Reaver attacks it loses a Scarab. To be able to keep attacking, the Reaver must continually be building Scarabs.

Quote:

Originally Posted by Sc Wiki

Scarabs have a unique attack in StarCraft. Scarabs are built from the reaver itself, for a cost of 15 minerals each. The reaver can store up to 5 at one time. Often players will queue up all 5 as soon as the reaver is produced. The time to create a scarab is longer then a reaver's firing cooldown, so it is important to create new scarabs as soon as the reaver is no longer full.

Instead of having an actual attack, a Reaver launches a Scarab, which blindly explodes on the target (attacked) unit).

=It was brought to my attention recently that the ":P" icon stands for "tongue-sticking out", and not the "smirky half-smile" I was using it for all these years. = Thusly I apologize for any unintentional juvenilization of my messages to anyone so afflicted.=

Ah, good point. That gives the player more options where graphics are concerned as well, since a trail effect can be triggered for such an "attack type."

Edit: It also removes the need for at least one timer (scarab killing), since the reaver doesn't need to complete its attack for a scarab to launch.

Edit2: It also allows me to have more fun with Scarab capabilities; since I've been trained (in a very Pavlovian sense) to use global constants wherever practical, it's certainly possible to have the Scarabs cast a *spell* effect (with an arc) instead of exploding. Once a scarab has finished casting (hopefully near-instantaneous assuming no backswing or cast time), it can die and be removed from the group. Yay!