• 0

    posted a message on [Data] Unit Afterimage Effect

    There was a request on another thread to allow any unit to create a series of afterimages similar to the Protoss High Templar. With permission from ProzaicMuze to use bits and pieces from his first write up I have written up this tutorial to show how I did it. I'm going to try and explain as much as possible including the simple theory behind how everything works so anyone can tweak it, modify it and learn from it like I did.

    The Examples

    The Theory

    So you've all seen how a High Templar moves around creating those fading afterimages wherever he goes. For him it's easy since he has a custom model for his shadow, but what we're gonna do is almost that easy. We start by making a new model actor and set it to be whatever unit we want, we'll call it UnitShadow for simplicity sake. The next thing we want to do is make sure when this model is activated it starts wherever our unit is at and is facing the right direction so we'll add those features into the Site Operations value. Next we want to add a few events to this model, three of the events are activated when the model is created, it sets the Tint, Opacity and Duration of the model, this is used to give us our fading. The next event is used to destroy the model when the animation has finished fading out the unit.

    Now we want to edit our actual unit model so that when the unit moves the afterimages are created. Under the Events section of your unit we add a few new events that may look complicated (at least they did to me at first), but they can be broken down to their most basic form. When the unit is first created we set two variables up, a timer called ShadowTimer and a status called ShadowCreate. I'll explain the status first, think of it simply as True or False, 1 and 0. When we first create the unit it shouldn't be moving (in the first millisecond of the unit being created, so we set it to 0 or False. Now when our unit starts to move we change this status to True or 1. When it stops moving we change it back to False or 0. That timer we created is going to be set to 2/10ths of a second when the unit is first created and is going to count down to 0. When it reaches 0 it's going to check for our status we created, if ShadowCreate is True (or 1) then we create our afterimage, but if it is set to False (or 0) then we don't. After all of this we reset our timer back to 2/10ths of a second and it counts down again, and when it hits 0 it runs that same statement over and over indefinitely.

    Might seem complicated, but its not too bad.

    The How

    I said it before and I want to make sure to say it again, most of this is based off or copied from ProzaicMuze's original idea, I did copy it with permission and then expanded on it.

    Open up the Actors tab and right click anywhere on the list and click on Add Object...

    • Change Name to ZerglingShadow - Change Zergling to whatever the name of the Unit you're using will be ex: Carrier or Zergling
    • Hit the Suggest button and it will probably set it to ZerglingShadow
    • Change Actor Type to Model
    • Change Based On to Model Animation Style One Shot
    • Click OK
    • Change the Art - Model to match whatever unit you are using, ex: Zergling
    • Double-Click on Hosting - Host + and change the Subject at the bottom to _Unit
    • Click OK
    • Double-Click on Hosting - Host Site Operations + and check both the Hold Position and Hold Rotation.
    • Click the Add Value... button and change the dropdown at the bottom to SOpAttachOrigin
    • Click OK
    • Double-Click on Properties - Inherited Properties and put a check in Cloak Effect, Team Color and Visibility

    http://img94.imageshack.us/img94/706/afterimages02.th.png

    This is our Afterimage Model, really the most important things you want from this are the Host + and Host Site Operations + values to be set correctly. This is what sets where our image is created and the facing of the afterimage.

    Actor - Events for our newly created ZerglingShadow

    • Double-Click on Event - Events +
    • Right-Click and click Add Event for each of the following:
      • Actor Creation > Animation Play
        • Name: ShadowAnimation
        • Animation Properties: Stand
        • Time Variant: 1.0000
        • Time Type: Duration
      • Actor Creation > SetTintColor
        • Color: (whatever you want)
        • Blend In Duration: 1.0000
      • Actor Creation > Set Opacity
        • Opacity: 0.0000
        • Blend In Duration: 1.0000
      • Animation Done
        • Destroy

    http://img807.imageshack.us/img807/6079/afterimages01.th.png

    Actor - Events for the actual Zergling Unit

    • Double-Click on Event - Events +
    • Right-Click and click Add Event for each of the following:
      • Actor Creation > TimerSet
        • Duration: 0.2000
        • Name: ShadowTimer
      • Actor Creation > StatusSet
        • Name: ShadowCreate
        • Value: 0
      • UnitMovementUpdate.*.Stand > StatusSet
        • Name: ShadowCreate
        • Value: 0
      • UnitMovementUpdate.*.Walk > StatusSet
        • Name: ShadowCreate
        • Value: 1
      • TimerExpired
        • => TimerName ShadowTimer
        • TimerSet Duration: 0.200000 - Name: ShadowTimer
      • TimerExpired
        • => TimerName - Name: ShadowTimer
        • => IsStatus - Name: ShadowCreate - Value: 1
        • Create ZerglingShadow or whatever you used as the Actor name earlier

    http://img576.imageshack.us/img576/603/afterimages03.th.png

    The Bugs

    I have only found a few bugs in the way this works, if you add the effect onto a unit that can cloak such as a Spectre or Ghost it can cause some unexpected errors. If your unit is moving and then cloaks, the afterimages will show the cloaking effect even when they are supposed to have disappeared. You can see an example of this in the Spectre video that I first did. If anyone has a suggestion I am more then willing to try it.

    The second thing is on slower units like the Thor or Carrier in the second example do not create a long trail of after images due to the units being so large. I haven't played around with the length of the trail and duration much, I'm sure with a little bit of tweaking it can be made to work great.

    Posted in: Tutorials
  • 0

    posted a message on [Data] Working with Beams (Beginner Difficulty)

    Off Topic a little, but in relation to something posted earlier:

    @JuggerD & ProzaicMuze - I followed your write up for the High Templar Shadow trail and got it somewhat working, the images wouldn't stop when the unit did and it ended up creating too many shadows so after a lot of trial and error I went and looked into the High Templar unit and found out that it uses a couple of events to trigger the shadow trail and although it does use a separate model for afterimage it didn't look that hard to modify.

    After a new more tries I got it working using a mash up of your write up and what I found on the High Templar model. Instead of using a persistent buff to trigger the mirror images I used an event timer and thus far it's working great. The only bug I've found is when using a unit that can cloak on demand, such as the Ghost or Spectre. After the unit stops moving there is about a second and a half pause where if you cloak you will see the trail of images cloak as well. I'm not sure how its happening exactly, but after you cloak the images will disappear like normal and if you run around while cloaked the afterimages show up like they should (cloaked). Now the reverse is not true, if your cloaked and you stop and uncloak then your afterimages do not appear. I'm working on uploading a video to YouTube now, I'll edit this once it's uploaded

    Embed Removed: https://www.youtube.com/v/4I7wPfo1RhQ?fs=1


    Follow Prozaic's guide for setting up the Model Actor for your unit, I changed the SOp to SOpAttachOrigin. Now I duplicated my Spectre (mostly cause I feel like I'll break something if I don't), but in the Data Editor under the actor's tab find your Marauder (not the Model, it should say Unit under Actor Type) and bring it up. Now goto the Event - Events + editor and bring it up. We are going to create 6 new events here, all of which are pretty simple to understand:

    Actor Creation > TimerSet 0.200000 Shadow
    Actor Creation > StatusSet ShadowCreate 0
    UnitMovementUpdate.[Any].Stand > StatusSet ShadowCreate 0
    UnitMovementUpdate.[Any].Walk > StatusSet ShadowCreate 1

    These next two have a few extra terms in them:

    TimerExpired > (Term) TimerName Shadow (Term) IsStatus ShadowCreate 1 > Create SpectreMirror (This is my Model Actor I created as per Prozaic's write up)
    TimerExpired > (Term) TimerName Shadow (Term) TimerSet 0.200000 Shadow

    If its OK with Prozaic I'm going to do a full write up from start to finish and do a lot more in depth explanations of what everything does, but since half of it I kind of took from his write up there I don't want to just use it :)

    Posted in: Tutorials
  • To post a comment, please or register a new account.