I will guide you through the steps needed to attach actors onto units as they spawn with DATA.
At the end of this tutorial, you can find what you need to change, if you want to make the attached actor create/destroyable on the fly ingame.
Steps:
1. Create a new actor with "Model" - "Model Animation Style Continuous (Unit)"(!)
2. Chose the model for the actor.
3. Open actor events
3.1. Right click left area and add an event.
3.2. Select first line (the event) and chose "UnitCreation.MyUnit"(!)
3.3. Select the second line and chose "Create". This will spawn the actor.
3.4. The grey events ones should contain that the actor will be destroyed ingame
(to release the memory usage). If it's missing, add one with a good event like "ActorOrphan -> Destroy".
3.5 Check the bearings host reference. It needs to be "_Selectable:Implicit:Implicit::0" for a unit. If you want to attach something to a missile, you use "_Missile:Implicit:Implicit::0".
NOTE: If you want to reset the a field in the data editor, right click it, chose "reset to parent value"
and always chose the top option.
4. Edit the model flags and untick the "Allow hit test", if you want the attachment not to change the mouse pointer
(it might be huge, if the model file contains a big sphere for that).
5. Add the site operation with the main unit's attachment point as seen in the cutscene editor
(right click the actor and select preview; then select the model in the bottom left area, hit A on the keyboard to see the attachment points,
press shift + D to open the model details window and then have a look into the attachments folder. Sekecting an attachment highlights the attachment on the model).
Make sure that it is the correct attachment point as it needs to be existent on the unit (!).
For example there are a few attachment points with weapon, but only the correct attachment methods can be used.
5.1 If the attachment points are missing, duplicate a site operation (it's an actor) which is like the one you want
(like a hardpoint attachment).
5.2 Open Attachment Query, set the Method to "Direct" and chose the point type you need.
Then set the index (no index number in previewer means 0).
5.3 Use that as your hosted site operation.
6. Test the document.
Troubleshooting:
7. If your attachment doesn't spawn at all, check your actor type as seen in step 1.
8. If your attachment still doesn't spawn at all, check the actor events.
Further notes:
- You can use behaviors to create and destroy the attachment. This way you can dynamically add attachments to units.
- You can duplicate site operations and edit them to make the model not rotate with the unit for example.
This would need to have an enabled "soft attach" in the site operation.
Alternatives to make it dynamically:
- Use a behavior to enable and disable the attachment. The only differences are the actor events that create and destroy the unit need to be changed to Behavior.MyBehavior.On->Create and Behavior.MyBehavior.Off->Destroy.t spawn at all, check the actor events.
Further notes:
- You can use behaviors to create and destroy the attachment. This way you can dynamically add attachments to units.
- You can duplicate site operations and edit them to make the model not rotate with the unit for example.
This would need to have an enabled
Post has been edited 4 time(s), last time on Jan 14 2013, 6:53 pm by Ahli. Reason: updated previewer to cutscene editor