Model issues

DonMushroom

Member
Reaction score
4
I am looking to morph/switch model of a unit at the end up a upgrade on top of the upgrade itself.

So for example if i have a few zerglings out and a roach. When i get the zergling speed upgrade the zerglings upgrade as normal and the roachs model morphs/cwitches into a queen but stays a roach in all other aspects. :)

Oh and how to change there portrait at the same time :)
 

Dave312

Censored for your safe viewing
Reaction score
269
You need to use actor events to change the model. You need to add 3 actor events: one which upgrades all existing units to the new model when the upgrade is completed; one which upgrades units to the new model when the unit is trained/created if the upgrade has been completed; and the last one changes the units death model if the upgrade has been completed.
Code:
Upgrade.<Your_Upgrade>.Add
   ModelSwap <Upgraded_Model>

ActorCreation
   ValidateUnit <Unit_Upgraded>
   ModelSwap <Upgraded_Model>

UnitDeathCustomize
   ValidateUnit <Unit_Upgraded>
   DeathCustomized Upgrade

<Upgraded_Model> is the new model that you want to be used for the unit.
<Unit_Upgraded> is a validator which checks if the player has researched the upgrade.

In the last event, the action is DeathCustomize Upgrade. In order to get this to work, you need to add a new customized death to the unit and call it upgrade. To do this, go to the Actor for the unit and open up the Combat: Custom Death +. Add a new index to the box at the top and set the Model value to the death model for your new unit model and set the Name value to type Custom and string Upgrade.

Look at the actor events for when the zergling unit is upgraded if you want a reference.


You should be able to use a similar process to also upgrade the portrait as well:
Code:
UnitPortrait.*.Customize
   ValidateUnit <Unit_Upgraded>
   PortraitCustomize <Upgraded_Portrait> _Unit


Let me know if you need further assistance or if I have glossed over something you don't understand.
 

DonMushroom

Member
Reaction score
4
I have tried everything i can think of. :(

I just cant get the portrait to change at the end of the upgrade. I have tried using Upgrade effects, Tried using Actor event effects and i just cant seem to get it to change.

Has anyone tried changing a portrait at the end of a upgrade before?
 

Dave312

Censored for your safe viewing
Reaction score
269
Sorry it has taken me so long to get back to you about this. I have meaning meaning to look into this further but haven't had a chance/forgotten about it until now.

There was a minor error in the event that I posted for the customized portrait. When setting the portrait, you want to leave the Actor parameter blank. It should now look like this:
Code:
UnitPortrait.*.Customize
   ValidateUnit <Unit_Upgraded>
   PortraitCustomize <Upgraded_Portrait>
 

Dave312

Censored for your safe viewing
Reaction score
269
Is the event exactly the same as what I posted? What happens if you delete the Term (the middle line)?

I have tested what I posted so I know it works.
 

DonMushroom

Member
Reaction score
4
If i delete the Term it changes from the start so that bit works. :)

The term is the same as the model swap though and that works perfectly. So why would it not be working? :(
 

Dave312

Censored for your safe viewing
Reaction score
269
That is a good question, but it has to be the Term that is causing it. My suggestion is to try playing around with it. Change which validator you are using (try Life > 3/4 HP and see what happens). Unfortunately I can't replicate your problem so I don't know what else I can tell you to do.
 
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