Changing model with upgrade?

Blazer-X

New Member
Reaction score
0
Hey, I was wondering how to change a unit's in-game model to another following another. I was trying to get the Battlecruiser to change its model to that of the Merc BC via the weapon refit upgrade. I've looked at the marine combat shield upgrade as reference and so far managed to change the icon and portrait, but I can't seem to get the actual model to change. Help?

Thanks.
 

Builder Bob

Live free or don't
Reaction score
249
Look in the events for the unit's actor. Model Swap should do the trick. I don't have much time to give extensive details right now, but I'll come back if you need more help.
 

Blazer-X

New Member
Reaction score
0
Well, it kinda did the trick. All battlecruisers made beforehand are fine. However, any battlecruisers I created after the upgrade used the old model. Granted, all I did was added model swap as an extra event after upgrade, so I might be doing something wrong. Please elaborate?

Thanks
 

Builder Bob

Live free or don't
Reaction score
249
that's a good start. Keep that event.

To fix it so that every BC created after the upgrade has the right model, you need a new Validator and another event in the actor. The Validator will check if you have the upgrade. The event will be Actor Creation - Term Validate Player [the validator you just made] - Model Swap.

Look up validators like Has Marine Shield Upgrade or Missing Marine Shield Upgrade to get an idea of how to make yours. Validate - Player should be Player Origin though.


You may also need to add the validator you specific events to make sure the right animations, etc are playing for both models. It's up to you how detailed you want to make it.

Good luck!
 

Blazer-X

New Member
Reaction score
0
Well, I got the battlecruisers to come out as the merc model, but now I'm running into 2 issues.

1) Yamato Gun charging is screwed up with the new model. Its using the regular BC one, I'm guessing. For some reason, its always pointing either up or down. Is there a way to switch the charging actor to that of the merc BC's?

2) Death animation is still using the regular BC's. Is there a way to switch that as well?

In addition, by just switching the model, could I get the BC to use the same "rotating cannon attack" animation that the merc BC uses? Or would I need to add that animation in as well?

I think all in all, what I need might actually be an actor swap than just a model swap. If possible, please explain to me how the whole actor event stuff work?

Thank you
 

Builder Bob

Live free or don't
Reaction score
249
(It can be done with one actor. All you need to do is figure out which events will give the results you want for both models, and which won't. For the ones that won't you must create duplicate events for, and check for the Term - ValidatePlayer - PlayerHasUpgrade and Term - ValidatePlayer - PlayerNotHaveUpgrade, to make sure the correct event is triggered depending on which model you know will be present.)

You can also do an actor swap if you'd rather want that. To do this, replace the model swaps you've made with destroy. Now this actor will be removed whenever you have upgraded to the new battle cruiser. Create another actor for the new battle cruiser. Set up and event in this new actor that will create this actor on unit birth - playerHasUpgrade.
To change models already created when you get the upgrade you should make an event in the old actor. PlayerGetsUpgrade - Create:NewActorName. This is all pseudocode, so don't take it literally.

Let me know if you can't get the new actor to line up with the old. It can be fixed, but I think it will if you use the right bases for your actors.


As for explaining the actor events, the basics are simple, but it's a big subject so I can't go into it all without you asking for more specific information. I'll try help you out though. An event's first line tells what the actor watches for to happen. If you add a term, the action will only be taken if the term is true, like a condition. The action that follows will be taken on the unit that the actor was created for, usually. You can make complex events as well though, but I won't go into that. Just think that by default, an action will always affect the unit that the actor was created for.
 

Blazer-X

New Member
Reaction score
0
Well, my main issue right now is the death animation. From what I can see, each actor is linked to one model only (in the combat tab). So how should I get it so that it changes to play the proper death animation?
 

Builder Bob

Live free or don't
Reaction score
249
Make an actor for your alternate death animation if you don't have one already. Set it up with model, animation on creation and actor destruction when animation is over. Actor type could for example be Model - ModelAnimationStyleOneShotNoOrphan.

Go back to the actor for the unit you're working with. Add an event UnitCustomDeath.[UnitName] - Validate that it's upgraded - Create custom death actor (the actor for the new death animation you just created)

Edit: I'm not sompletely sure about this one, but I hope it will do the job.
 

Blazer-X

New Member
Reaction score
0
The death animation thing worked! Thanks!

Got a little side-problem. Its not really related to changing models anymore. I'm trying to add an extra attack to the unit after it has been upgraded. I tried having the attack initially disabled, and ten enabling it through the "upgrades - effect" tab. Problem is, the BCs that are created before the upgrade still has the weapon disabled, while all the new BCs are fine. I'm sure this is not supposed to be a hard process, but I'm just not sure how to get this to work.

Edit: Nevermind, I found another approach: Using a validator on the weapon effect itself to require the BC to be upgraded. Otherwise, even though the BC technically has the weapon, it cannot "use it".
 

Builder Bob

Live free or don't
Reaction score
249
Glad your model changes correctly now :)

As for your other problem, I'm not sure how to do that without either using triggers (find all battlecruisers and do the updates), or having every battlecruiser spawn with a behavior that periodically checks if the player has the upgrade or not. Having so many periodically checks doesn't seem efficient to me, but maybe the SC2 engine handles stuff like that just fine.

The workaround doesn't sound too bad either. Could even be good to be able to see what you can get by upgrading next. Depends on how you want it to be presented.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top