I'm working on a TD map where I have towers which can be upgraded multiple times. Each tower level is a different unit and they're upgraded via a morph ability. I want to avoid creating a different actor for each tower level though, so I just use one actor for each - I just don't bother destroying and recreating it with each morph level.
This works fine except for two bugs: first, when upgrading to the next tower level, the icon next to the progress bar is blank (when it should be the actor icon.) Second, when the unit is selected it does not show the right weapon and armor information for it, in fact it shows the information for the last unupgraded unit that was selected.
I realize that's because the actor's unit link is no longer valid after the morph is complete. What I'm wondering now is the best way to set up the events so that the actor's unit link is updated to the morphed unit, or the actor is destroyed and recreated in a completely transparent fashion before, during, or after the morph event. This is complicated slightly by the fact that for some of the actors I'm playing animations that are triggered by the morph event.
Anyway I'm going to wrap my head around this tomorrow, but if anyone has already tackled it I would appreciate hearing about it before I repeat your effort.
(There's also the fact that in the morph ability there's both an "Actor Duration" and "Actor Delay" field, I haven't yet figured out how those interact with the actor object, but I suspect it's probably important.)
Actors are only linked to units via events. Whatever the scope of the event where the actor is created that's the unit it's linked to. So you can most definitely have a single actor object used for multiple units as long as you set up the events right. My question is specifically about dealing with unit morphing - at what point should I destroy the actor for the old unit and create the actor for the new unit.
Or to be more specific what does the timeline look like for a unit morph? At what point is the old unit removed and the new unit created? Do they overlap or is there a boundary point? And what happens if the morph is cancelled?
at what point should I destroy the actor for the old unit and create the actor for the new unit.
I use a trigger at the start of my map that activates the enemy spawn, and thus beginning the game, once the player morphs his building into one of several possible upgrades. To do this, I use an event that is something like "Morph Actor End", sorry I don't have the map with me right now so I can't check exactly. I would say change actors when the morph is complete.
Quote:
Or to be more specific what does the timeline look like for a unit morph? At what point is the old unit removed and the new unit created? Do they overlap or is there a boundary point? And what happens if the morph is cancelled?
However, I had the upgraded building provide supplies, and the base building provide none. Immediately upon starting the morph, I gained supplies, and canceling the morph took them away. This tells me that the new unit is created when the morph is started, not when the progress is completed. This must mean that whether or not the old unit is removed, the actor is changed to the new unit at the beginning of the morph.
Hopefully this helps.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm working on a TD map where I have towers which can be upgraded multiple times. Each tower level is a different unit and they're upgraded via a morph ability. I want to avoid creating a different actor for each tower level though, so I just use one actor for each - I just don't bother destroying and recreating it with each morph level.
This works fine except for two bugs: first, when upgrading to the next tower level, the icon next to the progress bar is blank (when it should be the actor icon.) Second, when the unit is selected it does not show the right weapon and armor information for it, in fact it shows the information for the last unupgraded unit that was selected.
I realize that's because the actor's unit link is no longer valid after the morph is complete. What I'm wondering now is the best way to set up the events so that the actor's unit link is updated to the morphed unit, or the actor is destroyed and recreated in a completely transparent fashion before, during, or after the morph event. This is complicated slightly by the fact that for some of the actors I'm playing animations that are triggered by the morph event.
Anyway I'm going to wrap my head around this tomorrow, but if anyone has already tackled it I would appreciate hearing about it before I repeat your effort.
(There's also the fact that in the morph ability there's both an "Actor Duration" and "Actor Delay" field, I haven't yet figured out how those interact with the actor object, but I suspect it's probably important.)
You must create a new actor with a link to the new unit.
@kozm0naut: Go
Actors are only linked to units via events. Whatever the scope of the event where the actor is created that's the unit it's linked to. So you can most definitely have a single actor object used for multiple units as long as you set up the events right. My question is specifically about dealing with unit morphing - at what point should I destroy the actor for the old unit and create the actor for the new unit.
Or to be more specific what does the timeline look like for a unit morph? At what point is the old unit removed and the new unit created? Do they overlap or is there a boundary point? And what happens if the morph is cancelled?
SC2 needs a debug stream :(
I use a trigger at the start of my map that activates the enemy spawn, and thus beginning the game, once the player morphs his building into one of several possible upgrades. To do this, I use an event that is something like "Morph Actor End", sorry I don't have the map with me right now so I can't check exactly. I would say change actors when the morph is complete.
However, I had the upgraded building provide supplies, and the base building provide none. Immediately upon starting the morph, I gained supplies, and canceling the morph took them away. This tells me that the new unit is created when the morph is started, not when the progress is completed. This must mean that whether or not the old unit is removed, the actor is changed to the new unit at the beginning of the morph.
Hopefully this helps.