Changing model with upgrade?

Blazer-X

New Member
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
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
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
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
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
(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
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
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
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
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:
    Seeing J4L is definitely a blast from the past.
  • Jesus4Lyf Jesus4Lyf:
    Oh hey Ghan! Long time. :)
    +1
  • jonas jonas:
    J4L! What has happened in your life
  • Jesus4Lyf Jesus4Lyf:
    Hmm, how to summarize... Moved to the USA and got married. Became a professional software engineer and solution lead. Learning Godot for game dev. :)
  • jonas jonas:
    So you are pursuing game dev as a hobby? What industry is your dayjob in?
  • jonas jonas:
    FAANG?
  • Jesus4Lyf Jesus4Lyf:
    Not quite FAANG, less pay for a less hours/stress. Yeah, game dev as a hobby.
  • jonas jonas:
    makes sense. Do we have a hobby game dev subforum to showcase some work?
  • Blackveiled Blackveiled:
    Happy Thursday
    +1
  • The Helper The Helper:
    Happy Thursday!
  • The Helper The Helper:
    TGIF!
  • The Helper The Helper:
    hey tom_mai please do not archive anymore news
  • Ghan Ghan:
    AMD Ryzen 7000 next week :D
    +1
  • The Helper The Helper:
    noice!
  • tom_mai78101 tom_mai78101:
    "hey tom_mai please do not archive anymore news" ----> Got it. What should we do with the "News Archive" subforum?
  • The Helper The Helper:
    I think leave it for real old news that cannot be sorted the reason we had it in the first place was a server issue that we do not have anymore. I don't want to get rid of the archive just not put anything in it for now until we figure it out more
  • The Helper The Helper:
    The side chat has nothing on the discord. it is not possible but the biggest thing on my wish list right now is a sidechat channel on the disord that hooks up to this...
  • Ghan Ghan:
    I've been selected for the Diablo IV beta.
    +1
  • Ghan Ghan:
    Woo!
    +1
  • The Helper The Helper:
    that is so cool
  • V-SNES V-SNES:
    Eh just noticed the new discord section on the side. Looks great!
    +1
  • Blackveiled Blackveiled:
    :( feels bad I can't ever get selected for any beta I sign up for. It's annoying as heck.
    +1
  • The Helper The Helper:
    Hello mgarcia! Happy Monday everyone!

    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