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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top