Attaching a Model to a Unit
(Redirected from Attaching an OmniLight to a Unit)
Jump to navigation
Jump to search
The following tutorial is a step-by-step process for attaching an model (in this case an OmniLight) to a unit. There are two sections based on whether you'd prefer to use triggers or the data editor. In both, I'll be using a Zealot as my unit, but obviously you can use whichever unit you'd like.
Attaching with Triggers
- Place your hero unit on the map (again in this example I've chosen a Zealot).
- Open the Trigger editor under Modules > Triggers or press F6. Make sure the Show Libraries (Ctrl+Shift+L) and Use Subviews (Ctrl+Shift+W) buttons are clicked.
- In the box on the bottom left of the window, right-click and select New > New Trigger (Ctrl+T). Name this "OmniAttach".
- In the box on the right, right-click on Events and select New > New Event. Search for "Map Initialization," select it, and then click "Ok."
- Now right-click on Action and select New > New Action. Search for "Attach Model to Unit," select it, and then click "Ok."
- Click on "Actor - Attach Model to Head on (Last created unit)," and you should see the action's details in the box on the bottom right.
- Double-click on Model: (No Value) and a new window should come up. Search for "Omni" and it should give you all the OmniLight options. For this tutorial, let's choose Light Omni Blue. Click "Ok" and it should now read "Model: Light Omni Blue."
- Double-click on AttachPoint: Head and a new window should come up. Search for "Origin," select it, and click "Ok." It should now read "AttachPoint: Origin."
- Double-click on Unit: Last Created Unit and a new window should come up. Click on the button next to "Value" and a list of all the pre-placed units should show up underneath. For this tutorial I am using a Zealot, so select "Zealot" and click "Ok."
- Congratulations, you now have a light blue aura around your hero!
Attaching with the Data Editor
The following is written assuming you have the "Show Table View" button pressed next to the right "Search" bar of the Data Editor. Again, we'll be attaching an OmniLight to a Zealot in this example.
Creating the Model
- Go into the Data Editor (F7) and under "Data Type:" select "Models."
- Right-click in the left box (on any of the existing "Models" if you'd like) and select "Add Object..." (or press Ctrl+=). Let's name this Model "OmniLight Aura" with the type set to "Generic" and based on "OneShotSpellFX." Make sure you also click "Suggest" for the ID. Click "OK" and you now have a brand new model to modify.
- With the "OmniLight Aura" model selected, find "Model" in the box on the right. Double-click the space next to it to open an "Object Values" window. Click "Browse..." on the right to open the "Archive Browser" window. Do a quick search for "LightOmni" and select whichever color you want (in this case, I'll choose "LightOmniRedLarge.m3"). Click "OK" to close the "Archive Browser" and click "OK" once more to close the "Object Values" window.
Creating the Actor
- Now under "Data Type:" select "Actors."
- Right-click in the left box (on any of the existing "Actors" if you'd like) and select "Add Object..." (or press Ctrl+=). Name this Actor "OmniLight Aura" with the type set to "Model" and based on "Model Animation Style One Shot." Make sure you also click "Suggest" for the ID. Click "OK" and you now have a brand new actor to modify. You should also notice that our "OmniLight Aura" model is automatically linked to this new actor.
- With the "OmniLight Aura" actor selected, find "Event - Events +" in the box on the right. Double-click the space next to it to open an "Object Values" window.
- Select "ActorCreation" on the left to bring up details about this event on the right. Click on "Flags: Play Once" on the right. In the box on underneath, uncheck "Play Once" and check "Play Forever."
- Now right-click in the box on the left and select "Add Event". Select the newly created event and change the "Msg Type:" to "Unit Birth" and the "Source Name:" to "Zealot." Now select the "ActionImpact" under your newly created event, and change the "Msg Type:" to "Create."
- Click "OK" to close the "Object Values" window.
- Now find "Hosting - Host +" and double-click the space next to it to open a new "Object Values" window. Under "Subject" click the button next to "Alias" and in the textbox, type in "_Selectable." Click "OK" to close the window.
- Now find "Hosting - Host Site Operations +" and double-click on the space next to it to open a new "Object Values" window. Click the green X next to the "Operations" box to add a new value. Change this value to "SOpAttachOrigin" and click "OK" to close the window.
- As a side note, to see specific attachment points for a certain unit, you can open up the Previewer in "Window > Previewer" (Ctrl+Shift+V). With the Previewer window open, go to "Render > Show Geometry > Attachment Points" (A). Now find whichever unit you would like to check and see the specific points for that unit.
- Congratulations, you should now see a red aura around your Zealot.